diff --git a/gfx/angle/checkout/include/EGL/eglext_angle.h b/gfx/angle/checkout/include/EGL/eglext_angle.h index b5b7bae4a027..56cef42ec37f 100644 --- a/gfx/angle/checkout/include/EGL/eglext_angle.h +++ b/gfx/angle/checkout/include/EGL/eglext_angle.h @@ -175,6 +175,11 @@ EGLAPI EGLint EGLAPIENTRY eglProgramCacheResizeANGLE(EGLDisplay dpy, EGLint limi #define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D #endif /* EGL_ANGLE_iosurface_client_buffer */ +#ifndef EGL_ANGLE_create_context_extensions_enabled +#define EGL_ANGLE_create_context_extensions_enabled 1 +#define EGL_EXTENSIONS_ENABLED_ANGLE 0x345F +#endif /* EGL_ANGLE_create_context_extensions_enabled */ + // clang-format on #endif // INCLUDE_EGL_EGLEXT_ANGLE_ diff --git a/gfx/angle/checkout/include/GLSLANG/ShaderLang.h b/gfx/angle/checkout/include/GLSLANG/ShaderLang.h index 2091dfccebe6..753d11314648 100644 --- a/gfx/angle/checkout/include/GLSLANG/ShaderLang.h +++ b/gfx/angle/checkout/include/GLSLANG/ShaderLang.h @@ -25,7 +25,7 @@ // Version number for shader translation API. // It is incremented every time the API changes. -#define ANGLE_SH_VERSION 196 +#define ANGLE_SH_VERSION 197 enum ShShaderSpec { diff --git a/gfx/angle/checkout/include/GLSLANG/ShaderVars.h b/gfx/angle/checkout/include/GLSLANG/ShaderVars.h index 24aadbb53f0f..4f944d125f3a 100644 --- a/gfx/angle/checkout/include/GLSLANG/ShaderVars.h +++ b/gfx/angle/checkout/include/GLSLANG/ShaderVars.h @@ -126,7 +126,12 @@ struct ShaderVariable // and flattenedOffsetInParentArrays of a[2][1] would be 2*4 + 1 = 9. unsigned int flattenedOffsetInParentArrays; + // Static use means that the variable is accessed somewhere in the shader source. bool staticUse; + // A variable is active unless the compiler determined that it is not accessed by the shader. + // All active variables are statically used, but not all statically used variables are + // necessarily active. GLES 3.0.5 section 2.12.6. GLES 3.1 section 7.3.1. + bool active; std::vector fields; std::string structName; @@ -279,6 +284,7 @@ struct InterfaceBlock int binding; bool staticUse; + bool active; BlockType blockType; std::vector fields; }; diff --git a/gfx/angle/checkout/include/KHR/khrplatform.h b/gfx/angle/checkout/include/KHR/khrplatform.h index 68fca48271c2..975bbffed674 100644 --- a/gfx/angle/checkout/include/KHR/khrplatform.h +++ b/gfx/angle/checkout/include/KHR/khrplatform.h @@ -2,7 +2,7 @@ #define __khrplatform_h_ /* -** Copyright (c) 2008-2009 The Khronos Group Inc. +** Copyright (c) 2008-2018 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -26,18 +26,16 @@ /* Khronos platform-specific types and definitions. * - * $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $ + * The master copy of khrplatform.h is maintained in the Khronos EGL + * Registry repository at https://github.com/KhronosGroup/EGL-Registry + * The last semantic modification to khrplatform.h was at commit ID: + * 67a3e0864c2d75ea5287b9f3d2eb74a745936692 * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. - * Please submit changes by sending them to the public Khronos Bugzilla - * (http://khronos.org/bugzilla) by filing a bug against product - * "Khronos (general)" component "Registry". - * - * A predefined template which fills in some of the bug fields can be - * reached using http://tinyurl.com/khrplatform-h-bugreport, but you - * must create a Bugzilla login first. + * Please submit changes by filing pull requests or issues on + * the EGL Registry repository linked above. * * * See the Implementer's Guidelines for information about where this file @@ -102,8 +100,7 @@ #elif defined (__SYMBIAN32__) # define KHRONOS_APICALL IMPORT_C #elif defined(__ANDROID__) -# include -# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__ +# define KHRONOS_APICALL __attribute__((visibility("default"))) #else # define KHRONOS_APICALL #endif @@ -282,4 +279,4 @@ typedef enum { KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM } khronos_boolean_enum_t; -#endif /* __khrplatform_h_ */ \ No newline at end of file +#endif /* __khrplatform_h_ */ diff --git a/gfx/angle/checkout/out/gen/angle/id/commit.h b/gfx/angle/checkout/out/gen/angle/id/commit.h index 5e72e685ed2d..a38160c00fc7 100644 --- a/gfx/angle/checkout/out/gen/angle/id/commit.h +++ b/gfx/angle/checkout/out/gen/angle/id/commit.h @@ -1,3 +1,3 @@ -#define ANGLE_COMMIT_HASH "fcbca0e873c3" +#define ANGLE_COMMIT_HASH "2426b097472f" #define ANGLE_COMMIT_HASH_SIZE 12 -#define ANGLE_COMMIT_DATE "2018-04-20 16:07:35 -0700" +#define ANGLE_COMMIT_DATE "2018-05-22 15:14:46 -0700" diff --git a/gfx/angle/checkout/src/common/Color.h b/gfx/angle/checkout/src/common/Color.h index 2b4d2f6fba4f..5af2e8529c46 100644 --- a/gfx/angle/checkout/src/common/Color.h +++ b/gfx/angle/checkout/src/common/Color.h @@ -15,13 +15,16 @@ namespace angle template struct Color { + Color(); + Color(T r, T g, T b, T a); + + const T *data() const { return &red; } + T *ptr() { return &red; } + T red; T green; T blue; T alpha; - - Color(); - Color(T r, T g, T b, T a); }; template diff --git a/gfx/angle/checkout/src/common/FixedVector.h b/gfx/angle/checkout/src/common/FixedVector.h new file mode 100644 index 000000000000..bb996c972cbe --- /dev/null +++ b/gfx/angle/checkout/src/common/FixedVector.h @@ -0,0 +1,331 @@ +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// FixedVector.h: +// A vector class with a maximum size and fixed storage. +// + +#ifndef COMMON_FIXEDVECTOR_H_ +#define COMMON_FIXEDVECTOR_H_ + +#include "common/debug.h" + +#include +#include +#include + +namespace angle +{ +template > +class FixedVector final +{ + public: + using value_type = typename Storage::value_type; + using size_type = typename Storage::size_type; + using reference = typename Storage::reference; + using const_reference = typename Storage::const_reference; + using pointer = typename Storage::pointer; + using const_pointer = typename Storage::const_pointer; + using iterator = typename Storage::iterator; + using const_iterator = typename Storage::const_iterator; + using reverse_iterator = typename Storage::reverse_iterator; + using const_reverse_iterator = typename Storage::const_reverse_iterator; + + FixedVector(); + FixedVector(size_type count, const value_type &value); + FixedVector(size_type count); + + FixedVector(const FixedVector &other); + FixedVector(FixedVector &&other); + FixedVector(std::initializer_list init); + + FixedVector &operator=(const FixedVector &other); + FixedVector &operator=(FixedVector &&other); + FixedVector &operator=(std::initializer_list init); + + ~FixedVector(); + + reference at(size_type pos); + const_reference at(size_type pos) const; + + reference operator[](size_type pos); + const_reference operator[](size_type pos) const; + + pointer data(); + const_pointer data() const; + + iterator begin(); + const_iterator begin() const; + + iterator end(); + const_iterator end() const; + + bool empty() const; + size_type size() const; + size_type max_size() const; + + void clear(); + + void push_back(const value_type &value); + void push_back(value_type &&value); + + void pop_back(); + reference back(); + const_reference back() const; + + void swap(FixedVector &other); + + void resize(size_type count); + void resize(size_type count, const value_type &value); + + bool full() const; + + private: + void assign_from_initializer_list(std::initializer_list init); + + Storage mStorage; + size_type mSize = 0; +}; + +template +bool operator==(const FixedVector &a, const FixedVector &b) +{ + return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin()); +} + +template +bool operator!=(const FixedVector &a, const FixedVector &b) +{ + return !(a == b); +} + +template +FixedVector::FixedVector() = default; + +template +FixedVector::FixedVector(size_type count, const value_type &value) : mSize(count) +{ + ASSERT(count <= N); + std::fill(mStorage.begin(), mStorage.begin() + count, value); +} + +template +FixedVector::FixedVector(size_type count) : mSize(count) +{ + ASSERT(count <= N); +} + +template +FixedVector::FixedVector(const FixedVector &other) = default; + +template +FixedVector::FixedVector(FixedVector &&other) = default; + +template +FixedVector::FixedVector(std::initializer_list init) +{ + ASSERT(init.size() <= N); + assign_from_initializer_list(init); +} + +template +FixedVector &FixedVector::operator=( + const FixedVector &other) = default; + +template +FixedVector &FixedVector::operator=( + FixedVector &&other) = default; + +template +FixedVector &FixedVector::operator=( + std::initializer_list init) +{ + clear(); + ASSERT(init.size() <= N); + assign_from_initializer_list(init); + return this; +} + +template +FixedVector::~FixedVector() +{ + clear(); +} + +template +typename FixedVector::reference FixedVector::at(size_type pos) +{ + ASSERT(pos < N); + return mStorage.at(pos); +} + +template +typename FixedVector::const_reference FixedVector::at( + size_type pos) const +{ + ASSERT(pos < N); + return mStorage.at(pos); +} + +template +typename FixedVector::reference FixedVector::operator[](size_type pos) +{ + ASSERT(pos < N); + return mStorage[pos]; +} + +template +typename FixedVector::const_reference FixedVector::operator[]( + size_type pos) const +{ + ASSERT(pos < N); + return mStorage[pos]; +} + +template +typename FixedVector::const_pointer angle::FixedVector::data() const +{ + return mStorage.data(); +} + +template +typename FixedVector::pointer angle::FixedVector::data() +{ + return mStorage.data(); +} + +template +typename FixedVector::iterator FixedVector::begin() +{ + return mStorage.begin(); +} + +template +typename FixedVector::const_iterator FixedVector::begin() const +{ + return mStorage.begin(); +} + +template +typename FixedVector::iterator FixedVector::end() +{ + return mStorage.begin() + mSize; +} + +template +typename FixedVector::const_iterator FixedVector::end() const +{ + return mStorage.begin() + mSize; +} + +template +bool FixedVector::empty() const +{ + return mSize == 0; +} + +template +typename FixedVector::size_type FixedVector::size() const +{ + return mSize; +} + +template +typename FixedVector::size_type FixedVector::max_size() const +{ + return N; +} + +template +void FixedVector::clear() +{ + resize(0); +} + +template +void FixedVector::push_back(const value_type &value) +{ + ASSERT(mSize < N); + mStorage[mSize] = value; + mSize++; +} + +template +void FixedVector::push_back(value_type &&value) +{ + ASSERT(mSize < N); + mStorage[mSize] = std::move(value); + mSize++; +} + +template +void FixedVector::pop_back() +{ + ASSERT(mSize > 0); + mSize--; +} + +template +typename FixedVector::reference FixedVector::back() +{ + ASSERT(mSize > 0); + return mStorage[mSize - 1]; +} + +template +typename FixedVector::const_reference FixedVector::back() const +{ + ASSERT(mSize > 0); + return mStorage[mSize - 1]; +} + +template +void FixedVector::swap(FixedVector &other) +{ + std::swap(mSize, other.mSize); + std::swap(mStorage, other.mStorage); +} + +template +void FixedVector::resize(size_type count) +{ + resize(count, value_type()); +} + +template +void FixedVector::resize(size_type count, const value_type &value) +{ + ASSERT(count <= N); + while (mSize > count) + { + mSize--; + mStorage[mSize] = T(); + } + while (mSize < count) + { + mStorage[mSize] = value; + mSize++; + } +} + +template +void FixedVector::assign_from_initializer_list( + std::initializer_list init) +{ + for (auto element : init) + { + mStorage[mSize] = std::move(element); + mSize++; + } +} + +template +bool FixedVector::full() const +{ + return (mSize == N); +} +} // namespace angle + +#endif // COMMON_FIXEDVECTOR_H_ diff --git a/gfx/angle/checkout/src/common/angleutils.h b/gfx/angle/checkout/src/common/angleutils.h index 829897caa6f7..a7815c6b7cbd 100644 --- a/gfx/angle/checkout/src/common/angleutils.h +++ b/gfx/angle/checkout/src/common/angleutils.h @@ -191,6 +191,7 @@ std::string ToString(const T &value) #define snprintf _snprintf #endif +#define GL_A1RGB5_ANGLEX 0x6AC5 #define GL_BGRX8_ANGLEX 0x6ABA #define GL_BGR565_ANGLEX 0x6ABB #define GL_BGRA4_ANGLEX 0x6ABC diff --git a/gfx/angle/checkout/src/common/bitset_utils.h b/gfx/angle/checkout/src/common/bitset_utils.h index 7febb78e52f8..72e40c327165 100644 --- a/gfx/angle/checkout/src/common/bitset_utils.h +++ b/gfx/angle/checkout/src/common/bitset_utils.h @@ -40,10 +40,10 @@ class BitSetT final private: friend class BitSetT; - Reference(BitSetT *parent, std::size_t bit) : mParent(parent), mBit(bit) {} + Reference(BitSetT *parent, ParamT bit) : mParent(parent), mBit(bit) {} BitSetT *mParent; - std::size_t mBit; + ParamT mBit; }; class Iterator final @@ -64,8 +64,7 @@ class BitSetT final }; BitSetT(); - BitSetT(BitsT value); - ~BitSetT(); + constexpr explicit BitSetT(BitsT value); BitSetT(const BitSetT &other); BitSetT &operator=(const BitSetT &other); @@ -90,6 +89,10 @@ class BitSetT final BitSetT &operator^=(const BitSetT &other); BitSetT operator~() const; + BitSetT &operator&=(BitsT value); + BitSetT &operator|=(BitsT value); + BitSetT &operator^=(BitsT value); + BitSetT operator<<(std::size_t pos) const; BitSetT &operator<<=(std::size_t pos); BitSetT operator>>(std::size_t pos) const; @@ -115,7 +118,11 @@ class BitSetT final { return (static_cast(1) << static_cast(x)); } - constexpr static BitsT Mask(std::size_t x) { return ((Bit(x - 1) - 1) << 1) + 1; } + // Produces a mask of ones up to the "x"th bit. + constexpr static BitsT Mask(std::size_t x) + { + return ((Bit(static_cast(x - 1)) - 1) << 1) + 1; + } BitsT mBits; }; @@ -213,12 +220,7 @@ BitSetT::BitSetT() : mBits(0) } template -BitSetT::BitSetT(BitsT value) : mBits(value & Mask(N)) -{ -} - -template -BitSetT::~BitSetT() +constexpr BitSetT::BitSetT(BitsT value) : mBits(value & Mask(N)) { } @@ -312,6 +314,27 @@ BitSetT BitSetT::operator~() const return BitSetT(~mBits & Mask(N)); } +template +BitSetT &BitSetT::operator&=(BitsT value) +{ + mBits &= value; + return *this; +} + +template +BitSetT &BitSetT::operator|=(BitsT value) +{ + mBits |= value; + return *this; +} + +template +BitSetT &BitSetT::operator^=(BitsT value) +{ + mBits ^= value; + return *this; +} + template BitSetT BitSetT::operator<<(std::size_t pos) const { diff --git a/gfx/angle/checkout/src/common/mathutil.h b/gfx/angle/checkout/src/common/mathutil.h index 73b31b740b17..063d9eb0e500 100644 --- a/gfx/angle/checkout/src/common/mathutil.h +++ b/gfx/angle/checkout/src/common/mathutil.h @@ -9,12 +9,12 @@ #ifndef COMMON_MATHUTIL_H_ #define COMMON_MATHUTIL_H_ -#include -#include #include -#include #include #include +#include +#include +#include #include @@ -30,10 +30,10 @@ using base::IsValueInRangeForNumericType; namespace gl { -const unsigned int Float32One = 0x3F800000; +const unsigned int Float32One = 0x3F800000; const unsigned short Float16One = 0x3C00; -template +template inline bool isPow2(T x) { static_assert(std::is_integral::value, "isPow2 must be called on an integer type."); @@ -43,13 +43,15 @@ inline bool isPow2(T x) inline int log2(int x) { int r = 0; - while ((x >> r) > 1) r++; + while ((x >> r) > 1) + r++; return r; } inline unsigned int ceilPow2(unsigned int x) { - if (x != 0) x--; + if (x != 0) + x--; x |= x >> 1; x |= x >> 2; x |= x >> 4; @@ -108,7 +110,7 @@ inline int clampCast(bool value) return static_cast(value); } -template +template inline T clamp(T x, MIN min, MAX max) { // Since NaNs fail all comparison tests, a NaN value will default to min @@ -120,7 +122,7 @@ inline float clamp01(float x) return clamp(x, 0.0f, 1.0f); } -template +template inline unsigned int unorm(float x) { const unsigned int max = 0xFFFFFFFF >> (32 - n); @@ -142,7 +144,7 @@ inline unsigned int unorm(float x) inline bool supportsSSE2() { #if defined(ANGLE_USE_SSE) - static bool checked = false; + static bool checked = false; static bool supports = false; if (checked) @@ -182,19 +184,19 @@ destType bitCast(const sourceType &source) inline unsigned short float32ToFloat16(float fp32) { unsigned int fp32i = bitCast(fp32); - unsigned int sign = (fp32i & 0x80000000) >> 16; - unsigned int abs = fp32i & 0x7FFFFFFF; + unsigned int sign = (fp32i & 0x80000000) >> 16; + unsigned int abs = fp32i & 0x7FFFFFFF; - if(abs > 0x47FFEFFF) // Infinity + if (abs > 0x47FFEFFF) // Infinity { return static_cast(sign | 0x7FFF); } - else if(abs < 0x38800000) // Denormal + else if (abs < 0x38800000) // Denormal { unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000; - int e = 113 - (abs >> 23); + int e = 113 - (abs >> 23); - if(e < 24) + if (e < 24) { abs = mantissa >> e; } @@ -207,7 +209,8 @@ inline unsigned short float32ToFloat16(float fp32) } else { - return static_cast(sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13); + return static_cast( + sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13); } } @@ -218,24 +221,24 @@ void convert999E5toRGBFloats(unsigned int input, float *red, float *green, float inline unsigned short float32ToFloat11(float fp32) { - const unsigned int float32MantissaMask = 0x7FFFFF; - const unsigned int float32ExponentMask = 0x7F800000; - const unsigned int float32SignMask = 0x80000000; - const unsigned int float32ValueMask = ~float32SignMask; + const unsigned int float32MantissaMask = 0x7FFFFF; + const unsigned int float32ExponentMask = 0x7F800000; + const unsigned int float32SignMask = 0x80000000; + const unsigned int float32ValueMask = ~float32SignMask; const unsigned int float32ExponentFirstBit = 23; - const unsigned int float32ExponentBias = 127; + const unsigned int float32ExponentBias = 127; - const unsigned short float11Max = 0x7BF; + const unsigned short float11Max = 0x7BF; const unsigned short float11MantissaMask = 0x3F; const unsigned short float11ExponentMask = 0x7C0; - const unsigned short float11BitMask = 0x7FF; - const unsigned int float11ExponentBias = 14; + const unsigned short float11BitMask = 0x7FF; + const unsigned int float11ExponentBias = 14; const unsigned int float32Maxfloat11 = 0x477E0000; const unsigned int float32Minfloat11 = 0x38800000; const unsigned int float32Bits = bitCast(fp32); - const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; + const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; unsigned int float32Val = float32Bits & float32ValueMask; @@ -244,7 +247,9 @@ inline unsigned short float32ToFloat11(float fp32) // INF or NAN if ((float32Val & float32MantissaMask) != 0) { - return float11ExponentMask | (((float32Val >> 17) | (float32Val >> 11) | (float32Val >> 6) | (float32Val)) & float11MantissaMask); + return float11ExponentMask | + (((float32Val >> 17) | (float32Val >> 11) | (float32Val >> 6) | (float32Val)) & + float11MantissaMask); } else if (float32Sign) { @@ -272,8 +277,10 @@ inline unsigned short float32ToFloat11(float fp32) { // The number is too small to be represented as a normalized float11 // Convert it to a denormalized value. - const unsigned int shift = (float32ExponentBias - float11ExponentBias) - (float32Val >> float32ExponentFirstBit); - float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift; + const unsigned int shift = (float32ExponentBias - float11ExponentBias) - + (float32Val >> float32ExponentFirstBit); + float32Val = + ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift; } else { @@ -287,24 +294,24 @@ inline unsigned short float32ToFloat11(float fp32) inline unsigned short float32ToFloat10(float fp32) { - const unsigned int float32MantissaMask = 0x7FFFFF; - const unsigned int float32ExponentMask = 0x7F800000; - const unsigned int float32SignMask = 0x80000000; - const unsigned int float32ValueMask = ~float32SignMask; + const unsigned int float32MantissaMask = 0x7FFFFF; + const unsigned int float32ExponentMask = 0x7F800000; + const unsigned int float32SignMask = 0x80000000; + const unsigned int float32ValueMask = ~float32SignMask; const unsigned int float32ExponentFirstBit = 23; - const unsigned int float32ExponentBias = 127; + const unsigned int float32ExponentBias = 127; - const unsigned short float10Max = 0x3DF; + const unsigned short float10Max = 0x3DF; const unsigned short float10MantissaMask = 0x1F; const unsigned short float10ExponentMask = 0x3E0; - const unsigned short float10BitMask = 0x3FF; - const unsigned int float10ExponentBias = 14; + const unsigned short float10BitMask = 0x3FF; + const unsigned int float10ExponentBias = 14; const unsigned int float32Maxfloat10 = 0x477C0000; const unsigned int float32Minfloat10 = 0x38800000; const unsigned int float32Bits = bitCast(fp32); - const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; + const bool float32Sign = (float32Bits & float32SignMask) == float32SignMask; unsigned int float32Val = float32Bits & float32ValueMask; @@ -313,7 +320,9 @@ inline unsigned short float32ToFloat10(float fp32) // INF or NAN if ((float32Val & float32MantissaMask) != 0) { - return float10ExponentMask | (((float32Val >> 18) | (float32Val >> 13) | (float32Val >> 3) | (float32Val)) & float10MantissaMask); + return float10ExponentMask | + (((float32Val >> 18) | (float32Val >> 13) | (float32Val >> 3) | (float32Val)) & + float10MantissaMask); } else if (float32Sign) { @@ -341,8 +350,10 @@ inline unsigned short float32ToFloat10(float fp32) { // The number is too small to be represented as a normalized float11 // Convert it to a denormalized value. - const unsigned int shift = (float32ExponentBias - float10ExponentBias) - (float32Val >> float32ExponentFirstBit); - float32Val = ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift; + const unsigned int shift = (float32ExponentBias - float10ExponentBias) - + (float32Val >> float32ExponentFirstBit); + float32Val = + ((1 << float32ExponentFirstBit) | (float32Val & float32MantissaMask)) >> shift; } else { @@ -379,12 +390,11 @@ inline float float11ToFloat32(unsigned short fp11) { exponent--; mantissa <<= 1; - } - while ((mantissa & 0x40) == 0); + } while ((mantissa & 0x40) == 0); mantissa = mantissa & 0x3F; } - else // The value is zero + else // The value is zero { exponent = static_cast(-112); } @@ -418,12 +428,11 @@ inline float float10ToFloat32(unsigned short fp11) { exponent--; mantissa <<= 1; - } - while ((mantissa & 0x20) == 0); + } while ((mantissa & 0x20) == 0); mantissa = mantissa & 0x1F; } - else // The value is zero + else // The value is zero { exponent = static_cast(-112); } @@ -432,6 +441,32 @@ inline float float10ToFloat32(unsigned short fp11) } } +// Convers to and from float and 16.16 fixed point format. + +inline float FixedToFloat(uint32_t fixedInput) +{ + return static_cast(fixedInput) / 65536.0f; +} + +inline uint32_t FloatToFixed(float floatInput) +{ + static constexpr uint32_t kHighest = 32767 * 65536 + 65535; + static constexpr uint32_t kLowest = static_cast(-32768 * 65536 + 65535); + + if (floatInput > 32767.65535) + { + return kHighest; + } + else if (floatInput < -32768.65535) + { + return kLowest; + } + else + { + return static_cast(floatInput * 65536); + } +} + template inline float normalizedToFloat(T input) { @@ -563,12 +598,16 @@ inline unsigned short averageHalfFloat(unsigned short a, unsigned short b) inline unsigned int averageFloat11(unsigned int a, unsigned int b) { - return float32ToFloat11((float11ToFloat32(static_cast(a)) + float11ToFloat32(static_cast(b))) * 0.5f); + return float32ToFloat11((float11ToFloat32(static_cast(a)) + + float11ToFloat32(static_cast(b))) * + 0.5f); } inline unsigned int averageFloat10(unsigned int a, unsigned int b) { - return float32ToFloat10((float10ToFloat32(static_cast(a)) + float10ToFloat32(static_cast(b))) * 0.5f); + return float32ToFloat10((float10ToFloat32(static_cast(a)) + + float10ToFloat32(static_cast(b))) * + 0.5f); } template @@ -687,21 +726,21 @@ inline float Ldexp(float x, int exp) inline uint32_t packSnorm2x16(float f1, float f2) { int16_t leastSignificantBits = static_cast(roundf(clamp(f1, -1.0f, 1.0f) * 32767.0f)); - int16_t mostSignificantBits = static_cast(roundf(clamp(f2, -1.0f, 1.0f) * 32767.0f)); + int16_t mostSignificantBits = static_cast(roundf(clamp(f2, -1.0f, 1.0f) * 32767.0f)); return static_cast(mostSignificantBits) << 16 | (static_cast(leastSignificantBits) & 0xFFFF); } -// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then, each -// component is converted to a normalized floating-point value to generate the returned two float values. -// The first float value will be extracted from the least significant bits of the input; -// the last float value will be extracted from the most-significant bits. -// The conversion for unpacked fixed-point value to floating point is done as follows: -// unpackSnorm2x16 : clamp(f / 32767.0, -1, +1) +// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then, +// each component is converted to a normalized floating-point value to generate the returned two +// float values. The first float value will be extracted from the least significant bits of the +// input; the last float value will be extracted from the most-significant bits. The conversion for +// unpacked fixed-point value to floating point is done as follows: unpackSnorm2x16 : clamp(f / +// 32767.0, -1, +1) inline void unpackSnorm2x16(uint32_t u, float *f1, float *f2) { int16_t leastSignificantBits = static_cast(u & 0xFFFF); - int16_t mostSignificantBits = static_cast(u >> 16); + int16_t mostSignificantBits = static_cast(u >> 16); *f1 = clamp(static_cast(leastSignificantBits) / 32767.0f, -1.0f, 1.0f); *f2 = clamp(static_cast(mostSignificantBits) / 32767.0f, -1.0f, 1.0f); } @@ -715,22 +754,22 @@ inline void unpackSnorm2x16(uint32_t u, float *f1, float *f2) inline uint32_t packUnorm2x16(float f1, float f2) { uint16_t leastSignificantBits = static_cast(roundf(clamp(f1, 0.0f, 1.0f) * 65535.0f)); - uint16_t mostSignificantBits = static_cast(roundf(clamp(f2, 0.0f, 1.0f) * 65535.0f)); - return static_cast(mostSignificantBits) << 16 | static_cast(leastSignificantBits); + uint16_t mostSignificantBits = static_cast(roundf(clamp(f2, 0.0f, 1.0f) * 65535.0f)); + return static_cast(mostSignificantBits) << 16 | + static_cast(leastSignificantBits); } -// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then, each -// component is converted to a normalized floating-point value to generate the returned two float values. -// The first float value will be extracted from the least significant bits of the input; -// the last float value will be extracted from the most-significant bits. -// The conversion for unpacked fixed-point value to floating point is done as follows: -// unpackUnorm2x16 : f / 65535.0 +// First, unpacks a single 32-bit unsigned integer u into a pair of 16-bit unsigned integers. Then, +// each component is converted to a normalized floating-point value to generate the returned two +// float values. The first float value will be extracted from the least significant bits of the +// input; the last float value will be extracted from the most-significant bits. The conversion for +// unpacked fixed-point value to floating point is done as follows: unpackUnorm2x16 : f / 65535.0 inline void unpackUnorm2x16(uint32_t u, float *f1, float *f2) { uint16_t leastSignificantBits = static_cast(u & 0xFFFF); - uint16_t mostSignificantBits = static_cast(u >> 16); - *f1 = static_cast(leastSignificantBits) / 65535.0f; - *f2 = static_cast(mostSignificantBits) / 65535.0f; + uint16_t mostSignificantBits = static_cast(u >> 16); + *f1 = static_cast(leastSignificantBits) / 65535.0f; + *f2 = static_cast(mostSignificantBits) / 65535.0f; } // Helper functions intended to be used only here. @@ -821,19 +860,20 @@ inline void UnpackSnorm4x8(uint32_t u, float *f) inline uint32_t packHalf2x16(float f1, float f2) { uint16_t leastSignificantBits = static_cast(float32ToFloat16(f1)); - uint16_t mostSignificantBits = static_cast(float32ToFloat16(f2)); - return static_cast(mostSignificantBits) << 16 | static_cast(leastSignificantBits); + uint16_t mostSignificantBits = static_cast(float32ToFloat16(f2)); + return static_cast(mostSignificantBits) << 16 | + static_cast(leastSignificantBits); } -// Returns two floating-point values obtained by unpacking a 32-bit unsigned integer into a pair of 16-bit values, -// interpreting those values as 16-bit floating-point numbers according to the OpenGL ES Specification, -// and converting them to 32-bit floating-point values. -// The first float value is obtained from the 16 least-significant bits of u; -// the second component is obtained from the 16 most-significant bits of u. +// Returns two floating-point values obtained by unpacking a 32-bit unsigned integer into a pair of +// 16-bit values, interpreting those values as 16-bit floating-point numbers according to the OpenGL +// ES Specification, and converting them to 32-bit floating-point values. The first float value is +// obtained from the 16 least-significant bits of u; the second component is obtained from the 16 +// most-significant bits of u. inline void unpackHalf2x16(uint32_t u, float *f1, float *f2) { uint16_t leastSignificantBits = static_cast(u & 0xFFFF); - uint16_t mostSignificantBits = static_cast(u >> 16); + uint16_t mostSignificantBits = static_cast(u >> 16); *f1 = float16ToFloat32(leastSignificantBits); *f2 = float16ToFloat32(mostSignificantBits); @@ -1004,21 +1044,25 @@ int FindMSB(T bits) } // Returns whether the argument is Not a Number. -// IEEE 754 single precision NaN representation: Exponent(8 bits) - 255, Mantissa(23 bits) - non-zero. +// IEEE 754 single precision NaN representation: Exponent(8 bits) - 255, Mantissa(23 bits) - +// non-zero. inline bool isNaN(float f) { // Exponent mask: ((1u << 8) - 1u) << 23 = 0x7f800000u // Mantissa mask: ((1u << 23) - 1u) = 0x7fffffu - return ((bitCast(f) & 0x7f800000u) == 0x7f800000u) && (bitCast(f) & 0x7fffffu); + return ((bitCast(f) & 0x7f800000u) == 0x7f800000u) && + (bitCast(f) & 0x7fffffu); } // Returns whether the argument is infinity. -// IEEE 754 single precision infinity representation: Exponent(8 bits) - 255, Mantissa(23 bits) - zero. +// IEEE 754 single precision infinity representation: Exponent(8 bits) - 255, Mantissa(23 bits) - +// zero. inline bool isInf(float f) { // Exponent mask: ((1u << 8) - 1u) << 23 = 0x7f800000u // Mantissa mask: ((1u << 23) - 1u) = 0x7fffffu - return ((bitCast(f) & 0x7f800000u) == 0x7f800000u) && !(bitCast(f) & 0x7fffffu); + return ((bitCast(f) & 0x7f800000u) == 0x7f800000u) && + !(bitCast(f) & 0x7fffffu); } namespace priv @@ -1117,8 +1161,8 @@ inline unsigned int UnsignedCeilDivide(unsigned int value, unsigned int divisor) #if defined(_MSC_VER) -#define ANGLE_ROTL(x,y) _rotl(x,y) -#define ANGLE_ROTR16(x,y) _rotr16(x,y) +#define ANGLE_ROTL(x, y) _rotl(x, y) +#define ANGLE_ROTR16(x, y) _rotr16(x, y) #else @@ -1135,8 +1179,7 @@ inline uint16_t RotR16(uint16_t x, int8_t r) #define ANGLE_ROTL(x, y) ::rx::RotL(x, y) #define ANGLE_ROTR16(x, y) ::rx::RotR16(x, y) -#endif // namespace rx - +#endif // namespace rx } -#endif // COMMON_MATHUTIL_H_ +#endif // COMMON_MATHUTIL_H_ diff --git a/gfx/angle/checkout/src/common/matrix_utils.h b/gfx/angle/checkout/src/common/matrix_utils.h index 992e5ad9159e..33b838f961bd 100644 --- a/gfx/angle/checkout/src/common/matrix_utils.h +++ b/gfx/angle/checkout/src/common/matrix_utils.h @@ -94,6 +94,28 @@ class Matrix memcpy(mElements.data(), res.data(), numElts * sizeof(float)); } + bool operator==(const Matrix &m) const + { + ASSERT(columns() == m.columns()); + ASSERT(rows() == m.rows()); + return mElements == m.elements(); + } + + bool operator!=(const Matrix &m) const { return !(mElements == m.elements()); } + + bool nearlyEqual(T epsilon, const Matrix &m) const + { + ASSERT(columns() == m.columns()); + ASSERT(rows() == m.rows()); + const auto &otherElts = m.elements(); + for (size_t i = 0; i < otherElts.size(); i++) + { + if ((mElements[i] - otherElts[i] > epsilon) && (otherElts[i] - mElements[i] > epsilon)) + return false; + } + return true; + } + unsigned int size() const { ASSERT(rows() == columns()); diff --git a/gfx/angle/checkout/src/common/utilities.cpp b/gfx/angle/checkout/src/common/utilities.cpp index d9c1193356cf..644e46b3f0c9 100644 --- a/gfx/angle/checkout/src/common/utilities.cpp +++ b/gfx/angle/checkout/src/common/utilities.cpp @@ -437,50 +437,6 @@ bool IsOpaqueType(GLenum type) return IsImageType(type) || IsSamplerType(type) || IsAtomicCounterType(type); } -GLenum SamplerTypeToTextureType(GLenum samplerType) -{ - switch (samplerType) - { - case GL_SAMPLER_2D: - case GL_INT_SAMPLER_2D: - case GL_UNSIGNED_INT_SAMPLER_2D: - case GL_SAMPLER_2D_SHADOW: - return GL_TEXTURE_2D; - - case GL_SAMPLER_EXTERNAL_OES: - return GL_TEXTURE_EXTERNAL_OES; - - case GL_SAMPLER_CUBE: - case GL_INT_SAMPLER_CUBE: - case GL_UNSIGNED_INT_SAMPLER_CUBE: - case GL_SAMPLER_CUBE_SHADOW: - return GL_TEXTURE_CUBE_MAP; - - case GL_SAMPLER_2D_ARRAY: - case GL_INT_SAMPLER_2D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: - case GL_SAMPLER_2D_ARRAY_SHADOW: - return GL_TEXTURE_2D_ARRAY; - - case GL_SAMPLER_3D: - case GL_INT_SAMPLER_3D: - case GL_UNSIGNED_INT_SAMPLER_3D: - return GL_TEXTURE_3D; - - case GL_SAMPLER_2D_MULTISAMPLE: - case GL_INT_SAMPLER_2D_MULTISAMPLE: - case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: - return GL_TEXTURE_2D_MULTISAMPLE; - - case GL_SAMPLER_2D_RECT_ANGLE: - return GL_TEXTURE_RECTANGLE_ANGLE; - - default: - UNREACHABLE(); - return 0; - } -} - bool IsMatrixType(GLenum type) { return VariableRowCount(type) > 1; @@ -545,29 +501,6 @@ int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsig return -1; } -static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_X - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 1, "Unexpected GL cube map enum value."); -static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 2, "Unexpected GL cube map enum value."); -static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 3, "Unexpected GL cube map enum value."); -static_assert(GL_TEXTURE_CUBE_MAP_POSITIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 4, "Unexpected GL cube map enum value."); -static_assert(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z - GL_TEXTURE_CUBE_MAP_POSITIVE_X == 5, "Unexpected GL cube map enum value."); - -bool IsCubeMapTextureTarget(GLenum target) -{ - return (target >= FirstCubeMapTextureTarget && target <= LastCubeMapTextureTarget); -} - -size_t CubeMapTextureTargetToLayerIndex(GLenum target) -{ - ASSERT(IsCubeMapTextureTarget(target)); - return target - static_cast(FirstCubeMapTextureTarget); -} - -GLenum LayerIndexToCubeMapTextureTarget(size_t index) -{ - ASSERT(index <= (LastCubeMapTextureTarget - FirstCubeMapTextureTarget)); - return FirstCubeMapTextureTarget + static_cast(index); -} - IndexRange ComputeIndexRange(GLenum indexType, const GLvoid *indices, size_t count, @@ -996,52 +929,6 @@ const char *GetGenericErrorMessage(EGLint error) namespace egl_gl { -GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget) -{ - ASSERT(egl::IsCubeMapTextureTarget(eglTarget)); - return gl::LayerIndexToCubeMapTextureTarget(egl::CubeMapTextureTargetToLayerIndex(eglTarget)); -} - -GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget) -{ - switch (eglTarget) - { - case EGL_GL_TEXTURE_2D_KHR: - return GL_TEXTURE_2D; - - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: - case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: - case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: - return EGLCubeMapTargetToGLCubeMapTarget(eglTarget); - - case EGL_GL_TEXTURE_3D_KHR: - return GL_TEXTURE_3D; - - default: - UNREACHABLE(); - return GL_NONE; - } -} - -GLenum EGLTextureTargetToGLTextureTarget(EGLenum eglTarget) -{ - switch (eglTarget) - { - case EGL_TEXTURE_2D: - return GL_TEXTURE_2D; - - case EGL_TEXTURE_RECTANGLE_ANGLE: - return GL_TEXTURE_RECTANGLE_ANGLE; - - default: - UNREACHABLE(); - return GL_NONE; - } -} - GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer) { return static_cast(reinterpret_cast(buffer)); diff --git a/gfx/angle/checkout/src/common/utilities.h b/gfx/angle/checkout/src/common/utilities.h index c3714e115993..8fc2848dd440 100644 --- a/gfx/angle/checkout/src/common/utilities.h +++ b/gfx/angle/checkout/src/common/utilities.h @@ -38,7 +38,6 @@ bool IsSamplerType(GLenum type); bool IsImageType(GLenum type); bool IsAtomicCounterType(GLenum type); bool IsOpaqueType(GLenum type); -GLenum SamplerTypeToTextureType(GLenum samplerType); bool IsMatrixType(GLenum type); GLenum TransposeMatrixType(GLenum type); int VariableRegisterCount(GLenum type); @@ -49,12 +48,6 @@ GLenum VariableBoolVectorType(GLenum type); int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize); -static const GLenum FirstCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X; -static const GLenum LastCubeMapTextureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; -bool IsCubeMapTextureTarget(GLenum target); -size_t CubeMapTextureTargetToLayerIndex(GLenum target); -GLenum LayerIndexToCubeMapTextureTarget(size_t index); - // Parse the base resource name and array indices. Returns the base name of the resource. // If the provided name doesn't index an array, the outSubscripts vector will be empty. // If the provided name indexes an array, the outSubscripts vector will contain indices with @@ -161,9 +154,6 @@ const char *GetGenericErrorMessage(EGLint error); namespace egl_gl { -GLenum EGLCubeMapTargetToGLCubeMapTarget(EGLenum eglTarget); -GLenum EGLImageTargetToGLTextureTarget(EGLenum eglTarget); -GLenum EGLTextureTargetToGLTextureTarget(EGLenum eglTarget); GLuint EGLClientBufferToGLObjectHandle(EGLClientBuffer buffer); } diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp index 8eacea8fe28c..2760a5623873 100644 --- a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp +++ b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.cpp @@ -937,6 +937,7 @@ typedef pp::SourceLocation YYLTYPE; yyextra->lineStart = true; \ } while(0); +#define YY_NO_INPUT #define YY_USER_ACTION \ do \ { \ diff --git a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.l b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.l index 558013873e8e..239538416fb5 100644 --- a/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.l +++ b/gfx/angle/checkout/src/compiler/preprocessor/Tokenizer.l @@ -64,6 +64,7 @@ typedef pp::SourceLocation YYLTYPE; yyextra->lineStart = true; \ } while(0); +#define YY_NO_INPUT #define YY_USER_ACTION \ do \ { \ diff --git a/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h b/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h index 6ea779ab8f6b..3be926d4e418 100644 --- a/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h +++ b/gfx/angle/checkout/src/compiler/preprocessor/numeric_lex.h @@ -48,23 +48,10 @@ bool numeric_lex_int(const std::string &str, IntType *value) template bool numeric_lex_float(const std::string &str, FloatType *value) { -// On 64-bit Intel Android, istringstream is broken. Until this is fixed in -// a newer NDK, don't use it. Android doesn't have locale support, so this -// doesn't have to force the C locale. -// TODO(thakis): Remove this once this bug has been fixed in the NDK and -// that NDK has been rolled into chromium. -#if defined(ANGLE_PLATFORM_ANDROID) && __x86_64__ - *value = strtod(str.c_str(), nullptr); - return errno != ERANGE; -#else - std::istringstream stream(str); - // Force "C" locale so that decimal character is always '.', and - // not dependent on the current locale. - stream.imbue(std::locale::classic()); - - stream >> (*value); - return !stream.fail() && std::isfinite(*value); -#endif + // Some platforms have issues with the usage of std::locale and std::stringstream and cause + // crashes. Usage of strtod appears to be safe. + *value = static_cast(strtod(str.c_str(), nullptr)); + return errno != ERANGE && std::isfinite(*value); } } // namespace pp. diff --git a/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp index 232a95823909..ecf61a95774a 100644 --- a/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ASTMetadataHLSL.cpp @@ -9,8 +9,8 @@ #include "compiler/translator/ASTMetadataHLSL.h" #include "compiler/translator/CallDAG.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/BaseTypes.h b/gfx/angle/checkout/src/compiler/translator/BaseTypes.h index e8a6fd8eab9e..a67c54ec14ed 100644 --- a/gfx/angle/checkout/src/compiler/translator/BaseTypes.h +++ b/gfx/angle/checkout/src/compiler/translator/BaseTypes.h @@ -57,18 +57,12 @@ enum TBasicType EbtInt, EbtUInt, EbtBool, - EbtGVec4, // non type: represents vec4, ivec4, and uvec4 - EbtGenType, // non type: represents float, vec2, vec3, and vec4 - EbtGenIType, // non type: represents int, ivec2, ivec3, and ivec4 - EbtGenUType, // non type: represents uint, uvec2, uvec3, and uvec4 - EbtGenBType, // non type: represents bool, bvec2, bvec3, and bvec4 - EbtVec, // non type: represents vec2, vec3, and vec4 - EbtIVec, // non type: represents ivec2, ivec3, and ivec4 - EbtUVec, // non type: represents uvec2, uvec3, and uvec4 - EbtBVec, // non type: represents bvec2, bvec3, and bvec4 + + EbtAtomicCounter, EbtYuvCscStandardEXT, // Only valid if EXT_YUV_target exists. + EbtGuardSamplerBegin, // non type: see implementation of IsSampler() - EbtSampler2D, + EbtSampler2D = EbtGuardSamplerBegin, EbtSampler3D, EbtSamplerCube, EbtSampler2DArray, @@ -89,17 +83,11 @@ enum TBasicType EbtSampler2DShadow, EbtSamplerCubeShadow, EbtSampler2DArrayShadow, - EbtGuardSamplerEnd, // non type: see implementation of IsSampler() - EbtGSampler2D, // non type: represents sampler2D, isampler2D, and usampler2D - EbtGSampler3D, // non type: represents sampler3D, isampler3D, and usampler3D - EbtGSamplerCube, // non type: represents samplerCube, isamplerCube, and usamplerCube - EbtGSampler2DArray, // non type: represents sampler2DArray, isampler2DArray, and - // usampler2DArray - EbtGSampler2DMS, // non type: represents sampler2DMS, isampler2DMS, and usampler2DMS + EbtGuardSamplerEnd = EbtSampler2DArrayShadow, // non type: see implementation of IsSampler() // images EbtGuardImageBegin, - EbtImage2D, + EbtImage2D = EbtGuardImageBegin, EbtIImage2D, EbtUImage2D, EbtImage3D, @@ -111,131 +99,41 @@ enum TBasicType EbtImageCube, EbtIImageCube, EbtUImageCube, - EbtGuardImageEnd, + EbtGuardImageEnd = EbtUImageCube, - EbtGuardGImageBegin, - EbtGImage2D, // non type: represents image2D, uimage2D, iimage2D - EbtGImage3D, // non type: represents image3D, uimage3D, iimage3D - EbtGImage2DArray, // non type: represents image2DArray, uimage2DArray, iimage2DArray - EbtGImageCube, // non type: represents imageCube, uimageCube, iimageCube - EbtGuardGImageEnd, + EbtLastSimpleType = EbtGuardImageEnd, EbtStruct, EbtInterfaceBlock, - EbtAddress, // should be deprecated?? - - EbtAtomicCounter, // end of list - EbtLast + EbtLast = EbtInterfaceBlock }; -constexpr const char *GetBasicMangledName(TBasicType t) +constexpr char GetBasicMangledName(TBasicType t) { - switch (t) + if (t > EbtLastSimpleType) { - case EbtFloat: - return "f"; - case EbtInt: - return "i"; - case EbtUInt: - return "u"; - case EbtBool: - return "b"; - case EbtYuvCscStandardEXT: - return "ycs"; - case EbtSampler2D: - return "s2"; - case EbtSampler3D: - return "s3"; - case EbtSamplerCube: - return "sC"; - case EbtSampler2DArray: - return "s2a"; - case EbtSamplerExternalOES: - return "sext"; - case EbtSamplerExternal2DY2YEXT: - return "sext2y2y"; - case EbtSampler2DRect: - return "s2r"; - case EbtSampler2DMS: - return "s2ms"; - case EbtISampler2D: - return "is2"; - case EbtISampler3D: - return "is3"; - case EbtISamplerCube: - return "isC"; - case EbtISampler2DArray: - return "is2a"; - case EbtISampler2DMS: - return "is2ms"; - case EbtUSampler2D: - return "us2"; - case EbtUSampler3D: - return "us3"; - case EbtUSamplerCube: - return "usC"; - case EbtUSampler2DArray: - return "us2a"; - case EbtUSampler2DMS: - return "us2ms"; - case EbtSampler2DShadow: - return "s2s"; - case EbtSamplerCubeShadow: - return "sCs"; - case EbtSampler2DArrayShadow: - return "s2as"; - case EbtImage2D: - return "im2"; - case EbtIImage2D: - return "iim2"; - case EbtUImage2D: - return "uim2"; - case EbtImage3D: - return "im3"; - case EbtIImage3D: - return "iim3"; - case EbtUImage3D: - return "uim3"; - case EbtImage2DArray: - return "im2a"; - case EbtIImage2DArray: - return "iim2a"; - case EbtUImage2DArray: - return "uim2a"; - case EbtImageCube: - return "imc"; - case EbtIImageCube: - return "iimc"; - case EbtUImageCube: - return "uimc"; - case EbtAtomicCounter: - return "ac"; - case EbtStruct: - case EbtInterfaceBlock: - return nullptr; - default: - // EbtVoid, EbtAddress and non types - return ""; + return '{'; } + static_assert(EbtLastSimpleType < 52, "We only use alphabetic characters for mangled names"); + if (t < 26) + { + return static_cast('A' + t); + } + return static_cast('a' - 26 + t); } const char *getBasicString(TBasicType t); inline bool IsSampler(TBasicType type) { - return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd; + return type >= EbtGuardSamplerBegin && type <= EbtGuardSamplerEnd; } inline bool IsImage(TBasicType type) { - return type > EbtGuardImageBegin && type < EbtGuardImageEnd; -} - -inline bool IsGImage(TBasicType type) -{ - return type > EbtGuardGImageBegin && type < EbtGuardGImageEnd; + return type >= EbtGuardImageBegin && type <= EbtGuardImageEnd; } inline bool IsAtomicCounter(TBasicType type) diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp index 5e772eb07434..539d1976666a 100644 --- a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp +++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp @@ -6,9 +6,9 @@ #include "compiler/translator/BuiltInFunctionEmulator.h" #include "angle_gl.h" -#include "compiler/translator/IntermTraverse.h" -#include "compiler/translator/SymbolTable.h" #include "compiler/translator/StaticType.h" +#include "compiler/translator/Symbol.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -23,10 +23,9 @@ class BuiltInFunctionEmulator::BuiltInFunctionEmulationMarker : public TIntermTr bool visitUnary(Visit visit, TIntermUnary *node) override { - if (visit == PreVisit) + if (node->getFunction()) { - bool needToEmulate = - mEmulator.setFunctionCalled(node->getOp(), node->getOperand()->getType()); + bool needToEmulate = mEmulator.setFunctionCalled(node->getFunction()); if (needToEmulate) node->setUseEmulatedFunction(); } @@ -35,56 +34,15 @@ class BuiltInFunctionEmulator::BuiltInFunctionEmulationMarker : public TIntermTr bool visitAggregate(Visit visit, TIntermAggregate *node) override { - if (visit == PreVisit) + // Here we handle all the built-in functions mapped to ops, not just the ones that are + // currently identified as problematic. + if (node->isConstructor() || node->isFunctionCall()) { - // Here we handle all the built-in functions mapped to ops, not just the ones that are - // currently identified as problematic. - if (node->isConstructor() || node->isFunctionCall()) - { - return true; - } - const TIntermSequence &sequence = *(node->getSequence()); - bool needToEmulate = false; - // Right now we only handle built-in functions with two to four parameters. - if (sequence.size() == 2) - { - TIntermTyped *param1 = sequence[0]->getAsTyped(); - TIntermTyped *param2 = sequence[1]->getAsTyped(); - if (!param1 || !param2) - return true; - needToEmulate = mEmulator.setFunctionCalled(node->getOp(), param1->getType(), - param2->getType()); - } - else if (sequence.size() == 3) - { - TIntermTyped *param1 = sequence[0]->getAsTyped(); - TIntermTyped *param2 = sequence[1]->getAsTyped(); - TIntermTyped *param3 = sequence[2]->getAsTyped(); - if (!param1 || !param2 || !param3) - return true; - needToEmulate = mEmulator.setFunctionCalled(node->getOp(), param1->getType(), - param2->getType(), param3->getType()); - } - else if (sequence.size() == 4) - { - TIntermTyped *param1 = sequence[0]->getAsTyped(); - TIntermTyped *param2 = sequence[1]->getAsTyped(); - TIntermTyped *param3 = sequence[2]->getAsTyped(); - TIntermTyped *param4 = sequence[3]->getAsTyped(); - if (!param1 || !param2 || !param3 || !param4) - return true; - needToEmulate = - mEmulator.setFunctionCalled(node->getOp(), param1->getType(), param2->getType(), - param3->getType(), param4->getType()); - } - else - { - return true; - } - - if (needToEmulate) - node->setUseEmulatedFunction(); + return true; } + bool needToEmulate = mEmulator.setFunctionCalled(node->getFunction()); + if (needToEmulate) + node->setUseEmulatedFunction(); return true; } @@ -96,74 +54,19 @@ BuiltInFunctionEmulator::BuiltInFunctionEmulator() { } -FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op, - const TType *param, - const char *emulatedFunctionDefinition) +void BuiltInFunctionEmulator::addEmulatedFunction(const TSymbolUniqueId &uniqueId, + const char *emulatedFunctionDefinition) { - FunctionId id(op, param); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - return id; + mEmulatedFunctions[uniqueId.get()] = std::string(emulatedFunctionDefinition); } -FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const char *emulatedFunctionDefinition) -{ - FunctionId id(op, param1, param2); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - return id; -} - -FunctionId BuiltInFunctionEmulator::addEmulatedFunctionWithDependency( - const FunctionId &dependency, - TOperator op, - const TType *param1, - const TType *param2, +void BuiltInFunctionEmulator::addEmulatedFunctionWithDependency( + const TSymbolUniqueId &dependency, + const TSymbolUniqueId &uniqueId, const char *emulatedFunctionDefinition) { - FunctionId id(op, param1, param2); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - mFunctionDependencies[id] = dependency; - return id; -} - -FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const char *emulatedFunctionDefinition) -{ - FunctionId id(op, param1, param2, param3); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - return id; -} - -FunctionId BuiltInFunctionEmulator::addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4, - const char *emulatedFunctionDefinition) -{ - FunctionId id(op, param1, param2, param3, param4); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - return id; -} - -FunctionId BuiltInFunctionEmulator::addEmulatedFunctionWithDependency( - const FunctionId &dependency, - TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4, - const char *emulatedFunctionDefinition) -{ - FunctionId id(op, param1, param2, param3, param4); - mEmulatedFunctions[id] = std::string(emulatedFunctionDefinition); - mFunctionDependencies[id] = dependency; - return id; + mEmulatedFunctions[uniqueId.get()] = std::string(emulatedFunctionDefinition); + mFunctionDependencies[uniqueId.get()] = dependency.get(); } bool BuiltInFunctionEmulator::isOutputEmpty() const @@ -182,47 +85,18 @@ void BuiltInFunctionEmulator::outputEmulatedFunctions(TInfoSinkBase &out) const } } -bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op, const TType ¶m) -{ - return setFunctionCalled(FunctionId(op, ¶m)); -} - -bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op, - const TType ¶m1, - const TType ¶m2) -{ - return setFunctionCalled(FunctionId(op, ¶m1, ¶m2)); -} - -bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op, - const TType ¶m1, - const TType ¶m2, - const TType ¶m3) -{ - return setFunctionCalled(FunctionId(op, ¶m1, ¶m2, ¶m3)); -} - -bool BuiltInFunctionEmulator::setFunctionCalled(TOperator op, - const TType ¶m1, - const TType ¶m2, - const TType ¶m3, - const TType ¶m4) -{ - return setFunctionCalled(FunctionId(op, ¶m1, ¶m2, ¶m3, ¶m4)); -} - -const char *BuiltInFunctionEmulator::findEmulatedFunction(const FunctionId &functionId) const +const char *BuiltInFunctionEmulator::findEmulatedFunction(int uniqueId) const { for (const auto &queryFunction : mQueryFunctions) { - const char *result = queryFunction(functionId); + const char *result = queryFunction(uniqueId); if (result) { return result; } } - const auto &result = mEmulatedFunctions.find(functionId); + const auto &result = mEmulatedFunctions.find(uniqueId); if (result != mEmulatedFunctions.end()) { return result->second.c_str(); @@ -231,27 +105,31 @@ const char *BuiltInFunctionEmulator::findEmulatedFunction(const FunctionId &func return nullptr; } -bool BuiltInFunctionEmulator::setFunctionCalled(const FunctionId &functionId) +bool BuiltInFunctionEmulator::setFunctionCalled(const TFunction *function) { - if (!findEmulatedFunction(functionId)) + ASSERT(function != nullptr); + return setFunctionCalled(function->uniqueId().get()); +} + +bool BuiltInFunctionEmulator::setFunctionCalled(int uniqueId) +{ + if (!findEmulatedFunction(uniqueId)) { return false; } for (size_t i = 0; i < mFunctions.size(); ++i) { - if (mFunctions[i] == functionId) + if (mFunctions[i] == uniqueId) return true; } // If the function depends on another, mark the dependency as called. - auto dependency = mFunctionDependencies.find(functionId); + auto dependency = mFunctionDependencies.find(uniqueId); if (dependency != mFunctionDependencies.end()) { setFunctionCalled((*dependency).second); } - // Copy the functionId if it needs to be stored, to make sure that the TType pointers inside - // remain valid and constant. - mFunctions.push_back(functionId.getCopy()); + mFunctions.push_back(uniqueId); return true; } @@ -284,76 +162,4 @@ void BuiltInFunctionEmulator::WriteEmulatedFunctionName(TInfoSinkBase &out, cons out << name << "_emu"; } -FunctionId::FunctionId() - : mOp(EOpNull), - mParam1(StaticType::GetBasic()), - mParam2(StaticType::GetBasic()), - mParam3(StaticType::GetBasic()), - mParam4(StaticType::GetBasic()) -{ -} - -FunctionId::FunctionId(TOperator op, const TType *param) - : mOp(op), - mParam1(param), - mParam2(StaticType::GetBasic()), - mParam3(StaticType::GetBasic()), - mParam4(StaticType::GetBasic()) -{ -} - -FunctionId::FunctionId(TOperator op, const TType *param1, const TType *param2) - : mOp(op), - mParam1(param1), - mParam2(param2), - mParam3(StaticType::GetBasic()), - mParam4(StaticType::GetBasic()) -{ -} - -FunctionId::FunctionId(TOperator op, const TType *param1, const TType *param2, const TType *param3) - : mOp(op), - mParam1(param1), - mParam2(param2), - mParam3(param3), - mParam4(StaticType::GetBasic()) -{ -} - -FunctionId::FunctionId(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4) - : mOp(op), mParam1(param1), mParam2(param2), mParam3(param3), mParam4(param4) -{ -} - -bool FunctionId::operator==(const FunctionId &other) const -{ - return (mOp == other.mOp && *mParam1 == *other.mParam1 && *mParam2 == *other.mParam2 && - *mParam3 == *other.mParam3 && *mParam4 == *other.mParam4); -} - -bool FunctionId::operator<(const FunctionId &other) const -{ - if (mOp != other.mOp) - return mOp < other.mOp; - if (*mParam1 != *other.mParam1) - return *mParam1 < *other.mParam1; - if (*mParam2 != *other.mParam2) - return *mParam2 < *other.mParam2; - if (*mParam3 != *other.mParam3) - return *mParam3 < *other.mParam3; - if (*mParam4 != *other.mParam4) - return *mParam4 < *other.mParam4; - return false; // all fields are equal -} - -FunctionId FunctionId::getCopy() const -{ - return FunctionId(mOp, new TType(*mParam1), new TType(*mParam2), new TType(*mParam3), - new TType(*mParam4)); -} - } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h index 5f15f6622499..d15e83d75c85 100644 --- a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h +++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulator.h @@ -8,82 +8,15 @@ #define COMPILER_TRANSLATOR_BUILTINFUNCTIONEMULATOR_H_ #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermNode.h" -#include "compiler/translator/ParamType.h" namespace sh { -struct MiniFunctionId -{ - constexpr MiniFunctionId(TOperator op = EOpNull, - ParamType paramType1 = ParamType::Void, - ParamType paramType2 = ParamType::Void, - ParamType paramType3 = ParamType::Void, - ParamType paramType4 = ParamType::Void) - : op(op), - paramType1(paramType1), - paramType2(paramType2), - paramType3(paramType3), - paramType4(paramType4) - { - } +class TIntermNode; +class TFunction; +class TSymbolUniqueId; - TOperator op; - ParamType paramType1; - ParamType paramType2; - ParamType paramType3; - ParamType paramType4; -}; - -class FunctionId final -{ - public: - FunctionId(); - FunctionId(TOperator op, const TType *param); - FunctionId(TOperator op, const TType *param1, const TType *param2); - FunctionId(TOperator op, const TType *param1, const TType *param2, const TType *param3); - FunctionId(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4); - - FunctionId(const FunctionId &) = default; - FunctionId &operator=(const FunctionId &) = default; - - bool operator==(const FunctionId &other) const; - bool operator<(const FunctionId &other) const; - - FunctionId getCopy() const; - - private: - friend bool operator==(const MiniFunctionId &miniId, const FunctionId &functionId); - TOperator mOp; - - // The memory that these TType objects use is freed by PoolAllocator. The - // BuiltInFunctionEmulator's lifetime can extend until after the memory pool is freed, but - // that's not an issue since this class never destructs these objects. - const TType *mParam1; - const TType *mParam2; - const TType *mParam3; - const TType *mParam4; -}; - -inline bool operator==(ParamType paramType, const TType *type) -{ - return SameParamType(paramType, type->getBasicType(), type->getNominalSize(), - type->getSecondarySize()); -} - -inline bool operator==(const MiniFunctionId &miniId, const FunctionId &functionId) -{ - return miniId.op == functionId.mOp && miniId.paramType1 == functionId.mParam1 && - miniId.paramType2 == functionId.mParam2 && miniId.paramType3 == functionId.mParam3 && - miniId.paramType4 == functionId.mParam4; -} - -using BuiltinQueryFunc = const char *(const FunctionId &); +using BuiltinQueryFunc = const char *(int); // // This class decides which built-in functions need to be replaced with the emulated ones. It can be @@ -108,37 +41,12 @@ class BuiltInFunctionEmulator void outputEmulatedFunctions(TInfoSinkBase &out) const; // Add functions that need to be emulated. - FunctionId addEmulatedFunction(TOperator op, - const TType *param, - const char *emulatedFunctionDefinition); - FunctionId addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const char *emulatedFunctionDefinition); - FunctionId addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const char *emulatedFunctionDefinition); - FunctionId addEmulatedFunction(TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4, - const char *emulatedFunctionDefinition); + void addEmulatedFunction(const TSymbolUniqueId &uniqueId, + const char *emulatedFunctionDefinition); - FunctionId addEmulatedFunctionWithDependency(const FunctionId &dependency, - TOperator op, - const TType *param1, - const TType *param2, - const char *emulatedFunctionDefinition); - FunctionId addEmulatedFunctionWithDependency(const FunctionId &dependency, - TOperator op, - const TType *param1, - const TType *param2, - const TType *param3, - const TType *param4, - const char *emulatedFunctionDefinition); + void addEmulatedFunctionWithDependency(const TSymbolUniqueId &dependency, + const TSymbolUniqueId &uniqueId, + const char *emulatedFunctionDefinition); void addFunctionMap(BuiltinQueryFunc queryFunc); @@ -148,31 +56,20 @@ class BuiltInFunctionEmulator // Records that a function is called by the shader and might need to be emulated. If the // function is not in mEmulatedFunctions, this becomes a no-op. Returns true if the function // call needs to be replaced with an emulated one. - bool setFunctionCalled(TOperator op, const TType ¶m); - bool setFunctionCalled(TOperator op, const TType ¶m1, const TType ¶m2); - bool setFunctionCalled(TOperator op, - const TType ¶m1, - const TType ¶m2, - const TType ¶m3); - bool setFunctionCalled(TOperator op, - const TType ¶m1, - const TType ¶m2, - const TType ¶m3, - const TType ¶m4); + bool setFunctionCalled(const TFunction *function); + bool setFunctionCalled(int uniqueId); - bool setFunctionCalled(const FunctionId &functionId); + const char *findEmulatedFunction(int uniqueId) const; - const char *findEmulatedFunction(const FunctionId &functionId) const; - - // Map from function id to emulated function definition - std::map mEmulatedFunctions; + // Map from function unique id to emulated function definition + std::map mEmulatedFunctions; // Map from dependent functions to their dependencies. This structure allows each function to // have at most one dependency. - std::map mFunctionDependencies; + std::map mFunctionDependencies; // Called function ids - std::vector mFunctions; + std::vector mFunctions; // Constexpr function tables. std::vector mQueryFunctions; diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp index 3ebecc53c9b0..351fd30a80c4 100644 --- a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp @@ -7,9 +7,8 @@ #include "compiler/translator/BuiltInFunctionEmulatorGLSL.h" #include "angle_gl.h" #include "compiler/translator/BuiltInFunctionEmulator.h" -#include "compiler/translator/SymbolTable.h" -#include "compiler/translator/StaticType.h" #include "compiler/translator/VersionGLSL.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" namespace sh { @@ -19,8 +18,7 @@ void InitBuiltInAbsFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *e { if (shaderType == GL_VERTEX_SHADER) { - const TType *int1 = StaticType::GetBasic(); - emu->addEmulatedFunction(EOpAbs, int1, "int abs_emu(int x) { return x * sign(x); }"); + emu->addEmulatedFunction(BuiltInId::abs_Int1, "int abs_emu(int x) { return x * sign(x); }"); } } @@ -31,17 +29,12 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator if (targetGLSLVersion < GLSL_VERSION_130) return; - const TType *float1 = StaticType::GetBasic(); - const TType *float2 = StaticType::GetBasic(); - const TType *float3 = StaticType::GetBasic(); - const TType *float4 = StaticType::GetBasic(); - // !(x > 0.0 || x < 0.0 || x == 0.0) will be optimized and always equal to false. emu->addEmulatedFunction( - EOpIsnan, float1, + BuiltInId::isnan_Float1, "bool isnan_emu(float x) { return (x > 0.0 || x < 0.0) ? false : x != 0.0; }"); emu->addEmulatedFunction( - EOpIsnan, float2, + BuiltInId::isnan_Float2, "bvec2 isnan_emu(vec2 x)\n" "{\n" " bvec2 isnan;\n" @@ -52,7 +45,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator " return isnan;\n" "}\n"); emu->addEmulatedFunction( - EOpIsnan, float3, + BuiltInId::isnan_Float3, "bvec3 isnan_emu(vec3 x)\n" "{\n" " bvec3 isnan;\n" @@ -63,7 +56,7 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator " return isnan;\n" "}\n"); emu->addEmulatedFunction( - EOpIsnan, float4, + BuiltInId::isnan_Float4, "bvec4 isnan_emu(vec4 x)\n" "{\n" " bvec4 isnan;\n" @@ -77,27 +70,21 @@ void InitBuiltInIsnanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator void InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator *emu) { - const TType *float1 = StaticType::GetBasic(); - auto floatFuncId = emu->addEmulatedFunction( - EOpAtan, float1, float1, - "emu_precision float atan_emu(emu_precision float y, emu_precision " - "float x)\n" - "{\n" - " if (x > 0.0) return atan(y / x);\n" - " else if (x < 0.0 && y >= 0.0) return atan(y / x) + 3.14159265;\n" - " else if (x < 0.0 && y < 0.0) return atan(y / x) - 3.14159265;\n" - " else return 1.57079632 * sign(y);\n" - "}\n"); - static const std::array floatVecs = { - nullptr, - nullptr, - StaticType::GetBasic(), - StaticType::GetBasic(), - StaticType::GetBasic(), + emu->addEmulatedFunction(BuiltInId::atan_Float1_Float1, + "emu_precision float atan_emu(emu_precision float y, emu_precision " + "float x)\n" + "{\n" + " if (x > 0.0) return atan(y / x);\n" + " else if (x < 0.0 && y >= 0.0) return atan(y / x) + 3.14159265;\n" + " else if (x < 0.0 && y < 0.0) return atan(y / x) - 3.14159265;\n" + " else return 1.57079632 * sign(y);\n" + "}\n"); + static const std::array ids = { + BuiltInId::atan_Float1_Float1, BuiltInId::atan_Float2_Float2, BuiltInId::atan_Float3_Float3, + BuiltInId::atan_Float4_Float4, }; for (int dim = 2; dim <= 4; ++dim) { - const TType *floatVec = floatVecs[dim]; std::stringstream ss; ss << "emu_precision vec" << dim << " atan_emu(emu_precision vec" << dim << " y, emu_precision vec" << dim << " x)\n" @@ -114,7 +101,7 @@ void InitBuiltInAtanFunctionEmulatorForGLSLWorkarounds(BuiltInFunctionEmulator * } ss << ");\n" "}\n"; - emu->addEmulatedFunctionWithDependency(floatFuncId, EOpAtan, floatVec, floatVec, + emu->addEmulatedFunctionWithDependency(BuiltInId::atan_Float1_Float1, ids[dim - 1], ss.str().c_str()); } } @@ -127,11 +114,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator // Emulate packUnorm2x16 and unpackUnorm2x16 (GLSL 4.10) if (targetGLSLVersion < GLSL_VERSION_410) { - const TType *float2 = StaticType::GetBasic(); - const TType *uint1 = StaticType::GetBasic(); - // clang-format off - emu->addEmulatedFunction(EOpPackUnorm2x16, float2, + emu->addEmulatedFunction(BuiltInId::packUnorm2x16_Float2, "uint packUnorm2x16_emu(vec2 v)\n" "{\n" " int x = int(round(clamp(v.x, 0.0, 1.0) * 65535.0));\n" @@ -139,7 +123,7 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator " return uint((y << 16) | (x & 0xFFFF));\n" "}\n"); - emu->addEmulatedFunction(EOpUnpackUnorm2x16, uint1, + emu->addEmulatedFunction(BuiltInId::unpackUnorm2x16_UInt1, "vec2 unpackUnorm2x16_emu(uint u)\n" "{\n" " float x = float(u & 0xFFFFu) / 65535.0;\n" @@ -153,11 +137,8 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator // by using floatBitsToInt, floatBitsToUint, intBitsToFloat, and uintBitsToFloat (GLSL 3.30). if (targetGLSLVersion >= GLSL_VERSION_330 && targetGLSLVersion < GLSL_VERSION_420) { - const TType *float2 = StaticType::GetBasic(); - const TType *uint1 = StaticType::GetBasic(); - // clang-format off - emu->addEmulatedFunction(EOpPackSnorm2x16, float2, + emu->addEmulatedFunction(BuiltInId::packSnorm2x16_Float2, "uint packSnorm2x16_emu(vec2 v)\n" "{\n" " #if defined(GL_ARB_shading_language_packing)\n" @@ -168,7 +149,7 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator " return uint((y << 16) | (x & 0xFFFF));\n" " #endif\n" "}\n"); - emu->addEmulatedFunction(EOpUnpackSnorm2x16, uint1, + emu->addEmulatedFunction(BuiltInId::unpackSnorm2x16_UInt1, "#if !defined(GL_ARB_shading_language_packing)\n" " float fromSnorm(uint x)\n" " {\n" @@ -189,7 +170,7 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator "}\n"); // Functions uint f32tof16(float val) and float f16tof32(uint val) are // based on the OpenGL redbook Appendix Session "Floating-Point Formats Used in OpenGL". - emu->addEmulatedFunction(EOpPackHalf2x16, float2, + emu->addEmulatedFunction(BuiltInId::packHalf2x16_Float2, "#if !defined(GL_ARB_shading_language_packing)\n" " uint f32tof16(float val)\n" " {\n" @@ -236,7 +217,7 @@ void InitBuiltInFunctionEmulatorForGLSLMissingFunctions(BuiltInFunctionEmulator " return (y << 16) | x;\n" " #endif\n" "}\n"); - emu->addEmulatedFunction(EOpUnpackHalf2x16, uint1, + emu->addEmulatedFunction(BuiltInId::unpackHalf2x16_UInt1, "#if !defined(GL_ARB_shading_language_packing)\n" " float f16tof32(uint val)\n" " {\n" diff --git a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp index f3a83bffb0c3..b4bca0d36dec 100644 --- a/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp @@ -4,17 +4,17 @@ // found in the LICENSE file. // +#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h" #include "angle_gl.h" #include "compiler/translator/BuiltInFunctionEmulator.h" -#include "compiler/translator/BuiltInFunctionEmulatorHLSL.h" -#include "compiler/translator/SymbolTable.h" #include "compiler/translator/VersionGLSL.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" namespace sh { // Defined in emulated_builtin_functions_hlsl_autogen.cpp. -const char *FindHLSLFunction(const FunctionId &functionID); +const char *FindHLSLFunction(int uniqueId); void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator *emu, int targetGLSLVersion) @@ -22,12 +22,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator if (targetGLSLVersion < GLSL_VERSION_130) return; - TType *float1 = new TType(EbtFloat); - TType *float2 = new TType(EbtFloat, 2); - TType *float3 = new TType(EbtFloat, 3); - TType *float4 = new TType(EbtFloat, 4); - - emu->addEmulatedFunction(EOpIsnan, float1, + emu->addEmulatedFunction(BuiltInId::isnan_Float1, "bool isnan_emu(float x)\n" "{\n" " return (x > 0.0 || x < 0.0) ? false : x != 0.0;\n" @@ -35,7 +30,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator "\n"); emu->addEmulatedFunction( - EOpIsnan, float2, + BuiltInId::isnan_Float2, "bool2 isnan_emu(float2 x)\n" "{\n" " bool2 isnan;\n" @@ -47,7 +42,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator "}\n"); emu->addEmulatedFunction( - EOpIsnan, float3, + BuiltInId::isnan_Float3, "bool3 isnan_emu(float3 x)\n" "{\n" " bool3 isnan;\n" @@ -59,7 +54,7 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator "}\n"); emu->addEmulatedFunction( - EOpIsnan, float4, + BuiltInId::isnan_Float4, "bool4 isnan_emu(float4 x)\n" "{\n" " bool4 isnan;\n" @@ -73,43 +68,35 @@ void InitBuiltInIsnanFunctionEmulatorForHLSLWorkarounds(BuiltInFunctionEmulator void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu) { - TType *int1 = new TType(EbtInt); - TType *int2 = new TType(EbtInt, 2); - TType *int3 = new TType(EbtInt, 3); - TType *int4 = new TType(EbtInt, 4); - TType *uint1 = new TType(EbtUInt); - TType *uint2 = new TType(EbtUInt, 2); - TType *uint3 = new TType(EbtUInt, 3); - TType *uint4 = new TType(EbtUInt, 4); - emu->addFunctionMap(FindHLSLFunction); // (a + b2^16) * (c + d2^16) = ac + (ad + bc) * 2^16 + bd * 2^32 // Also note that below, a * d + ((a * c) >> 16) is guaranteed not to overflow, because: // a <= 0xffff, d <= 0xffff, ((a * c) >> 16) <= 0xffff and 0xffff * 0xffff + 0xffff = 0xffff0000 - FunctionId umulExtendedUint1 = emu->addEmulatedFunction( - EOpUmulExtended, uint1, uint1, uint1, uint1, - "void umulExtended_emu(uint x, uint y, out uint msb, out uint lsb)\n" - "{\n" - " lsb = x * y;\n" - " uint a = (x & 0xffffu);\n" - " uint b = (x >> 16);\n" - " uint c = (y & 0xffffu);\n" - " uint d = (y >> 16);\n" - " uint ad = a * d + ((a * c) >> 16);\n" - " uint bc = b * c;\n" - " uint carry = uint(ad > (0xffffffffu - bc));\n" - " msb = ((ad + bc) >> 16) + (carry << 16) + b * d;\n" - "}\n"); + emu->addEmulatedFunction(BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + "void umulExtended_emu(uint x, uint y, out uint msb, out uint lsb)\n" + "{\n" + " lsb = x * y;\n" + " uint a = (x & 0xffffu);\n" + " uint b = (x >> 16);\n" + " uint c = (y & 0xffffu);\n" + " uint d = (y >> 16);\n" + " uint ad = a * d + ((a * c) >> 16);\n" + " uint bc = b * c;\n" + " uint carry = uint(ad > (0xffffffffu - bc));\n" + " msb = ((ad + bc) >> 16) + (carry << 16) + b * d;\n" + "}\n"); emu->addEmulatedFunctionWithDependency( - umulExtendedUint1, EOpUmulExtended, uint2, uint2, uint2, uint2, + BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2, "void umulExtended_emu(uint2 x, uint2 y, out uint2 msb, out uint2 lsb)\n" "{\n" " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" " umulExtended_emu(x.y, y.y, msb.y, lsb.y);\n" "}\n"); emu->addEmulatedFunctionWithDependency( - umulExtendedUint1, EOpUmulExtended, uint3, uint3, uint3, uint3, + BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3, "void umulExtended_emu(uint3 x, uint3 y, out uint3 msb, out uint3 lsb)\n" "{\n" " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" @@ -117,7 +104,8 @@ void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu) " umulExtended_emu(x.z, y.z, msb.z, lsb.z);\n" "}\n"); emu->addEmulatedFunctionWithDependency( - umulExtendedUint1, EOpUmulExtended, uint4, uint4, uint4, uint4, + BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4, "void umulExtended_emu(uint4 x, uint4 y, out uint4 msb, out uint4 lsb)\n" "{\n" " umulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" @@ -130,8 +118,9 @@ void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu) // result needs to be negative. // TODO(oetuaho): Note that this code doesn't take one edge case into account, where x or y is // -2^31. abs(-2^31) is undefined. - FunctionId imulExtendedInt1 = emu->addEmulatedFunctionWithDependency( - umulExtendedUint1, EOpImulExtended, int1, int1, int1, int1, + emu->addEmulatedFunctionWithDependency( + BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + BuiltInId::imulExtended_Int1_Int1_Int1_Int1, "void imulExtended_emu(int x, int y, out int msb, out int lsb)\n" "{\n" " uint unsignedMsb;\n" @@ -156,14 +145,14 @@ void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu) " }\n" "}\n"); emu->addEmulatedFunctionWithDependency( - imulExtendedInt1, EOpImulExtended, int2, int2, int2, int2, + BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int2_Int2_Int2_Int2, "void imulExtended_emu(int2 x, int2 y, out int2 msb, out int2 lsb)\n" "{\n" " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" " imulExtended_emu(x.y, y.y, msb.y, lsb.y);\n" "}\n"); emu->addEmulatedFunctionWithDependency( - imulExtendedInt1, EOpImulExtended, int3, int3, int3, int3, + BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int3_Int3_Int3_Int3, "void imulExtended_emu(int3 x, int3 y, out int3 msb, out int3 lsb)\n" "{\n" " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" @@ -171,7 +160,7 @@ void InitBuiltInFunctionEmulatorForHLSL(BuiltInFunctionEmulator *emu) " imulExtended_emu(x.z, y.z, msb.z, lsb.z);\n" "}\n"); emu->addEmulatedFunctionWithDependency( - imulExtendedInt1, EOpImulExtended, int4, int4, int4, int4, + BuiltInId::imulExtended_Int1_Int1_Int1_Int1, BuiltInId::imulExtended_Int4_Int4_Int4_Int4, "void imulExtended_emu(int4 x, int4 y, out int4 msb, out int4 lsb)\n" "{\n" " imulExtended_emu(x.x, y.x, msb.x, lsb.x);\n" diff --git a/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp b/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp index a931ed181130..4e8ed44b6b29 100644 --- a/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp +++ b/gfx/angle/checkout/src/compiler/translator/CallDAG.cpp @@ -11,8 +11,8 @@ #include "compiler/translator/CallDAG.h" #include "compiler/translator/Diagnostics.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -116,16 +116,13 @@ class CallDAG::CallDAGCreator : public TIntermTraverser return false; } - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override + void visitFunctionPrototype(TIntermFunctionPrototype *node) override { ASSERT(mCurrentFunction == nullptr); // Function declaration, create an empty record. auto &record = mFunctions[node->getFunction()->uniqueId().get()]; record.name = node->getFunction()->name(); - - // No need to traverse the parameters. - return false; } // Track functions called from another function. diff --git a/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp b/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp index 12388e64a740..635f3642a4fe 100644 --- a/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp +++ b/gfx/angle/checkout/src/compiler/translator/CollectVariables.cpp @@ -10,8 +10,8 @@ #include "angle_gl.h" #include "common/utilities.h" #include "compiler/translator/HashNames.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include "compiler/translator/util.h" namespace sh @@ -68,21 +68,22 @@ VarT *FindVariable(const ImmutableString &name, std::vector *infoList) return nullptr; } -// Note that this shouldn't be called for interface blocks - static use information is collected for +// Note that this shouldn't be called for interface blocks - active information is collected for // individual fields in case of interface blocks. -void MarkStaticallyUsed(ShaderVariable *variable) +void MarkActive(ShaderVariable *variable) { - if (!variable->staticUse) + if (!variable->active) { if (variable->isStruct()) { // Conservatively assume all fields are statically used as well. for (auto &field : variable->fields) { - MarkStaticallyUsed(&field); + MarkActive(&field); } } - variable->staticUse = true; + ASSERT(variable->staticUse); + variable->active = true; } } @@ -96,6 +97,7 @@ ShaderVariable *FindVariableInInterfaceBlock(const ImmutableString &name, // Set static use on the parent interface block here namedBlock->staticUse = true; + namedBlock->active = true; return FindVariable(name, &namedBlock->fields); } @@ -114,10 +116,10 @@ class CollectVariablesTraverser : public TIntermTraverser std::vector *inBlocks, ShHashFunction64 hashFunction, TSymbolTable *symbolTable, - int shaderVersion, GLenum shaderType, const TExtensionBehavior &extensionBehavior); + bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override; void visitSymbol(TIntermSymbol *symbol) override; bool visitDeclaration(Visit, TIntermDeclaration *node) override; bool visitBinary(Visit visit, TIntermBinary *binaryNode) override; @@ -125,9 +127,12 @@ class CollectVariablesTraverser : public TIntermTraverser private: std::string getMappedName(const TSymbol *symbol) const; - void setFieldOrVariableProperties(const TType &type, ShaderVariable *variableOut) const; + void setFieldOrVariableProperties(const TType &type, + bool staticUse, + ShaderVariable *variableOut) const; void setFieldProperties(const TType &type, const ImmutableString &name, + bool staticUse, ShaderVariable *variableOut) const; void setCommonVariableProperties(const TType &type, const TVariable &variable, @@ -141,13 +146,13 @@ class CollectVariablesTraverser : public TIntermTraverser InterfaceBlock *interfaceBlock) const; Uniform recordUniform(const TIntermSymbol &variable) const; - void setBuiltInInfoFromSymbolTable(const ImmutableString &name, ShaderVariable *info); + void setBuiltInInfoFromSymbol(const TVariable &variable, ShaderVariable *info); - void recordBuiltInVaryingUsed(const ImmutableString &name, + void recordBuiltInVaryingUsed(const TVariable &variable, bool *addedFlag, std::vector *varyings); - void recordBuiltInFragmentOutputUsed(const ImmutableString &name, bool *addedFlag); - void recordBuiltInAttributeUsed(const ImmutableString &name, bool *addedFlag); + void recordBuiltInFragmentOutputUsed(const TVariable &variable, bool *addedFlag); + void recordBuiltInAttributeUsed(const TVariable &variable, bool *addedFlag); InterfaceBlock *recordGLInUsed(const TType &glInType); InterfaceBlock *findNamedInterfaceBlock(const ImmutableString &name) const; @@ -196,7 +201,6 @@ class CollectVariablesTraverser : public TIntermTraverser ShHashFunction64 mHashFunction; - int mShaderVersion; GLenum mShaderType; const TExtensionBehavior &mExtensionBehavior; }; @@ -212,7 +216,6 @@ CollectVariablesTraverser::CollectVariablesTraverser( std::vector *inBlocks, ShHashFunction64 hashFunction, TSymbolTable *symbolTable, - int shaderVersion, GLenum shaderType, const TExtensionBehavior &extensionBehavior) : TIntermTraverser(true, false, false, symbolTable), @@ -245,7 +248,6 @@ CollectVariablesTraverser::CollectVariablesTraverser( mPrimitiveIDAdded(false), mLayerAdded(false), mHashFunction(hashFunction), - mShaderVersion(shaderVersion), mShaderType(shaderType), mExtensionBehavior(extensionBehavior) { @@ -256,16 +258,13 @@ std::string CollectVariablesTraverser::getMappedName(const TSymbol *symbol) cons return HashName(symbol, mHashFunction, nullptr).data(); } -void CollectVariablesTraverser::setBuiltInInfoFromSymbolTable(const ImmutableString &name, - ShaderVariable *info) +void CollectVariablesTraverser::setBuiltInInfoFromSymbol(const TVariable &variable, + ShaderVariable *info) { - const TVariable *symbolTableVar = - reinterpret_cast(mSymbolTable->findBuiltIn(name, mShaderVersion)); - ASSERT(symbolTableVar); - const TType &type = symbolTableVar->getType(); + const TType &type = variable.getType(); - info->name = name.data(); - info->mappedName = name.data(); + info->name = variable.name().data(); + info->mappedName = variable.name().data(); info->type = GLVariableType(type); info->precision = GLVariablePrecision(type); if (auto *arraySizes = type.getArraySizes()) @@ -274,7 +273,7 @@ void CollectVariablesTraverser::setBuiltInInfoFromSymbolTable(const ImmutableStr } } -void CollectVariablesTraverser::recordBuiltInVaryingUsed(const ImmutableString &name, +void CollectVariablesTraverser::recordBuiltInVaryingUsed(const TVariable &variable, bool *addedFlag, std::vector *varyings) { @@ -282,35 +281,38 @@ void CollectVariablesTraverser::recordBuiltInVaryingUsed(const ImmutableString & if (!(*addedFlag)) { Varying info; - setBuiltInInfoFromSymbolTable(name, &info); + setBuiltInInfoFromSymbol(variable, &info); info.staticUse = true; - info.isInvariant = mSymbolTable->isVaryingInvariant(name); + info.active = true; + info.isInvariant = mSymbolTable->isVaryingInvariant(variable.name()); varyings->push_back(info); (*addedFlag) = true; } } -void CollectVariablesTraverser::recordBuiltInFragmentOutputUsed(const ImmutableString &name, +void CollectVariablesTraverser::recordBuiltInFragmentOutputUsed(const TVariable &variable, bool *addedFlag) { if (!(*addedFlag)) { OutputVariable info; - setBuiltInInfoFromSymbolTable(name, &info); + setBuiltInInfoFromSymbol(variable, &info); info.staticUse = true; + info.active = true; mOutputVariables->push_back(info); (*addedFlag) = true; } } -void CollectVariablesTraverser::recordBuiltInAttributeUsed(const ImmutableString &name, +void CollectVariablesTraverser::recordBuiltInAttributeUsed(const TVariable &variable, bool *addedFlag) { if (!(*addedFlag)) { Attribute info; - setBuiltInInfoFromSymbolTable(name, &info); + setBuiltInInfoFromSymbol(variable, &info); info.staticUse = true; + info.active = true; info.location = -1; mAttribs->push_back(info); (*addedFlag) = true; @@ -324,7 +326,6 @@ InterfaceBlock *CollectVariablesTraverser::recordGLInUsed(const TType &glInType) ASSERT(glInType.getQualifier() == EvqPerVertexIn); InterfaceBlock info; recordInterfaceBlock("gl_in", glInType, &info); - info.staticUse = true; mPerVertexInAdded = true; mInBlocks->push_back(info); @@ -336,11 +337,17 @@ InterfaceBlock *CollectVariablesTraverser::recordGLInUsed(const TType &glInType) } } -// We want to check whether a uniform/varying is statically used -// because we only count the used ones in packing computing. -// Also, gl_FragCoord, gl_PointCoord, and gl_FrontFacing count -// toward varying counting if they are statically used in a fragment -// shader. +bool CollectVariablesTraverser::visitInvariantDeclaration(Visit visit, + TIntermInvariantDeclaration *node) +{ + // We should not mark variables as active just based on an invariant declaration, so we don't + // traverse the symbols declared invariant. + return false; +} + +// We want to check whether a uniform/varying is active because we need to skip updating inactive +// ones. We also only count the active ones in packing computing. Also, gl_FragCoord, gl_PointCoord, +// and gl_FrontFacing count toward varying counting if they are active in a fragment shader. void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) { ASSERT(symbol != nullptr); @@ -385,6 +392,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) info.type = GL_NONE; info.precision = GL_NONE; info.staticUse = true; + info.active = true; ShaderVariable nearInfo(GL_FLOAT); const char kNearName[] = "near"; @@ -392,6 +400,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) nearInfo.mappedName = kNearName; nearInfo.precision = GL_HIGH_FLOAT; nearInfo.staticUse = true; + nearInfo.active = true; ShaderVariable farInfo(GL_FLOAT); const char kFarName[] = "far"; @@ -399,6 +408,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) farInfo.mappedName = kFarName; farInfo.precision = GL_HIGH_FLOAT; farInfo.staticUse = true; + farInfo.active = true; ShaderVariable diffInfo(GL_FLOAT); const char kDiffName[] = "diff"; @@ -406,6 +416,7 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) diffInfo.mappedName = kDiffName; diffInfo.precision = GL_HIGH_FLOAT; diffInfo.staticUse = true; + diffInfo.active = true; info.fields.push_back(nearInfo); info.fields.push_back(farInfo); @@ -450,116 +461,91 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) } break; case EvqFragCoord: - recordBuiltInVaryingUsed(ImmutableString("gl_FragCoord"), &mFragCoordAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mFragCoordAdded, mInputVaryings); return; case EvqFrontFacing: - recordBuiltInVaryingUsed(ImmutableString("gl_FrontFacing"), &mFrontFacingAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mFrontFacingAdded, mInputVaryings); return; case EvqPointCoord: - recordBuiltInVaryingUsed(ImmutableString("gl_PointCoord"), &mPointCoordAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mPointCoordAdded, mInputVaryings); return; case EvqInstanceID: // Whenever the SH_INITIALIZE_BUILTINS_FOR_INSTANCED_MULTIVIEW option is set, // gl_InstanceID is added inside expressions to initialize ViewID_OVR and - // InstanceID. gl_InstanceID is not added to the symbol table for ESSL1 shaders - // which makes it necessary to populate the type information explicitly instead of - // extracting it from the symbol table. - if (!mInstanceIDAdded) - { - Attribute info; - const char kName[] = "gl_InstanceID"; - info.name = kName; - info.mappedName = kName; - info.type = GL_INT; - info.precision = GL_HIGH_INT; // Defined by spec. - info.staticUse = true; - info.location = -1; - mAttribs->push_back(info); - mInstanceIDAdded = true; - } + // InstanceID. Note that gl_InstanceID is not added to the symbol table for ESSL1 + // shaders. + recordBuiltInAttributeUsed(symbol->variable(), &mInstanceIDAdded); return; case EvqVertexID: - recordBuiltInAttributeUsed(ImmutableString("gl_VertexID"), &mVertexIDAdded); + recordBuiltInAttributeUsed(symbol->variable(), &mVertexIDAdded); return; case EvqPosition: - recordBuiltInVaryingUsed(ImmutableString("gl_Position"), &mPositionAdded, - mOutputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mPositionAdded, mOutputVaryings); return; case EvqPointSize: - recordBuiltInVaryingUsed(ImmutableString("gl_PointSize"), &mPointSizeAdded, - mOutputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mPointSizeAdded, mOutputVaryings); return; case EvqLastFragData: - recordBuiltInVaryingUsed(ImmutableString("gl_LastFragData"), &mLastFragDataAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mLastFragDataAdded, mInputVaryings); return; case EvqFragColor: - recordBuiltInFragmentOutputUsed(ImmutableString("gl_FragColor"), &mFragColorAdded); + recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragColorAdded); return; case EvqFragData: if (!mFragDataAdded) { OutputVariable info; - setBuiltInInfoFromSymbolTable(ImmutableString("gl_FragData"), &info); + setBuiltInInfoFromSymbol(symbol->variable(), &info); if (!IsExtensionEnabled(mExtensionBehavior, TExtension::EXT_draw_buffers)) { ASSERT(info.arraySizes.size() == 1u); info.arraySizes.back() = 1u; } info.staticUse = true; + info.active = true; mOutputVariables->push_back(info); mFragDataAdded = true; } return; case EvqFragDepthEXT: - recordBuiltInFragmentOutputUsed(ImmutableString("gl_FragDepthEXT"), - &mFragDepthEXTAdded); + recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragDepthEXTAdded); return; case EvqFragDepth: - recordBuiltInFragmentOutputUsed(ImmutableString("gl_FragDepth"), &mFragDepthAdded); + recordBuiltInFragmentOutputUsed(symbol->variable(), &mFragDepthAdded); return; case EvqSecondaryFragColorEXT: - recordBuiltInFragmentOutputUsed(ImmutableString("gl_SecondaryFragColorEXT"), - &mSecondaryFragColorEXTAdded); + recordBuiltInFragmentOutputUsed(symbol->variable(), &mSecondaryFragColorEXTAdded); return; case EvqSecondaryFragDataEXT: - recordBuiltInFragmentOutputUsed(ImmutableString("gl_SecondaryFragDataEXT"), - &mSecondaryFragDataEXTAdded); + recordBuiltInFragmentOutputUsed(symbol->variable(), &mSecondaryFragDataEXTAdded); return; case EvqInvocationID: - recordBuiltInVaryingUsed(ImmutableString("gl_InvocationID"), &mInvocationIDAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mInvocationIDAdded, mInputVaryings); break; case EvqPrimitiveIDIn: - recordBuiltInVaryingUsed(ImmutableString("gl_PrimitiveIDIn"), &mPrimitiveIDInAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDInAdded, mInputVaryings); break; case EvqPrimitiveID: if (mShaderType == GL_GEOMETRY_SHADER_EXT) { - recordBuiltInVaryingUsed(ImmutableString("gl_PrimitiveID"), &mPrimitiveIDAdded, + recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDAdded, mOutputVaryings); } else { ASSERT(mShaderType == GL_FRAGMENT_SHADER); - recordBuiltInVaryingUsed(ImmutableString("gl_PrimitiveID"), &mPrimitiveIDAdded, + recordBuiltInVaryingUsed(symbol->variable(), &mPrimitiveIDAdded, mInputVaryings); } break; case EvqLayer: if (mShaderType == GL_GEOMETRY_SHADER_EXT) { - recordBuiltInVaryingUsed(ImmutableString("gl_Layer"), &mLayerAdded, - mOutputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mLayerAdded, mOutputVaryings); } else if (mShaderType == GL_FRAGMENT_SHADER) { - recordBuiltInVaryingUsed(ImmutableString("gl_Layer"), &mLayerAdded, - mInputVaryings); + recordBuiltInVaryingUsed(symbol->variable(), &mLayerAdded, mInputVaryings); } else { @@ -573,15 +559,18 @@ void CollectVariablesTraverser::visitSymbol(TIntermSymbol *symbol) } if (var) { - MarkStaticallyUsed(var); + MarkActive(var); } } void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type, + bool staticUse, ShaderVariable *variableOut) const { ASSERT(variableOut); + variableOut->staticUse = staticUse; + const TStructure *structure = type.getStruct(); if (!structure) { @@ -604,7 +593,7 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type, // Regardless of the variable type (uniform, in/out etc.) its fields are always plain // ShaderVariable objects. ShaderVariable fieldVariable; - setFieldProperties(*field->type(), field->name(), &fieldVariable); + setFieldProperties(*field->type(), field->name(), staticUse, &fieldVariable); variableOut->fields.push_back(fieldVariable); } } @@ -616,10 +605,11 @@ void CollectVariablesTraverser::setFieldOrVariableProperties(const TType &type, void CollectVariablesTraverser::setFieldProperties(const TType &type, const ImmutableString &name, + bool staticUse, ShaderVariable *variableOut) const { ASSERT(variableOut); - setFieldOrVariableProperties(type, variableOut); + setFieldOrVariableProperties(type, staticUse, variableOut); variableOut->name.assign(name.data(), name.length()); variableOut->mappedName = HashName(name, mHashFunction, nullptr).data(); } @@ -630,7 +620,8 @@ void CollectVariablesTraverser::setCommonVariableProperties(const TType &type, { ASSERT(variableOut); - setFieldOrVariableProperties(type, variableOut); + variableOut->staticUse = mSymbolTable->isStaticallyUsed(variable); + setFieldOrVariableProperties(type, variableOut->staticUse, variableOut); ASSERT(variable.symbolType() != SymbolType::Empty); variableOut->name.assign(variable.name().data(), variable.name().length()); variableOut->mappedName = getMappedName(&variable); @@ -706,6 +697,18 @@ void CollectVariablesTraverser::recordInterfaceBlock(const char *instanceName, if (instanceName != nullptr) { interfaceBlock->instanceName = instanceName; + const TSymbol *blockSymbol = nullptr; + if (strncmp(instanceName, "gl_in", 5u) == 0) + { + blockSymbol = mSymbolTable->getGlInVariableWithArraySize(); + } + else + { + blockSymbol = mSymbolTable->findGlobal(ImmutableString(instanceName)); + } + ASSERT(blockSymbol && blockSymbol->isVariable()); + interfaceBlock->staticUse = + mSymbolTable->isStaticallyUsed(*static_cast(blockSymbol)); } ASSERT(!interfaceBlockType.isArrayOfArrays()); // Disallowed by GLSL ES 3.10 section 4.3.9 interfaceBlock->arraySize = interfaceBlockType.isArray() ? interfaceBlockType.getOutermostArraySize() : 0; @@ -721,16 +724,36 @@ void CollectVariablesTraverser::recordInterfaceBlock(const char *instanceName, } // Gather field information + bool anyFieldStaticallyUsed = false; for (const TField *field : blockType->fields()) { const TType &fieldType = *field->type(); + bool staticUse = false; + if (instanceName == nullptr) + { + // Static use of individual fields has been recorded, since they are present in the + // symbol table as variables. + const TSymbol *fieldSymbol = mSymbolTable->findGlobal(field->name()); + ASSERT(fieldSymbol && fieldSymbol->isVariable()); + staticUse = + mSymbolTable->isStaticallyUsed(*static_cast(fieldSymbol)); + if (staticUse) + { + anyFieldStaticallyUsed = true; + } + } + InterfaceBlockField fieldVariable; - setFieldProperties(fieldType, field->name(), &fieldVariable); + setFieldProperties(fieldType, field->name(), staticUse, &fieldVariable); fieldVariable.isRowMajorLayout = (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor); interfaceBlock->fields.push_back(fieldVariable); } + if (anyFieldStaticallyUsed) + { + interfaceBlock->staticUse = true; + } } Uniform CollectVariablesTraverser::recordUniform(const TIntermSymbol &variable) const @@ -848,7 +871,7 @@ bool CollectVariablesTraverser::visitBinary(Visit, TIntermBinary *binaryNode) { if (binaryNode->getOp() == EOpIndexDirectInterfaceBlock) { - // NOTE: we do not determine static use for individual blocks of an array + // NOTE: we do not determine static use / activeness for individual blocks of an array. TIntermTyped *blockNode = binaryNode->getLeft()->getAsTyped(); ASSERT(blockNode); @@ -882,10 +905,15 @@ bool CollectVariablesTraverser::visitBinary(Visit, TIntermBinary *binaryNode) namedBlock = findNamedInterfaceBlock(interfaceBlock->name()); } ASSERT(namedBlock); - namedBlock->staticUse = true; + ASSERT(namedBlock->staticUse); + namedBlock->active = true; unsigned int fieldIndex = static_cast(constantUnion->getIConst(0)); ASSERT(fieldIndex < namedBlock->fields.size()); + // TODO(oetuaho): Would be nicer to record static use of fields of named interface blocks + // more accurately at parse time - now we only mark the fields statically used if they are + // active. http://anglebug.com/2440 namedBlock->fields[fieldIndex].staticUse = true; + namedBlock->fields[fieldIndex].active = true; if (traverseIndexExpression) { @@ -911,14 +939,12 @@ void CollectVariables(TIntermBlock *root, std::vector *inBlocks, ShHashFunction64 hashFunction, TSymbolTable *symbolTable, - int shaderVersion, GLenum shaderType, const TExtensionBehavior &extensionBehavior) { CollectVariablesTraverser collect(attributes, outputVariables, uniforms, inputVaryings, outputVaryings, uniformBlocks, shaderStorageBlocks, inBlocks, - hashFunction, symbolTable, shaderVersion, shaderType, - extensionBehavior); + hashFunction, symbolTable, shaderType, extensionBehavior); root->traverse(&collect); } diff --git a/gfx/angle/checkout/src/compiler/translator/CollectVariables.h b/gfx/angle/checkout/src/compiler/translator/CollectVariables.h index 4d0d1192e0d9..66ac764c3b92 100644 --- a/gfx/angle/checkout/src/compiler/translator/CollectVariables.h +++ b/gfx/angle/checkout/src/compiler/translator/CollectVariables.h @@ -29,7 +29,6 @@ void CollectVariables(TIntermBlock *root, std::vector *inBlocks, ShHashFunction64 hashFunction, TSymbolTable *symbolTable, - int shaderVersion, GLenum shaderType, const TExtensionBehavior &extensionBehavior); } diff --git a/gfx/angle/checkout/src/compiler/translator/Compiler.cpp b/gfx/angle/checkout/src/compiler/translator/Compiler.cpp index 7c685d51da64..0025b5c17fa6 100644 --- a/gfx/angle/checkout/src/compiler/translator/Compiler.cpp +++ b/gfx/angle/checkout/src/compiler/translator/Compiler.cpp @@ -10,43 +10,43 @@ #include "angle_gl.h" #include "common/utilities.h" -#include "compiler/translator/AddAndTrueToLoopCondition.h" #include "compiler/translator/CallDAG.h" -#include "compiler/translator/ClampFragDepth.h" -#include "compiler/translator/ClampPointSize.h" #include "compiler/translator/CollectVariables.h" -#include "compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h" -#include "compiler/translator/DeferGlobalInitializers.h" -#include "compiler/translator/EmulateGLFragColorBroadcast.h" -#include "compiler/translator/EmulatePrecision.h" -#include "compiler/translator/FoldExpressions.h" #include "compiler/translator/Initialize.h" -#include "compiler/translator/InitializeVariables.h" -#include "compiler/translator/IntermNodePatternMatcher.h" #include "compiler/translator/IsASTDepthBelowLimit.h" #include "compiler/translator/OutputTree.h" #include "compiler/translator/ParseContext.h" -#include "compiler/translator/PruneNoOps.h" -#include "compiler/translator/RegenerateStructNames.h" -#include "compiler/translator/RemoveArrayLengthMethod.h" -#include "compiler/translator/RemoveEmptySwitchStatements.h" -#include "compiler/translator/RemoveInvariantDeclaration.h" -#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h" -#include "compiler/translator/RemovePow.h" -#include "compiler/translator/RemoveUnreferencedVariables.h" -#include "compiler/translator/RewriteDoWhile.h" -#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h" -#include "compiler/translator/SeparateDeclarations.h" -#include "compiler/translator/SimplifyLoopConditions.h" -#include "compiler/translator/SplitSequenceOperator.h" -#include "compiler/translator/UnfoldShortCircuitAST.h" -#include "compiler/translator/UseInterfaceBlockFields.h" #include "compiler/translator/ValidateLimitations.h" #include "compiler/translator/ValidateMaxParameters.h" #include "compiler/translator/ValidateOutputs.h" #include "compiler/translator/ValidateVaryingLocations.h" #include "compiler/translator/VariablePacker.h" -#include "compiler/translator/VectorizeVectorScalarArithmetic.h" +#include "compiler/translator/tree_ops/AddAndTrueToLoopCondition.h" +#include "compiler/translator/tree_ops/ClampFragDepth.h" +#include "compiler/translator/tree_ops/ClampPointSize.h" +#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h" +#include "compiler/translator/tree_ops/DeferGlobalInitializers.h" +#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h" +#include "compiler/translator/tree_ops/EmulatePrecision.h" +#include "compiler/translator/tree_ops/FoldExpressions.h" +#include "compiler/translator/tree_ops/InitializeVariables.h" +#include "compiler/translator/tree_ops/PruneEmptyCases.h" +#include "compiler/translator/tree_ops/PruneNoOps.h" +#include "compiler/translator/tree_ops/RegenerateStructNames.h" +#include "compiler/translator/tree_ops/RemoveArrayLengthMethod.h" +#include "compiler/translator/tree_ops/RemoveInvariantDeclaration.h" +#include "compiler/translator/tree_ops/RemovePow.h" +#include "compiler/translator/tree_ops/RemoveUnreferencedVariables.h" +#include "compiler/translator/tree_ops/RewriteDoWhile.h" +#include "compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h" +#include "compiler/translator/tree_ops/SeparateDeclarations.h" +#include "compiler/translator/tree_ops/SimplifyLoopConditions.h" +#include "compiler/translator/tree_ops/SplitSequenceOperator.h" +#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h" +#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h" +#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" #include "compiler/translator/util.h" #include "third_party/compiler/ArrayBoundsClamper.h" @@ -193,12 +193,12 @@ class TScopedSymbolTableLevel public: TScopedSymbolTableLevel(TSymbolTable *table) : mTable(table) { - ASSERT(mTable->atBuiltInLevel()); + ASSERT(mTable->isEmpty()); mTable->push(); } ~TScopedSymbolTableLevel() { - while (!mTable->atBuiltInLevel()) + while (!mTable->isEmpty()) mTable->pop(); } @@ -225,6 +225,51 @@ int MapSpecToShaderVersion(ShShaderSpec spec) } } +bool ValidateFragColorAndFragData(GLenum shaderType, + int shaderVersion, + const TSymbolTable &symbolTable, + TDiagnostics *diagnostics) +{ + if (shaderVersion > 100 || shaderType != GL_FRAGMENT_SHADER) + { + return true; + } + + bool usesFragColor = false; + bool usesFragData = false; + // This validation is a bit stricter than the spec - it's only an error to write to + // both FragData and FragColor. But because it's better not to have reads from undefined + // variables, we always return an error if they are both referenced, rather than only if they + // are written. + if (symbolTable.isStaticallyUsed(*BuiltInVariable::gl_FragColor()) || + symbolTable.isStaticallyUsed(*BuiltInVariable::gl_SecondaryFragColorEXT())) + { + usesFragColor = true; + } + // Extension variables may not always be initialized (saves some time at symbol table init). + bool secondaryFragDataUsed = + symbolTable.gl_SecondaryFragDataEXT() != nullptr && + symbolTable.isStaticallyUsed(*symbolTable.gl_SecondaryFragDataEXT()); + if (symbolTable.isStaticallyUsed(*symbolTable.gl_FragData()) || secondaryFragDataUsed) + { + usesFragData = true; + } + if (usesFragColor && usesFragData) + { + const char *errorMessage = "cannot use both gl_FragData and gl_FragColor"; + if (symbolTable.isStaticallyUsed(*BuiltInVariable::gl_SecondaryFragColorEXT()) || + secondaryFragDataUsed) + { + errorMessage = + "cannot use both output variable sets (gl_FragData, gl_SecondaryFragDataEXT)" + " and (gl_FragColor, gl_SecondaryFragColorEXT)"; + } + diagnostics->globalError(errorMessage); + return false; + } + return true; +} + } // namespace TShHandleBase::TShHandleBase() @@ -451,6 +496,11 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, return false; } + if (!ValidateFragColorAndFragData(shaderType, shaderVersion, symbolTable, &mDiagnostics)) + { + return false; + } + // Fold expressions that could not be folded before validation that was done as a part of // parsing. FoldExpressions(root, &mDiagnostics); @@ -466,16 +516,6 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, // After this empty declarations are not allowed in the AST. PruneNoOps(root, &symbolTable); - // In case the last case inside a switch statement is a certain type of no-op, GLSL - // compilers in drivers may not accept it. In this case we clean up the dead code from the - // end of switch statements. This is also required because PruneNoOps may have left switch - // statements that only contained an empty declaration inside the final case in an invalid - // state. Relies on that PruneNoOps has already been run. - RemoveNoOpCasesFromEndOfSwitchStatements(root, &symbolTable); - - // Remove empty switch statements - this makes output simpler. - RemoveEmptySwitchStatements(root); - // Create the function DAG and check there is no recursion if (!initCallDag(root)) { @@ -548,7 +588,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, if (compileOptions & SH_REMOVE_POW_WITH_CONSTANT_EXPONENT) { - RemovePow(root); + RemovePow(root, &symbolTable); } if (compileOptions & SH_REGENERATE_STRUCT_NAMES) @@ -588,6 +628,14 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, RemoveUnreferencedVariables(root, &symbolTable); + // In case the last case inside a switch statement is a certain type of no-op, GLSL compilers in + // drivers may not accept it. In this case we clean up the dead code from the end of switch + // statements. This is also required because PruneNoOps or RemoveUnreferencedVariables may have + // left switch statements that only contained an empty declaration inside the final case in an + // invalid state. Relies on that PruneNoOps and RemoveUnreferencedVariables have already been + // run. + PruneEmptyCases(root); + // Built-in function emulation needs to happen after validateLimitations pass. // TODO(jmadill): Remove global pool allocator. GetGlobalPoolAllocator()->lock(); @@ -605,7 +653,7 @@ bool TCompiler::checkAndSimplifyAST(TIntermBlock *root, ASSERT(!variablesCollected); CollectVariables(root, &attributes, &outputVariables, &uniforms, &inputVaryings, &outputVaryings, &uniformBlocks, &shaderStorageBlocks, &inBlocks, - hashFunction, &symbolTable, shaderVersion, shaderType, extensionBehavior); + hashFunction, &symbolTable, shaderType, extensionBehavior); collectInterfaceBlocks(); variablesCollected = true; if (compileOptions & SH_USE_UNUSED_STANDARD_SHARED_BLOCKS) diff --git a/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h index a1b9cb2225d7..9d752c4eaf9f 100644 --- a/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h +++ b/gfx/angle/checkout/src/compiler/translator/ExtensionGLSL.h @@ -12,7 +12,7 @@ #include #include -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp index 886de30966ac..368854f0682f 100644 --- a/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp +++ b/gfx/angle/checkout/src/compiler/translator/FlagStd140Structs.cpp @@ -8,8 +8,8 @@ #include "compiler/translator/FlagStd140Structs.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp b/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp index 8f26dc8720eb..b8e503ef15e1 100644 --- a/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ImmutableString.cpp @@ -35,17 +35,35 @@ template <> const size_t ImmutableString::FowlerNollVoHash<8>::kFnvOffsetBasis = static_cast(0xcbf29ce484222325ull); -uint32_t ImmutableString::hash32() const +uint32_t ImmutableString::mangledNameHash() const { - const char *data_ptr = data(); - uint32_t hash = static_cast(FowlerNollVoHash<4>::kFnvOffsetBasis); - while ((*data_ptr) != '\0') + const char *dataPtr = data(); + uint32_t hash = static_cast(FowlerNollVoHash<4>::kFnvOffsetBasis); + const uint32_t kMaxSixBitValue = (1u << 6) - 1u; + uint32_t parenLocation = kMaxSixBitValue; + uint32_t hasArrayOrBlockParamBit = 0u; + uint32_t index = 0; + while (dataPtr[index] != '\0') { - hash = hash ^ (*data_ptr); + hash = hash ^ dataPtr[index]; hash = hash * static_cast(FowlerNollVoHash<4>::kFnvPrime); - ++data_ptr; + if (dataPtr[index] == '(') + { + // We should only reach here once, since this function should not be called with invalid + // mangled names. + ASSERT(parenLocation == kMaxSixBitValue); + parenLocation = index; + } + else if (dataPtr[index] == '{' || dataPtr[index] == '[') + { + hasArrayOrBlockParamBit = 1u; + } + ++index; } - return hash; + // Should not be called with strings longer than 63 characters. + ASSERT(index <= kMaxSixBitValue); + return ((hash >> 13) ^ (hash & 0x1fff)) | (index << 19) | (parenLocation << 25) | + (hasArrayOrBlockParamBit << 31); } } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableString.h b/gfx/angle/checkout/src/compiler/translator/ImmutableString.h index 301e91c8ca70..b583bc9bb2ac 100644 --- a/gfx/angle/checkout/src/compiler/translator/ImmutableString.h +++ b/gfx/angle/checkout/src/compiler/translator/ImmutableString.h @@ -128,7 +128,10 @@ class ImmutableString } }; - uint32_t hash32() const; + // This hash encodes the opening parentheses location (if any), name length and whether the name + // contains { or [ characters in addition to a 19-bit hash. This way the hash is more useful for + // lookups. The string passed in should be at most 63 characters. + uint32_t mangledNameHash() const; private: const char *mData; diff --git a/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h index 5580f207f8a0..09fcc71be800 100644 --- a/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h +++ b/gfx/angle/checkout/src/compiler/translator/ImmutableStringBuilder.h @@ -47,7 +47,7 @@ class ImmutableStringBuilder while (index >= 0) { char digit = static_cast((number >> (index * 4)) & 0xfu); - char digitChar = digit < 10 ? digit + '0' : digit + 'a'; + char digitChar = (digit < 10) ? (digit + '0') : (digit + ('a' - 10)); mData[mPos++] = digitChar; --index; } diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp b/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp index 61d4cf335c1f..3d1b483c9097 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp +++ b/gfx/angle/checkout/src/compiler/translator/IntermNode.cpp @@ -264,7 +264,7 @@ bool TIntermBlock::replaceChildNode(TIntermNode *original, TIntermNode *replacem bool TIntermFunctionPrototype::replaceChildNode(TIntermNode *original, TIntermNode *replacement) { - return replaceChildNodeInternal(original, replacement); + return false; } bool TIntermDeclaration::replaceChildNode(TIntermNode *original, TIntermNode *replacement) @@ -689,12 +689,6 @@ void TIntermBlock::appendStatement(TIntermNode *statement) } } -void TIntermFunctionPrototype::appendParameter(TIntermSymbol *parameter) -{ - ASSERT(parameter != nullptr); - mParameters.push_back(parameter); -} - void TIntermDeclaration::appendDeclarator(TIntermTyped *declarator) { ASSERT(declarator != nullptr); @@ -801,6 +795,7 @@ TIntermSwizzle::TIntermSwizzle(const TIntermSwizzle &node) : TIntermExpression(n ASSERT(operandCopy != nullptr); mOperand = operandCopy; mSwizzleOffsets = node.mSwizzleOffsets; + mHasFoldedDuplicateOffsets = node.mHasFoldedDuplicateOffsets; } TIntermBinary::TIntermBinary(const TIntermBinary &node) @@ -814,7 +809,9 @@ TIntermBinary::TIntermBinary(const TIntermBinary &node) } TIntermUnary::TIntermUnary(const TIntermUnary &node) - : TIntermOperator(node), mUseEmulatedFunction(node.mUseEmulatedFunction) + : TIntermOperator(node), + mUseEmulatedFunction(node.mUseEmulatedFunction), + mFunction(node.mFunction) { TIntermTyped *operandCopy = node.mOperand->deepCopy(); ASSERT(operandCopy != nullptr); @@ -1047,14 +1044,15 @@ void TIntermUnary::promote() TIntermSwizzle::TIntermSwizzle(TIntermTyped *operand, const TVector &swizzleOffsets) : TIntermExpression(TType(EbtFloat, EbpUndefined)), mOperand(operand), - mSwizzleOffsets(swizzleOffsets) + mSwizzleOffsets(swizzleOffsets), + mHasFoldedDuplicateOffsets(false) { ASSERT(mSwizzleOffsets.size() <= 4); promote(); } -TIntermUnary::TIntermUnary(TOperator op, TIntermTyped *operand) - : TIntermOperator(op), mOperand(operand), mUseEmulatedFunction(false) +TIntermUnary::TIntermUnary(TOperator op, TIntermTyped *operand, const TFunction *function) + : TIntermOperator(op), mOperand(operand), mUseEmulatedFunction(false), mFunction(function) { promote(); } @@ -1173,6 +1171,10 @@ void TIntermSwizzle::promote() bool TIntermSwizzle::hasDuplicateOffsets() const { + if (mHasFoldedDuplicateOffsets) + { + return true; + } int offsetCount[4] = {0u, 0u, 0u, 0u}; for (const auto offset : mSwizzleOffsets) { @@ -1185,6 +1187,11 @@ bool TIntermSwizzle::hasDuplicateOffsets() const return false; } +void TIntermSwizzle::setHasFoldedDuplicateOffsets(bool hasFoldedDuplicateOffsets) +{ + mHasFoldedDuplicateOffsets = hasFoldedDuplicateOffsets; +} + bool TIntermSwizzle::offsetsMatch(int offset) const { return mSwizzleOffsets.size() == 1 && mSwizzleOffsets[0] == offset; @@ -1478,6 +1485,24 @@ const TConstantUnion *TIntermConstantUnion::FoldIndexing(const TType &type, TIntermTyped *TIntermSwizzle::fold(TDiagnostics * /* diagnostics */) { + TIntermSwizzle *operandSwizzle = mOperand->getAsSwizzleNode(); + if (operandSwizzle) + { + // We need to fold the two swizzles into one, so that repeated swizzling can't cause stack + // overflow in ParseContext::checkCanBeLValue(). + bool hadDuplicateOffsets = operandSwizzle->hasDuplicateOffsets(); + TVector foldedOffsets; + for (int offset : mSwizzleOffsets) + { + // Offset should already be validated. + ASSERT(static_cast(offset) < operandSwizzle->mSwizzleOffsets.size()); + foldedOffsets.push_back(operandSwizzle->mSwizzleOffsets[offset]); + } + operandSwizzle->mSwizzleOffsets = foldedOffsets; + operandSwizzle->setType(getType()); + operandSwizzle->setHasFoldedDuplicateOffsets(hadDuplicateOffsets); + return operandSwizzle; + } TIntermConstantUnion *operandConstant = mOperand->getAsConstantUnion(); if (operandConstant == nullptr) { diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode.h b/gfx/angle/checkout/src/compiler/translator/IntermNode.h index 63be891ca976..7d5bacb0dc81 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNode.h +++ b/gfx/angle/checkout/src/compiler/translator/IntermNode.h @@ -431,6 +431,7 @@ class TIntermSwizzle : public TIntermExpression void writeOffsetsAsXYZW(TInfoSinkBase *out) const; bool hasDuplicateOffsets() const; + void setHasFoldedDuplicateOffsets(bool hasFoldedDuplicateOffsets); bool offsetsMatch(int offset) const; TIntermTyped *fold(TDiagnostics *diagnostics) override; @@ -438,6 +439,7 @@ class TIntermSwizzle : public TIntermExpression protected: TIntermTyped *mOperand; TVector mSwizzleOffsets; + bool mHasFoldedDuplicateOffsets; private: void promote(); @@ -503,7 +505,7 @@ class TIntermBinary : public TIntermOperator class TIntermUnary : public TIntermOperator { public: - TIntermUnary(TOperator op, TIntermTyped *operand); + TIntermUnary(TOperator op, TIntermTyped *operand, const TFunction *function); TIntermTyped *deepCopy() const override { return new TIntermUnary(*this); } @@ -516,6 +518,8 @@ class TIntermUnary : public TIntermOperator TIntermTyped *getOperand() { return mOperand; } TIntermTyped *fold(TDiagnostics *diagnostics) override; + const TFunction *getFunction() const { return mFunction; } + void setUseEmulatedFunction() { mUseEmulatedFunction = true; } bool getUseEmulatedFunction() { return mUseEmulatedFunction; } @@ -526,6 +530,8 @@ class TIntermUnary : public TIntermOperator // to work around driver bugs. bool mUseEmulatedFunction; + const TFunction *const mFunction; + private: void promote(); @@ -660,7 +666,7 @@ class TIntermBlock : public TIntermNode, public TIntermAggregateBase // Function prototype. May be in the AST either as a function prototype declaration or as a part of // a function definition. The type of the node is the function return type. -class TIntermFunctionPrototype : public TIntermTyped, public TIntermAggregateBase +class TIntermFunctionPrototype : public TIntermTyped { public: TIntermFunctionPrototype(const TFunction *function); @@ -683,17 +689,9 @@ class TIntermFunctionPrototype : public TIntermTyped, public TIntermAggregateBas return true; } - // Only intended for initially building the declaration. - void appendParameter(TIntermSymbol *parameter); - - TIntermSequence *getSequence() override { return &mParameters; } - const TIntermSequence *getSequence() const override { return &mParameters; } - const TFunction *getFunction() const { return mFunction; } protected: - TIntermSequence mParameters; - const TFunction *const mFunction; }; diff --git a/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp index aaad4f3c68f8..73cb9d18331a 100644 --- a/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp +++ b/gfx/angle/checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp @@ -6,7 +6,7 @@ #include "compiler/translator/IsASTDepthBelowLimit.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -18,24 +18,10 @@ namespace class MaxDepthTraverser : public TIntermTraverser { public: - MaxDepthTraverser(int depthLimit) : TIntermTraverser(true, true, false), mDepthLimit(depthLimit) + MaxDepthTraverser(int depthLimit) : TIntermTraverser(true, false, false, nullptr) { + setMaxAllowedDepth(depthLimit); } - - bool visitBinary(Visit, TIntermBinary *) override { return depthCheck(); } - bool visitUnary(Visit, TIntermUnary *) override { return depthCheck(); } - bool visitTernary(Visit, TIntermTernary *) override { return depthCheck(); } - bool visitSwizzle(Visit, TIntermSwizzle *) override { return depthCheck(); } - bool visitIfElse(Visit, TIntermIfElse *) override { return depthCheck(); } - bool visitAggregate(Visit, TIntermAggregate *) override { return depthCheck(); } - bool visitBlock(Visit, TIntermBlock *) override { return depthCheck(); } - bool visitLoop(Visit, TIntermLoop *) override { return depthCheck(); } - bool visitBranch(Visit, TIntermBranch *) override { return depthCheck(); } - - protected: - bool depthCheck() const { return mMaxDepth < mDepthLimit; } - - int mDepthLimit; }; } // anonymous namespace diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp index 9f8bbce0824a..d31156d8306e 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSL.cpp @@ -94,8 +94,8 @@ ImmutableString TOutputGLSL::translateTextureFunction(const ImmutableString &nam nullptr}; static const char *legacyToCoreRename[] = { "texture2D", "texture", "texture2DProj", "textureProj", "texture2DLod", "textureLod", - "texture2DProjLod", "textureProjLod", "texture2DRect", "texture", "textureCube", "texture", - "textureCubeLod", "textureLod", + "texture2DProjLod", "textureProjLod", "texture2DRect", "texture", "texture2DRectProj", + "textureProj", "textureCube", "texture", "textureCubeLod", "textureLod", // Extensions "texture2DLodEXT", "textureLod", "texture2DProjLodEXT", "textureProjLod", "textureCubeLodEXT", "textureLod", "texture2DGradEXT", "textureGrad", diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp index 74b38d24f7ac..553d6c14fa08 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp +++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp @@ -328,24 +328,23 @@ void TOutputGLSLBase::writeVariableType(const TType &type) } } -void TOutputGLSLBase::writeFunctionParameters(const TIntermSequence &args) +void TOutputGLSLBase::writeFunctionParameters(const TFunction *func) { TInfoSinkBase &out = objSink(); - for (TIntermSequence::const_iterator iter = args.begin(); iter != args.end(); ++iter) + size_t paramCount = func->getParamCount(); + for (size_t i = 0; i < paramCount; ++i) { - const TIntermSymbol *arg = (*iter)->getAsSymbolNode(); - ASSERT(arg != nullptr); - - const TType &type = arg->getType(); + const TVariable *param = func->getParam(i); + const TType &type = param->getType(); writeVariableType(type); - if (arg->variable().symbolType() != SymbolType::Empty) - out << " " << hashName(&arg->variable()); + if (param->symbolType() != SymbolType::Empty) + out << " " << hashName(param); if (type.isArray()) out << ArrayString(type); // Put a comma if this is not the last argument. - if (iter != args.end() - 1) + if (i != paramCount - 1) out << ", "; } } @@ -847,7 +846,7 @@ bool TOutputGLSLBase::visitBlock(Visit visit, TIntermBlock *node) { TInfoSinkBase &out = objSink(); // Scope the blocks except when at the global scope. - if (mDepth > 0) + if (getCurrentTraversalDepth() > 0) { out << "{\n"; } @@ -864,7 +863,7 @@ bool TOutputGLSLBase::visitBlock(Visit visit, TIntermBlock *node) } // Scope the blocks except when at the global scope. - if (mDepth > 0) + if (getCurrentTraversalDepth() > 0) { out << "}\n"; } @@ -890,10 +889,9 @@ bool TOutputGLSLBase::visitInvariantDeclaration(Visit visit, TIntermInvariantDec return false; } -bool TOutputGLSLBase::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) +void TOutputGLSLBase::visitFunctionPrototype(TIntermFunctionPrototype *node) { TInfoSinkBase &out = objSink(); - ASSERT(visit == PreVisit); const TType &type = node->getType(); writeVariableType(type); @@ -903,10 +901,8 @@ bool TOutputGLSLBase::visitFunctionPrototype(Visit visit, TIntermFunctionPrototy out << " " << hashFunctionNameIfNeeded(node->getFunction()); out << "("; - writeFunctionParameters(*(node->getSequence())); + writeFunctionParameters(node->getFunction()); out << ")"; - - return false; } bool TOutputGLSLBase::visitAggregate(Visit visit, TIntermAggregate *node) diff --git a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h index f2492e97c31b..6009cbf85818 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h +++ b/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.h @@ -11,7 +11,7 @@ #include "compiler/translator/HashNames.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -44,7 +44,7 @@ class TOutputGLSLBase : public TIntermTraverser void writeInvariantQualifier(const TType &type); void writeVariableType(const TType &type); virtual bool writeVariablePrecision(TPrecision precision) = 0; - void writeFunctionParameters(const TIntermSequence &args); + void writeFunctionParameters(const TFunction *func); const TConstantUnion *writeConstantUnion(const TType &type, const TConstantUnion *pConstUnion); void writeConstructorTriplet(Visit visit, const TType &type); ImmutableString getTypeName(const TType &type); @@ -58,7 +58,7 @@ class TOutputGLSLBase : public TIntermTraverser bool visitIfElse(Visit visit, TIntermIfElse *node) override; bool visitSwitch(Visit visit, TIntermSwitch *node) override; bool visitCase(Visit visit, TIntermCase *node) override; - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override; bool visitAggregate(Visit visit, TIntermAggregate *node) override; bool visitBlock(Visit visit, TIntermBlock *node) override; @@ -76,9 +76,10 @@ class TOutputGLSLBase : public TIntermTraverser // Used to translate function names for differences between ESSL and GLSL virtual ImmutableString translateTextureFunction(const ImmutableString &name) { return name; } + void declareStruct(const TStructure *structure); + private: bool structDeclared(const TStructure *structure) const; - void declareStruct(const TStructure *structure); void declareInterfaceBlockLayout(const TInterfaceBlock *interfaceBlock); void declareInterfaceBlock(const TInterfaceBlock *interfaceBlock); diff --git a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp index 74c0f8d2cdc1..117af802d0e5 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.cpp @@ -15,17 +15,17 @@ #include "common/utilities.h" #include "compiler/translator/BuiltInFunctionEmulator.h" #include "compiler/translator/BuiltInFunctionEmulatorHLSL.h" -#include "compiler/translator/FindSymbolNode.h" #include "compiler/translator/ImageFunctionHLSL.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/NodeSearch.h" -#include "compiler/translator/RemoveSwitchFallThrough.h" #include "compiler/translator/StructureHLSL.h" #include "compiler/translator/TextureFunctionHLSL.h" #include "compiler/translator/TranslatorHLSL.h" #include "compiler/translator/UniformHLSL.h" #include "compiler/translator/UtilsHLSL.h" #include "compiler/translator/blocklayout.h" +#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h" +#include "compiler/translator/tree_util/FindSymbolNode.h" +#include "compiler/translator/tree_util/NodeSearch.h" #include "compiler/translator/util.h" namespace sh @@ -1756,35 +1756,30 @@ bool OutputHLSL::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition out << TypeString(node->getFunctionPrototype()->getType()) << " "; - TIntermSequence *parameters = node->getFunctionPrototype()->getSequence(); + const TFunction *func = node->getFunction(); - if (node->getFunction()->isMain()) + if (func->isMain()) { out << "gl_main("; } else { - out << DecorateFunctionIfNeeded(node->getFunction()) << DisambiguateFunctionName(parameters) + out << DecorateFunctionIfNeeded(func) << DisambiguateFunctionName(func) << (mOutputLod0Function ? "Lod0(" : "("); } - for (unsigned int i = 0; i < parameters->size(); i++) + size_t paramCount = func->getParamCount(); + for (unsigned int i = 0; i < paramCount; i++) { - TIntermSymbol *symbol = (*parameters)[i]->getAsSymbolNode(); + const TVariable *param = func->getParam(i); + ensureStructDefined(param->getType()); - if (symbol) + writeParameter(param, out); + + if (i < paramCount - 1) { - ensureStructDefined(symbol->getType()); - - writeParameter(symbol, out); - - if (i < parameters->size() - 1) - { - out << ", "; - } + out << ", "; } - else - UNREACHABLE(); } out << ")\n"; @@ -1871,32 +1866,29 @@ bool OutputHLSL::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclarat return false; } -bool OutputHLSL::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) +void OutputHLSL::visitFunctionPrototype(TIntermFunctionPrototype *node) { TInfoSinkBase &out = getInfoSink(); - ASSERT(visit == PreVisit); size_t index = mCallDag.findIndex(node->getFunction()->uniqueId()); // Skip the prototype if it is not implemented (and thus not used) if (index == CallDAG::InvalidIndex) { - return false; + return; } - TIntermSequence *arguments = node->getSequence(); + const TFunction *func = node->getFunction(); - TString name = DecorateFunctionIfNeeded(node->getFunction()); - out << TypeString(node->getType()) << " " << name << DisambiguateFunctionName(arguments) + TString name = DecorateFunctionIfNeeded(func); + out << TypeString(node->getType()) << " " << name << DisambiguateFunctionName(func) << (mOutputLod0Function ? "Lod0(" : "("); - for (unsigned int i = 0; i < arguments->size(); i++) + size_t paramCount = func->getParamCount(); + for (unsigned int i = 0; i < paramCount; i++) { - TIntermSymbol *symbol = (*arguments)[i]->getAsSymbolNode(); - ASSERT(symbol != nullptr); + writeParameter(func->getParam(i), out); - writeParameter(symbol, out); - - if (i < arguments->size() - 1) + if (i < paramCount - 1) { out << ", "; } @@ -1912,8 +1904,6 @@ bool OutputHLSL::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *n node->traverse(this); mOutputLod0Function = false; } - - return false; } bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) @@ -2128,6 +2118,24 @@ bool OutputHLSL::visitAggregate(Visit visit, TIntermAggregate *node) ASSERT(node->getUseEmulatedFunction()); writeEmulatedFunctionTriplet(out, visit, node->getOp()); break; + case EOpBarrier: + // barrier() is translated to GroupMemoryBarrierWithGroupSync(), which is the + // cheapest *WithGroupSync() function, without any functionality loss, but + // with the potential for severe performance loss. + outputTriplet(out, visit, "GroupMemoryBarrierWithGroupSync(", "", ")"); + break; + case EOpMemoryBarrierShared: + outputTriplet(out, visit, "GroupMemoryBarrier(", "", ")"); + break; + case EOpMemoryBarrierAtomicCounter: + case EOpMemoryBarrierBuffer: + case EOpMemoryBarrierImage: + outputTriplet(out, visit, "DeviceMemoryBarrier(", "", ")"); + break; + case EOpGroupMemoryBarrier: + case EOpMemoryBarrier: + outputTriplet(out, visit, "AllMemoryBarrier(", "", ")"); + break; default: UNREACHABLE(); } @@ -2642,22 +2650,13 @@ void OutputHLSL::outputLineDirective(TInfoSinkBase &out, int line) } } -void OutputHLSL::writeParameter(const TIntermSymbol *symbol, TInfoSinkBase &out) +void OutputHLSL::writeParameter(const TVariable *param, TInfoSinkBase &out) { - TQualifier qualifier = symbol->getQualifier(); - const TType &type = symbol->getType(); - const TVariable &variable = symbol->variable(); - TString nameStr; + const TType &type = param->getType(); + TQualifier qualifier = type.getQualifier(); - if (variable.symbolType() == - SymbolType::Empty) // HLSL demands named arguments, also for prototypes - { - nameStr = "x" + str(mUniqueIndex++); - } - else - { - nameStr = DecorateVariableIfNeeded(variable); - } + TString nameStr = DecorateVariableIfNeeded(*param); + ASSERT(nameStr != ""); // HLSL demands named arguments, also for prototypes if (IsSampler(type.getBasicType())) { diff --git a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h index c929cd914838..c1d6adb56757 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h +++ b/gfx/angle/checkout/src/compiler/translator/OutputHLSL.h @@ -16,7 +16,7 @@ #include "compiler/translator/Compiler.h" #include "compiler/translator/FlagStd140Structs.h" #include "compiler/translator/ImmutableString.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" class BuiltInFunctionEmulator; @@ -93,7 +93,7 @@ class OutputHLSL : public TIntermTraverser bool visitIfElse(Visit visit, TIntermIfElse *) override; bool visitSwitch(Visit visit, TIntermSwitch *) override; bool visitCase(Visit visit, TIntermCase *) override; - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override; bool visitAggregate(Visit visit, TIntermAggregate *) override; bool visitBlock(Visit visit, TIntermBlock *node) override; @@ -112,7 +112,7 @@ class OutputHLSL : public TIntermTraverser const char *inString, const char *postString); void outputLineDirective(TInfoSinkBase &out, int line); - void writeParameter(const TIntermSymbol *symbol, TInfoSinkBase &out); + void writeParameter(const TVariable *param, TInfoSinkBase &out); void outputConstructor(TInfoSinkBase &out, Visit visit, TIntermAggregate *node); const TConstantUnion *writeConstantUnion(TInfoSinkBase &out, diff --git a/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp b/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp index f0a1fd0bd5a4..adcd24269a98 100644 --- a/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp +++ b/gfx/angle/checkout/src/compiler/translator/OutputTree.cpp @@ -4,8 +4,8 @@ // found in the LICENSE file. // -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -31,7 +31,10 @@ void OutputFunction(TInfoSinkBase &out, const char *str, const TFunction *func) class TOutputTraverser : public TIntermTraverser { public: - TOutputTraverser(TInfoSinkBase &out) : TIntermTraverser(true, false, false), mOut(out) {} + TOutputTraverser(TInfoSinkBase &out) + : TIntermTraverser(true, false, false), mOut(out), mIndentDepth(0) + { + } protected: void visitSymbol(TIntermSymbol *) override; @@ -43,7 +46,7 @@ class TOutputTraverser : public TIntermTraverser bool visitIfElse(Visit visit, TIntermIfElse *node) override; bool visitSwitch(Visit visit, TIntermSwitch *node) override; bool visitCase(Visit visit, TIntermCase *node) override; - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override; bool visitAggregate(Visit visit, TIntermAggregate *) override; bool visitBlock(Visit visit, TIntermBlock *) override; @@ -52,7 +55,10 @@ class TOutputTraverser : public TIntermTraverser bool visitLoop(Visit visit, TIntermLoop *) override; bool visitBranch(Visit visit, TIntermBranch *) override; + int getCurrentIndentDepth() const { return mIndentDepth + getCurrentTraversalDepth(); } + TInfoSinkBase &mOut; + int mIndentDepth; }; // @@ -79,7 +85,7 @@ void OutputTreeText(TInfoSinkBase &out, TIntermNode *node, const int depth) void TOutputTraverser::visitSymbol(TIntermSymbol *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->variable().symbolType() == SymbolType::Empty) { @@ -96,7 +102,7 @@ void TOutputTraverser::visitSymbol(TIntermSymbol *node) bool TOutputTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "vector swizzle ("; node->writeOffsetsAsXYZW(&mOut); mOut << ")"; @@ -108,7 +114,7 @@ bool TOutputTraverser::visitSwizzle(Visit visit, TIntermSwizzle *node) bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); switch (node->getOp()) { @@ -270,7 +276,7 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node) TIntermConstantUnion *intermConstantUnion = node->getRight()->getAsConstantUnion(); ASSERT(intermConstantUnion); - OutputTreeText(mOut, intermConstantUnion, mDepth + 1); + OutputTreeText(mOut, intermConstantUnion, getCurrentIndentDepth() + 1); // The following code finds the field name from the constant union const TConstantUnion *constantUnion = intermConstantUnion->getConstantValue(); @@ -294,7 +300,7 @@ bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary *node) bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); switch (node->getOp()) { @@ -348,32 +354,37 @@ bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary *node) bool TOutputTraverser::visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Function Definition:\n"; - mOut << "\n"; return true; } bool TOutputTraverser::visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Invariant Declaration:\n"; return true; } -bool TOutputTraverser::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) +void TOutputTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); OutputFunction(mOut, "Function Prototype", node->getFunction()); mOut << " (" << node->getCompleteString() << ")"; mOut << "\n"; - - return true; + size_t paramCount = node->getFunction()->getParamCount(); + for (size_t i = 0; i < paramCount; ++i) + { + const TVariable *param = node->getFunction()->getParam(i); + OutputTreeText(mOut, node, getCurrentIndentDepth() + 1); + mOut << "parameter: " << param->name() << " (" << param->getType().getCompleteString() + << ")"; + } } bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getOp() == EOpNull) { @@ -445,7 +456,7 @@ bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate *node) bool TOutputTraverser::visitBlock(Visit visit, TIntermBlock *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Code block\n"; return true; @@ -453,7 +464,7 @@ bool TOutputTraverser::visitBlock(Visit visit, TIntermBlock *node) bool TOutputTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Declaration\n"; return true; @@ -461,18 +472,18 @@ bool TOutputTraverser::visitDeclaration(Visit visit, TIntermDeclaration *node) bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Ternary selection"; mOut << " (" << node->getCompleteString() << ")\n"; - ++mDepth; + ++mIndentDepth; - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Condition\n"; node->getCondition()->traverse(this); - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getTrueExpression()) { mOut << "true case\n"; @@ -480,29 +491,29 @@ bool TOutputTraverser::visitTernary(Visit visit, TIntermTernary *node) } if (node->getFalseExpression()) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "false case\n"; node->getFalseExpression()->traverse(this); } - --mDepth; + --mIndentDepth; return false; } bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "If test\n"; - ++mDepth; + ++mIndentDepth; - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Condition\n"; node->getCondition()->traverse(this); - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getTrueBlock()) { mOut << "true case\n"; @@ -515,19 +526,19 @@ bool TOutputTraverser::visitIfElse(Visit visit, TIntermIfElse *node) if (node->getFalseBlock()) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "false case\n"; node->getFalseBlock()->traverse(this); } - --mDepth; + --mIndentDepth; return false; } bool TOutputTraverser::visitSwitch(Visit visit, TIntermSwitch *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Switch\n"; @@ -536,7 +547,7 @@ bool TOutputTraverser::visitSwitch(Visit visit, TIntermSwitch *node) bool TOutputTraverser::visitCase(Visit visit, TIntermCase *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getCondition() == nullptr) { @@ -556,7 +567,7 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node) for (size_t i = 0; i < size; i++) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); switch (node->getConstantValue()[i].getType()) { case EbtBool: @@ -597,16 +608,16 @@ void TOutputTraverser::visitConstantUnion(TIntermConstantUnion *node) bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Loop with condition "; if (node->getType() == ELoopDoWhile) mOut << "not "; mOut << "tested first\n"; - ++mDepth; + ++mIndentDepth; - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getCondition()) { mOut << "Loop Condition\n"; @@ -617,7 +628,7 @@ bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node) mOut << "No loop condition\n"; } - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); if (node->getBody()) { mOut << "Loop Body\n"; @@ -630,19 +641,19 @@ bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop *node) if (node->getExpression()) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); mOut << "Loop Terminal Expression\n"; node->getExpression()->traverse(this); } - --mDepth; + --mIndentDepth; return false; } bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node) { - OutputTreeText(mOut, node, mDepth); + OutputTreeText(mOut, node, getCurrentIndentDepth()); switch (node->getFlowOp()) { @@ -666,9 +677,9 @@ bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch *node) if (node->getExpression()) { mOut << " with expression\n"; - ++mDepth; + ++mIndentDepth; node->getExpression()->traverse(this); - --mDepth; + --mIndentDepth; } else { diff --git a/gfx/angle/checkout/src/compiler/translator/ParamType.h b/gfx/angle/checkout/src/compiler/translator/ParamType.h deleted file mode 100644 index dddb4e9901f5..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/ParamType.h +++ /dev/null @@ -1,102 +0,0 @@ -// -// Copyright 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// ParamType: -// Helper type for built-in function emulator tables. Defines types for parameters. - -#ifndef COMPILER_TRANSLATOR_PARAMTYPE_H_ -#define COMPILER_TRANSLATOR_PARAMTYPE_H_ - -#include "common/angleutils.h" -#include "compiler/translator/BaseTypes.h" - -namespace sh -{ - -enum class ParamType : uint8_t -{ - Void, - Bool1, - Bool2, - Bool3, - Bool4, - Float1, - Float2, - Float3, - Float4, - Int1, - Int2, - Int3, - Int4, - Mat2, - Mat3, - Mat4, - Uint1, - Uint2, - Uint3, - Uint4, - Last, -}; - -struct ParamTypeInfo -{ - ParamType self; - TBasicType basicType; - int primarySize; - int secondarySize; -}; - -constexpr ParamTypeInfo g_ParamTypeInfo[] = { - {ParamType::Void, EbtVoid, 1, 1}, {ParamType::Bool1, EbtBool, 1, 1}, - {ParamType::Bool2, EbtBool, 2, 1}, {ParamType::Bool3, EbtBool, 3, 1}, - {ParamType::Bool4, EbtBool, 4, 1}, {ParamType::Float1, EbtFloat, 1, 1}, - {ParamType::Float2, EbtFloat, 2, 1}, {ParamType::Float3, EbtFloat, 3, 1}, - {ParamType::Float4, EbtFloat, 4, 1}, {ParamType::Int1, EbtInt, 1, 1}, - {ParamType::Int2, EbtInt, 2, 1}, {ParamType::Int3, EbtInt, 3, 1}, - {ParamType::Int4, EbtInt, 4, 1}, {ParamType::Mat2, EbtFloat, 2, 2}, - {ParamType::Mat3, EbtFloat, 3, 3}, {ParamType::Mat4, EbtFloat, 4, 4}, - {ParamType::Uint1, EbtUInt, 1, 1}, {ParamType::Uint2, EbtUInt, 2, 1}, - {ParamType::Uint3, EbtUInt, 3, 1}, {ParamType::Uint4, EbtUInt, 4, 1}, -}; - -constexpr size_t ParamTypeIndex(ParamType paramType) -{ - return static_cast(paramType); -} - -constexpr size_t NumParamTypes() -{ - return ParamTypeIndex(ParamType::Last); -} - -static_assert(ArraySize(g_ParamTypeInfo) == NumParamTypes(), "Invalid array size"); - -constexpr TBasicType GetBasicType(ParamType paramType) -{ - return g_ParamTypeInfo[ParamTypeIndex(paramType)].basicType; -} - -constexpr int GetPrimarySize(ParamType paramType) -{ - return g_ParamTypeInfo[ParamTypeIndex(paramType)].primarySize; -} - -constexpr int GetSecondarySize(ParamType paramType) -{ - return g_ParamTypeInfo[ParamTypeIndex(paramType)].secondarySize; -} - -constexpr bool SameParamType(ParamType paramType, - TBasicType basicType, - int primarySize, - int secondarySize) -{ - return GetBasicType(paramType) == basicType && primarySize == GetPrimarySize(paramType) && - secondarySize == GetSecondarySize(paramType); -} - -} // namespace sh - -#endif // COMPILER_TRANSLATOR_PARAMTYPE_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp b/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp index ccf6c54c3f39..6cf0eb936579 100644 --- a/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ParseContext.cpp @@ -12,11 +12,12 @@ #include "common/mathutil.h" #include "compiler/preprocessor/SourceLocation.h" #include "compiler/translator/Declarator.h" -#include "compiler/translator/IntermNode_util.h" +#include "compiler/translator/ParseContext_autogen.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/ValidateGlobalInitializer.h" #include "compiler/translator/ValidateSwitch.h" #include "compiler/translator/glslang.h" +#include "compiler/translator/tree_util/IntermNode_util.h" #include "compiler/translator/util.h" namespace sh @@ -33,33 +34,6 @@ namespace const int kWebGLMaxStructNesting = 4; -constexpr const ImmutableString kTexelFetchOffsetName("texelFetchOffsetName"); -constexpr const ImmutableString kTextureLodOffsetName("textureLodOffset"); -constexpr const ImmutableString kTextureProjLodOffsetName("textureProjLodOffset"); -constexpr const ImmutableString kTextureGradOffsetName("textureGradOffset"); -constexpr const ImmutableString kTextureProjGradOffsetName("textureProjGradOffset"); -constexpr const ImmutableString kTextureOffsetName("textureOffset"); -constexpr const ImmutableString kTextureProjOffsetName("textureProjOffset"); -constexpr const ImmutableString kTextureGatherName("textureGather"); -constexpr const ImmutableString kTextureGatherOffsetName("textureGatherOffset"); - -constexpr const std::array kAtomicBuiltin = { - {ImmutableString("atomicAdd"), ImmutableString("atomicMin"), ImmutableString("atomicMax"), - ImmutableString("atomicAnd"), ImmutableString("atomicOr"), ImmutableString("atomicXor"), - ImmutableString("atomicExchange"), ImmutableString("atomicCompSwap")}}; - -bool IsAtomicBuiltin(const ImmutableString &name) -{ - for (size_t i = 0; i < kAtomicBuiltin.size(); ++i) - { - if (name == kAtomicBuiltin[i]) - { - return true; - } - } - return false; -} - bool ContainsSampler(const TStructure *structType); bool ContainsSampler(const TType &type) @@ -222,9 +196,6 @@ TParseContext::TParseContext(TSymbolTable &symt, resources.WEBGL_debug_shader_precision == 1), mPreprocessor(mDiagnostics, &mDirectiveHandler, pp::PreprocessorSettings()), mScanner(nullptr), - mUsesFragData(false), - mUsesFragColor(false), - mUsesSecondaryOutputs(false), mMinProgramTexelOffset(resources.MinProgramTexelOffset), mMaxProgramTexelOffset(resources.MaxProgramTexelOffset), mMinProgramTextureGatherOffset(resources.MinProgramTextureGatherOffset), @@ -245,8 +216,7 @@ TParseContext::TParseContext(TSymbolTable &symt, mGeometryShaderInvocations(0), mGeometryShaderMaxVertices(-1), mMaxGeometryShaderInvocations(resources.MaxGeometryShaderInvocations), - mMaxGeometryShaderMaxVertices(resources.MaxGeometryOutputVertices), - mGlInVariableWithArraySize(nullptr) + mMaxGeometryShaderMaxVertices(resources.MaxGeometryOutputVertices) { } @@ -469,14 +439,41 @@ void TParseContext::checkPrecisionSpecified(const TSourceLoc &line, } } +void TParseContext::markStaticReadIfSymbol(TIntermNode *node) +{ + TIntermSwizzle *swizzleNode = node->getAsSwizzleNode(); + if (swizzleNode) + { + markStaticReadIfSymbol(swizzleNode->getOperand()); + return; + } + TIntermBinary *binaryNode = node->getAsBinaryNode(); + if (binaryNode) + { + switch (binaryNode->getOp()) + { + case EOpIndexDirect: + case EOpIndexIndirect: + case EOpIndexDirectStruct: + case EOpIndexDirectInterfaceBlock: + markStaticReadIfSymbol(binaryNode->getLeft()); + return; + default: + return; + } + } + TIntermSymbol *symbolNode = node->getAsSymbolNode(); + if (symbolNode) + { + symbolTable.markStaticRead(symbolNode->variable()); + } +} + // Both test and if necessary, spit out an error, to see if the node is really // an l-value that can be operated on this way. bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIntermTyped *node) { - TIntermSymbol *symNode = node->getAsSymbolNode(); - TIntermBinary *binaryNode = node->getAsBinaryNode(); TIntermSwizzle *swizzleNode = node->getAsSwizzleNode(); - if (swizzleNode) { bool ok = checkCanBeLValue(line, op, swizzleNode->getOperand()); @@ -488,6 +485,7 @@ bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIn return ok; } + TIntermBinary *binaryNode = node->getAsBinaryNode(); if (binaryNode) { switch (binaryNode->getOp()) @@ -608,40 +606,32 @@ bool TParseContext::checkCanBeLValue(const TSourceLoc &line, const char *op, TIn } } - if (message.empty() && binaryNode == 0 && symNode == 0) + ASSERT(binaryNode == nullptr && swizzleNode == nullptr); + TIntermSymbol *symNode = node->getAsSymbolNode(); + if (message.empty() && symNode != nullptr) { - error(line, "l-value required", op); - - return false; - } - - // - // Everything else is okay, no error. - // - if (message.empty()) + symbolTable.markStaticWrite(symNode->variable()); return true; - - // - // If we get here, we have an error and a message. - // - if (symNode) - { - // Symbol inside an expression can't be nameless. - ASSERT(symNode->variable().symbolType() != SymbolType::Empty); - - const ImmutableString &symbol = symNode->getName(); - std::stringstream reasonStream; - reasonStream << "l-value required (" << message << " \"" << symbol << "\")"; - std::string reason = reasonStream.str(); - error(line, reason.c_str(), op); } - else + + std::stringstream reasonStream; + reasonStream << "l-value required"; + if (!message.empty()) { - std::stringstream reasonStream; - reasonStream << "l-value required (" << message << ")"; - std::string reason = reasonStream.str(); - error(line, reason.c_str(), op); + if (symNode) + { + // Symbol inside an expression can't be nameless. + ASSERT(symNode->variable().symbolType() != SymbolType::Empty); + const ImmutableString &symbol = symNode->getName(); + reasonStream << " (" << message << " \"" << symbol << "\")"; + } + else + { + reasonStream << " (" << message << ")"; + } } + std::string reason = reasonStream.str(); + error(line, reason.c_str(), op); return false; } @@ -726,6 +716,7 @@ bool TParseContext::checkConstructorArguments(const TSourceLoc &line, for (TIntermNode *arg : arguments) { + markStaticReadIfSymbol(arg); const TIntermTyped *argTyped = arg->getAsTyped(); ASSERT(argTyped != nullptr); if (type.getBasicType() != EbtStruct && IsOpaqueType(argTyped->getBasicType())) @@ -1169,7 +1160,7 @@ bool TParseContext::declareVariable(const TSourceLoc &line, if (needsReservedCheck && !checkIsNotReserved(line, identifier)) return false; - if (!symbolTable.declareVariable(*variable)) + if (!symbolTable.declare(*variable)) { error(line, "redefinition", identifier); return false; @@ -1700,17 +1691,22 @@ void TParseContext::functionCallRValueLValueErrorCheck(const TFunction *fnCandid { for (size_t i = 0; i < fnCandidate->getParamCount(); ++i) { - TQualifier qual = fnCandidate->getParam(i).type->getQualifier(); + TQualifier qual = fnCandidate->getParam(i)->getType().getQualifier(); TIntermTyped *argument = (*(fnCall->getSequence()))[i]->getAsTyped(); - if (!IsImage(argument->getBasicType()) && (IsQualifierUnspecified(qual) || qual == EvqIn || - qual == EvqInOut || qual == EvqConstReadOnly)) + bool argumentIsRead = (IsQualifierUnspecified(qual) || qual == EvqIn || qual == EvqInOut || + qual == EvqConstReadOnly); + if (argumentIsRead) { - if (argument->getMemoryQualifier().writeonly) + markStaticReadIfSymbol(argument); + if (!IsImage(argument->getBasicType())) { - error(argument->getLine(), - "Writeonly value cannot be passed for 'in' or 'inout' parameters.", - fnCall->functionName()); - return; + if (argument->getMemoryQualifier().writeonly) + { + error(argument->getLine(), + "Writeonly value cannot be passed for 'in' or 'inout' parameters.", + fnCall->functionName()); + return; + } } } if (qual == EvqOut || qual == EvqInOut) @@ -1831,40 +1827,9 @@ const TVariable *TParseContext::getNamedVariable(const TSourceLoc &location, checkCanUseExtension(location, variable->extension()); } - // Reject shaders using both gl_FragData and gl_FragColor - TQualifier qualifier = variable->getType().getQualifier(); - if (qualifier == EvqFragData || qualifier == EvqSecondaryFragDataEXT) - { - mUsesFragData = true; - } - else if (qualifier == EvqFragColor || qualifier == EvqSecondaryFragColorEXT) - { - mUsesFragColor = true; - } - if (qualifier == EvqSecondaryFragDataEXT || qualifier == EvqSecondaryFragColorEXT) - { - mUsesSecondaryOutputs = true; - } - - // This validation is not quite correct - it's only an error to write to - // both FragData and FragColor. For simplicity, and because users shouldn't - // be rewarded for reading from undefined varaibles, return an error - // if they are both referenced, rather than assigned. - if (mUsesFragData && mUsesFragColor) - { - const char *errorMessage = "cannot use both gl_FragData and gl_FragColor"; - if (mUsesSecondaryOutputs) - { - errorMessage = - "cannot use both output variable sets (gl_FragData, gl_SecondaryFragDataEXT)" - " and (gl_FragColor, gl_SecondaryFragColorEXT)"; - } - error(location, errorMessage, name); - } - // GLSL ES 3.1 Revision 4, 7.1.3 Compute Shader Special Variables if (getShaderType() == GL_COMPUTE_SHADER && !mComputeShaderLocalSizeDeclared && - qualifier == EvqWorkGroupSize) + variable->getType().getQualifier() == EvqWorkGroupSize) { error(location, "It is an error to use gl_WorkGroupSize before declaring the local group size", @@ -1915,8 +1880,8 @@ TIntermTyped *TParseContext::parseVariableIdentifier(const TSourceLoc &location, else if ((mGeometryShaderInputPrimitiveType != EptUndefined) && (variableType.getQualifier() == EvqPerVertexIn)) { - ASSERT(mGlInVariableWithArraySize != nullptr); - node = new TIntermSymbol(mGlInVariableWithArraySize); + ASSERT(symbolTable.getGlInVariableWithArraySize() != nullptr); + node = new TIntermSymbol(symbolTable.getGlInVariableWithArraySize()); } else { @@ -2031,6 +1996,7 @@ bool TParseContext::executeInitializer(const TSourceLoc &line, } *initNode = new TIntermBinary(EOpInitialize, intermSymbol, initializer); + markStaticReadIfSymbol(initializer); (*initNode)->setLine(line); return true; } @@ -2073,8 +2039,19 @@ TIntermNode *TParseContext::addLoop(TLoopType type, TIntermTyped *typedCond = nullptr; if (cond) { + markStaticReadIfSymbol(cond); typedCond = cond->getAsTyped(); } + if (expr) + { + markStaticReadIfSymbol(expr); + } + // In case the loop body was not parsed as a block and contains a statement that simply refers + // to a variable, we need to mark it as statically used. + if (body) + { + markStaticReadIfSymbol(body); + } if (cond == nullptr || typedCond) { if (type == ELoopDoWhile) @@ -2121,6 +2098,16 @@ TIntermNode *TParseContext::addIfElse(TIntermTyped *cond, const TSourceLoc &loc) { bool isScalarBool = checkIsScalarBool(loc, cond); + // In case the conditional statements were not parsed as blocks and contain a statement that + // simply refers to a variable, we need to mark them as statically used. + if (code.node1) + { + markStaticReadIfSymbol(code.node1); + } + if (code.node2) + { + markStaticReadIfSymbol(code.node2); + } // For compile time constant conditions, prune the code now. if (isScalarBool && cond->getAsConstantUnion()) @@ -2136,6 +2123,7 @@ TIntermNode *TParseContext::addIfElse(TIntermTyped *cond, } TIntermIfElse *node = new TIntermIfElse(cond, EnsureBlock(code.node1), EnsureBlock(code.node2)); + markStaticReadIfSymbol(cond); node->setLine(loc); return node; @@ -2383,9 +2371,9 @@ void TParseContext::checkGeometryShaderInputAndSetArraySize(const TSourceLoc &lo // input primitive declaration. if (mGeometryShaderInputPrimitiveType != EptUndefined) { - ASSERT(mGlInVariableWithArraySize != nullptr); + ASSERT(symbolTable.getGlInVariableWithArraySize() != nullptr); type->sizeOutermostUnsizedArray( - mGlInVariableWithArraySize->getType().getOutermostArraySize()); + symbolTable.getGlInVariableWithArraySize()->getType().getOutermostArraySize()); } else { @@ -2855,17 +2843,7 @@ bool TParseContext::checkPrimitiveTypeMatchesTypeQualifier(const TTypeQualifier void TParseContext::setGeometryShaderInputArraySize(unsigned int inputArraySize, const TSourceLoc &line) { - if (mGlInVariableWithArraySize == nullptr) - { - const TSymbol *glPerVertex = symbolTable.findBuiltIn(ImmutableString("gl_PerVertex"), 310); - const TInterfaceBlock *glPerVertexBlock = static_cast(glPerVertex); - TType *glInType = new TType(glPerVertexBlock, EvqPerVertexIn, TLayoutQualifier::Create()); - glInType->makeArray(inputArraySize); - mGlInVariableWithArraySize = - new TVariable(&symbolTable, ImmutableString("gl_in"), glInType, SymbolType::BuiltIn, - TExtension::EXT_geometry_shader); - } - else if (mGlInVariableWithArraySize->getType().getOutermostArraySize() != inputArraySize) + if (!symbolTable.setGlInArraySize(inputArraySize)) { error(line, "Array size or input primitive declaration doesn't match the size of earlier sized " @@ -3180,47 +3158,31 @@ TIntermFunctionPrototype *TParseContext::createPrototypeNodeFromFunction( for (size_t i = 0; i < function.getParamCount(); i++) { - const TConstParameter ¶m = function.getParam(i); - - TIntermSymbol *symbol = nullptr; + const TVariable *param = function.getParam(i); // If the parameter has no name, it's not an error, just don't add it to symbol table (could // be used for unused args). - if (param.name != nullptr) + if (param->symbolType() != SymbolType::Empty) { - TVariable *variable = - new TVariable(&symbolTable, param.name, param.type, SymbolType::UserDefined); - symbol = new TIntermSymbol(variable); - // Insert the parameter in the symbol table. if (insertParametersToSymbolTable) { - if (!symbolTable.declareVariable(variable)) + if (!symbolTable.declare(const_cast(param))) { - error(location, "redefinition", param.name); + error(location, "redefinition", param->name()); } } // Unsized type of a named parameter should have already been checked and sanitized. - ASSERT(!param.type->isUnsizedArray()); + ASSERT(!param->getType().isUnsizedArray()); } else { - if (param.type->isUnsizedArray()) + if (param->getType().isUnsizedArray()) { error(location, "function parameter array must be sized at compile time", "[]"); // We don't need to size the arrays since the parameter is unnamed and hence // inaccessible. } } - if (!symbol) - { - // The parameter had no name or declaring the symbol failed - either way, add a nameless - // symbol. - TVariable *emptyVariable = - new TVariable(&symbolTable, ImmutableString(""), param.type, SymbolType::Empty); - symbol = new TIntermSymbol(emptyVariable); - } - symbol->setLine(location); - prototype->appendParameter(symbol); } return prototype; } @@ -3313,8 +3275,8 @@ TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TF for (size_t i = 0u; i < function->getParamCount(); ++i) { - auto ¶m = function->getParam(i); - if (param.type->isStructSpecifier()) + const TVariable *param = function->getParam(i); + if (param->getType().isStructSpecifier()) { // ESSL 3.00.6 section 12.10. error(location, "Function parameter type cannot be a structure definition", @@ -3360,12 +3322,12 @@ TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TF } for (size_t i = 0; i < prevDec->getParamCount(); ++i) { - if (prevDec->getParam(i).type->getQualifier() != - function->getParam(i).type->getQualifier()) + if (prevDec->getParam(i)->getType().getQualifier() != + function->getParam(i)->getType().getQualifier()) { error(location, "function must have the same parameter qualifiers in all of its declarations", - function->getParam(i).type->getQualifierString()); + function->getParam(i)->getType().getQualifierString()); } } } @@ -3792,7 +3754,7 @@ TIntermDeclaration *TParseContext::addInterfaceBlock( TInterfaceBlock *interfaceBlock = new TInterfaceBlock( &symbolTable, blockName, fieldList, blockLayoutQualifier, SymbolType::UserDefined); - if (!symbolTable.declareInterfaceBlock(interfaceBlock)) + if (!symbolTable.declare(interfaceBlock)) { error(nameLine, "redefinition of an interface block name", blockName); } @@ -3826,7 +3788,7 @@ TIntermDeclaration *TParseContext::addInterfaceBlock( TVariable *fieldVariable = new TVariable(&symbolTable, field->name(), fieldType, SymbolType::UserDefined); - if (!symbolTable.declareVariable(fieldVariable)) + if (!symbolTable.declare(fieldVariable)) { error(field->line(), "redefinition of an interface block member name", field->name()); @@ -3838,7 +3800,7 @@ TIntermDeclaration *TParseContext::addInterfaceBlock( checkIsNotReserved(instanceLine, instanceName); // add a symbol for this interface block - if (!symbolTable.declareVariable(instanceVariable)) + if (!symbolTable.declare(instanceVariable)) { error(instanceLine, "redefinition of an interface block instance name", instanceName); } @@ -4063,6 +4025,7 @@ TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, } } + markStaticReadIfSymbol(indexExpression); TIntermBinary *node = new TIntermBinary(EOpIndexIndirect, baseExpression, indexExpression); node->setLine(location); // Indirect indexing can never be constant folded. @@ -4778,7 +4741,7 @@ TTypeSpecifierNonArray TParseContext::addStructure(const TSourceLoc &structLine, if (structSymbolType != SymbolType::Empty) { checkIsNotReserved(nameLine, structName); - if (!symbolTable.declareStructType(structure)) + if (!symbolTable.declare(structure)) { error(nameLine, "redefinition of a struct", structName); } @@ -4840,12 +4803,13 @@ TIntermSwitch *TParseContext::addSwitch(TIntermTyped *init, } ASSERT(statementList); - if (!ValidateSwitchStatementList(switchType, mShaderVersion, mDiagnostics, statementList, loc)) + if (!ValidateSwitchStatementList(switchType, mDiagnostics, statementList, loc)) { ASSERT(mDiagnostics->numErrors() > 0); return nullptr; } + markStaticReadIfSymbol(init); TIntermSwitch *node = new TIntermSwitch(init, statementList); node->setLine(loc); return node; @@ -4895,7 +4859,8 @@ TIntermCase *TParseContext::addDefault(const TSourceLoc &loc) TIntermTyped *TParseContext::createUnaryMath(TOperator op, TIntermTyped *child, - const TSourceLoc &loc) + const TSourceLoc &loc, + const TFunction *func) { ASSERT(child != nullptr); @@ -4942,7 +4907,8 @@ TIntermTyped *TParseContext::createUnaryMath(TOperator op, return nullptr; } - TIntermUnary *node = new TIntermUnary(op, child); + markStaticReadIfSymbol(child); + TIntermUnary *node = new TIntermUnary(op, child, func); node->setLine(loc); return node->fold(mDiagnostics); @@ -4951,7 +4917,7 @@ TIntermTyped *TParseContext::createUnaryMath(TOperator op, TIntermTyped *TParseContext::addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc) { ASSERT(op != EOpNull); - TIntermTyped *node = createUnaryMath(op, child, loc); + TIntermTyped *node = createUnaryMath(op, child, loc, nullptr); if (node == nullptr) { return child; @@ -5345,6 +5311,9 @@ TIntermTyped *TParseContext::addBinaryMathInternal(TOperator op, } TIntermBinary *node = new TIntermBinary(op, left, right); + ASSERT(op != EOpAssign); + markStaticReadIfSymbol(left); + markStaticReadIfSymbol(right); node->setLine(loc); return expressionOrFoldedResult(node); } @@ -5380,41 +5349,39 @@ TIntermTyped *TParseContext::addBinaryMathBooleanResult(TOperator op, return node; } -TIntermBinary *TParseContext::createAssign(TOperator op, - TIntermTyped *left, - TIntermTyped *right, - const TSourceLoc &loc) -{ - if (binaryOpCommonCheck(op, left, right, loc)) - { - if (op == EOpMulAssign) - { - op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType()); - if (!isMultiplicationTypeCombinationValid(op, left->getType(), right->getType())) - { - return nullptr; - } - } - TIntermBinary *node = new TIntermBinary(op, left, right); - node->setLine(loc); - - return node; - } - return nullptr; -} - TIntermTyped *TParseContext::addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc) { checkCanBeLValue(loc, "assign", left); - TIntermTyped *node = createAssign(op, left, right, loc); + TIntermBinary *node = nullptr; + if (binaryOpCommonCheck(op, left, right, loc)) + { + if (op == EOpMulAssign) + { + op = TIntermBinary::GetMulAssignOpBasedOnOperands(left->getType(), right->getType()); + if (isMultiplicationTypeCombinationValid(op, left->getType(), right->getType())) + { + node = new TIntermBinary(op, left, right); + } + } + else + { + node = new TIntermBinary(op, left, right); + } + } if (node == nullptr) { assignError(loc, "assign", left->getCompleteString(), right->getCompleteString()); return left; } + if (op != EOpAssign) + { + markStaticReadIfSymbol(left); + } + markStaticReadIfSymbol(right); + node->setLine(loc); return node; } @@ -5435,6 +5402,9 @@ TIntermTyped *TParseContext::addComma(TIntermTyped *left, } TIntermBinary *commaNode = TIntermBinary::CreateComma(left, right, mShaderVersion); + markStaticReadIfSymbol(left); + markStaticReadIfSymbol(right); + commaNode->setLine(loc); return expressionOrFoldedResult(commaNode); } @@ -5480,6 +5450,7 @@ TIntermBranch *TParseContext::addBranch(TOperator op, { if (expression != nullptr) { + markStaticReadIfSymbol(expression); ASSERT(op == EOpReturn); mFunctionReturnsValue = true; if (mCurrentFunctionType->getBasicType() == EbtVoid) @@ -5496,14 +5467,22 @@ TIntermBranch *TParseContext::addBranch(TOperator op, return node; } +void TParseContext::appendStatement(TIntermBlock *block, TIntermNode *statement) +{ + if (statement != nullptr) + { + markStaticReadIfSymbol(statement); + block->appendStatement(statement); + } +} + void TParseContext::checkTextureGather(TIntermAggregate *functionCall) { ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); - const ImmutableString &name = functionCall->getFunction()->name(); - bool isTextureGather = name == kTextureGatherName; - bool isTextureGatherOffset = name == kTextureGatherOffsetName; - if (isTextureGather || isTextureGatherOffset) + const TFunction *func = functionCall->getFunction(); + if (BuiltInGroup::isTextureGather(func)) { + bool isTextureGatherOffset = BuiltInGroup::isTextureGatherOffset(func); TIntermNode *componentNode = nullptr; TIntermSequence *arguments = functionCall->getSequence(); ASSERT(arguments->size() >= 2u && arguments->size() <= 4u); @@ -5517,7 +5496,7 @@ void TParseContext::checkTextureGather(TIntermAggregate *functionCall) case EbtSampler2DArray: case EbtISampler2DArray: case EbtUSampler2DArray: - if ((isTextureGather && arguments->size() == 3u) || + if ((!isTextureGatherOffset && arguments->size() == 3u) || (isTextureGatherOffset && arguments->size() == 4u)) { componentNode = arguments->back(); @@ -5547,14 +5526,15 @@ void TParseContext::checkTextureGather(TIntermAggregate *functionCall) if (componentNode->getAsTyped()->getQualifier() != EvqConst || !componentConstantUnion) { error(functionCall->getLine(), "Texture component must be a constant expression", - name); + func->name()); } else { int component = componentConstantUnion->getIConst(0); if (component < 0 || component > 3) { - error(functionCall->getLine(), "Component must be in the range [0;3]", name); + error(functionCall->getLine(), "Component must be in the range [0;3]", + func->name()); } } } @@ -5564,23 +5544,21 @@ void TParseContext::checkTextureGather(TIntermAggregate *functionCall) void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) { ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); - const ImmutableString &name = functionCall->getFunction()->name(); + const TFunction *func = functionCall->getFunction(); TIntermNode *offset = nullptr; TIntermSequence *arguments = functionCall->getSequence(); bool useTextureGatherOffsetConstraints = false; - if (name == kTexelFetchOffsetName || name == kTextureLodOffsetName || - name == kTextureProjLodOffsetName || name == kTextureGradOffsetName || - name == kTextureProjGradOffsetName) + if (BuiltInGroup::isTextureOffsetNoBias(func)) { offset = arguments->back(); } - else if (name == kTextureOffsetName || name == kTextureProjOffsetName) + else if (BuiltInGroup::isTextureOffsetBias(func)) { - // A bias parameter might follow the offset parameter. + // A bias parameter follows the offset parameter. ASSERT(arguments->size() >= 3); offset = (*arguments)[2]; } - else if (name == kTextureGatherOffsetName) + else if (BuiltInGroup::isTextureGatherOffset(func)) { ASSERT(arguments->size() >= 3u); const TIntermTyped *sampler = arguments->front()->getAsTyped(); @@ -5610,7 +5588,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) TIntermConstantUnion *offsetConstantUnion = offset->getAsConstantUnion(); if (offset->getAsTyped()->getQualifier() != EvqConst || !offsetConstantUnion) { - error(functionCall->getLine(), "Texture offset must be a constant expression", name); + error(functionCall->getLine(), "Texture offset must be a constant expression", + func->name()); } else { @@ -5640,8 +5619,8 @@ void TParseContext::checkTextureOffsetConst(TIntermAggregate *functionCall) void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *functionCall) { ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); - const ImmutableString &functionName = functionCall->getFunction()->name(); - if (IsAtomicBuiltin(functionName)) + const TFunction *func = functionCall->getFunction(); + if (BuiltInGroup::isAtomicMemory(func)) { TIntermSequence *arguments = functionCall->getSequence(); TIntermTyped *memNode = (*arguments)[0]->getAsTyped(); @@ -5663,7 +5642,7 @@ void TParseContext::checkAtomicMemoryBuiltinFunctions(TIntermAggregate *function error(memNode->getLine(), "The value passed to the mem argument of an atomic memory function does not " "correspond to a buffer or shared variable.", - functionName); + func->name()); } } @@ -5672,15 +5651,16 @@ void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate * { ASSERT(functionCall->getOp() == EOpCallBuiltInFunction); - if (functionCall->getFunction()->isImageFunction()) + const TFunction *func = functionCall->getFunction(); + + if (BuiltInGroup::isImage(func)) { - const ImmutableString &name = functionCall->getFunction()->name(); TIntermSequence *arguments = functionCall->getSequence(); TIntermTyped *imageNode = (*arguments)[0]->getAsTyped(); const TMemoryQualifier &memoryQualifier = imageNode->getMemoryQualifier(); - if (strcmp(name.data() + 5u, "Store") == 0) + if (BuiltInGroup::isImageStore(func)) { if (memoryQualifier.readonly) { @@ -5689,7 +5669,7 @@ void TParseContext::checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate * GetImageArgumentToken(imageNode)); } } - else if (strcmp(name.data() + 5u, "Load") == 0) + else if (BuiltInGroup::isImageLoad(func)) { if (memoryQualifier.writeonly) { @@ -5716,7 +5696,7 @@ void TParseContext::checkImageMemoryAccessForUserDefinedFunctions( { TIntermTyped *typedArgument = arguments[i]->getAsTyped(); const TType &functionArgumentType = typedArgument->getType(); - const TType &functionParameterType = *functionDefinition->getParam(i).type; + const TType &functionParameterType = functionDefinition->getParam(i)->getType(); ASSERT(functionArgumentType.getBasicType() == functionParameterType.getBasicType()); if (IsImage(functionArgumentType.getBasicType())) @@ -5800,7 +5780,7 @@ TIntermTyped *TParseContext::addMethod(TFunctionLookup *fnCall, const TSourceLoc } else { - TIntermUnary *node = new TIntermUnary(EOpArrayLength, thisNode); + TIntermUnary *node = new TIntermUnary(EOpArrayLength, thisNode, nullptr); node->setLine(loc); return node->fold(mDiagnostics); } @@ -5858,7 +5838,8 @@ TIntermTyped *TParseContext::addNonConstructorFunctionCall(TFunctionLookup *fnCa { // Treat it like a built-in unary operator. TIntermNode *unaryParamNode = fnCall->arguments().front(); - TIntermTyped *callNode = createUnaryMath(op, unaryParamNode->getAsTyped(), loc); + TIntermTyped *callNode = + createUnaryMath(op, unaryParamNode->getAsTyped(), loc, fnCandidate); ASSERT(callNode != nullptr); return callNode; } @@ -5955,6 +5936,9 @@ TIntermTyped *TParseContext::addTernarySelection(TIntermTyped *cond, } TIntermTernary *node = new TIntermTernary(cond, trueExpression, falseExpression); + markStaticReadIfSymbol(cond); + markStaticReadIfSymbol(trueExpression); + markStaticReadIfSymbol(falseExpression); node->setLine(loc); return expressionOrFoldedResult(node); } diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext.h b/gfx/angle/checkout/src/compiler/translator/ParseContext.h index 255d6c768728..0a55c23af637 100644 --- a/gfx/angle/checkout/src/compiler/translator/ParseContext.h +++ b/gfx/angle/checkout/src/compiler/translator/ParseContext.h @@ -419,6 +419,8 @@ class TParseContext : angle::NonCopyable TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc); TIntermBranch *addBranch(TOperator op, TIntermTyped *expression, const TSourceLoc &loc); + void appendStatement(TIntermBlock *block, TIntermNode *statement); + void checkTextureGather(TIntermAggregate *functionCall); void checkTextureOffsetConst(TIntermAggregate *functionCall); void checkImageMemoryAccessForBuiltinFunctions(TIntermAggregate *functionCall); @@ -464,6 +466,8 @@ class TParseContext : angle::NonCopyable // Note that there may be tests in AtomicCounter_test that will need to be updated as well. constexpr static size_t kAtomicCounterArrayStride = 4; + void markStaticReadIfSymbol(TIntermNode *node); + // Returns a clamped index. If it prints out an error message, the token is "[]". int checkIndexLessThan(bool outOfRangeIndexIsError, const TSourceLoc &location, @@ -545,11 +549,10 @@ class TParseContext : angle::NonCopyable TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc); - TIntermBinary *createAssign(TOperator op, - TIntermTyped *left, - TIntermTyped *right, - const TSourceLoc &loc); - TIntermTyped *createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc); + TIntermTyped *createUnaryMath(TOperator op, + TIntermTyped *child, + const TSourceLoc &loc, + const TFunction *func); TIntermTyped *addMethod(TFunctionLookup *fnCall, const TSourceLoc &loc); TIntermTyped *addConstructor(TFunctionLookup *fnCall, const TSourceLoc &line); @@ -606,10 +609,6 @@ class TParseContext : angle::NonCopyable TDirectiveHandler mDirectiveHandler; pp::Preprocessor mPreprocessor; void *mScanner; - bool mUsesFragData; // track if we are using both gl_FragData and gl_FragColor - bool mUsesFragColor; - bool mUsesSecondaryOutputs; // Track if we are using either gl_SecondaryFragData or - // gl_Secondary FragColor or both. int mMinProgramTexelOffset; int mMaxProgramTexelOffset; @@ -642,10 +641,6 @@ class TParseContext : angle::NonCopyable int mGeometryShaderMaxVertices; int mMaxGeometryShaderInvocations; int mMaxGeometryShaderMaxVertices; - - // Store gl_in variable with its array size once the array size can be determined. The array - // size can also be checked against latter input primitive type declaration. - const TVariable *mGlInVariableWithArraySize; }; int PaParseStrings(size_t count, diff --git a/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h b/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h new file mode 100644 index 000000000000..ac5e39f9ba29 --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/ParseContext_autogen.h @@ -0,0 +1,66 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_builtin_symbols.py using data from builtin_variables.json and +// builtin_function_declarations.txt. +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// ParseContext_autogen.h: +// Helpers for built-in related checks. + +#ifndef COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_ +#define COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_ + +namespace sh +{ + +namespace BuiltInGroup +{ + +bool isTextureOffsetNoBias(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 662 && id <= 731; +} +bool isTextureOffsetBias(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 732 && id <= 751; +} +bool isTextureGatherOffset(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 823 && id <= 836; +} +bool isTextureGather(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 799 && id <= 836; +} +bool isAtomicMemory(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 853 && id <= 870; +} +bool isImageLoad(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 895 && id <= 906; +} +bool isImageStore(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 907 && id <= 918; +} +bool isImage(const TFunction *func) +{ + int id = func->uniqueId().get(); + return id >= 871 && id <= 918; +} + +} // namespace BuiltInGroup + +} // namespace sh + +#endif // COMPILER_TRANSLATOR_PARSECONTEXT_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.cpp b/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.cpp deleted file mode 100644 index b39c912e9ca5..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.cpp +++ /dev/null @@ -1,56 +0,0 @@ -// -// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// RemoveEmptySwitchStatements.cpp: Remove switch statements that have an empty statement list. - -#include "compiler/translator/RemoveEmptySwitchStatements.h" - -#include "compiler/translator/IntermTraverse.h" - -namespace sh -{ - -namespace -{ - -class RemoveEmptySwitchStatementsTraverser : public TIntermTraverser -{ - public: - RemoveEmptySwitchStatementsTraverser() : TIntermTraverser(true, false, false) {} - - bool visitSwitch(Visit visit, TIntermSwitch *node); -}; - -bool RemoveEmptySwitchStatementsTraverser::visitSwitch(Visit visit, TIntermSwitch *node) -{ - if (node->getStatementList()->getSequence()->empty()) - { - // Just output the init statement. - if (node->getInit()->hasSideEffects()) - { - queueReplacement(node->getInit(), OriginalNode::IS_DROPPED); - } - else - { - TIntermSequence emptyReplacement; - ASSERT(getParentNode()->getAsBlock()); - mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), - node, emptyReplacement)); - } - return false; // Nothing inside the child nodes to traverse. - } - return true; -} - -} // anonymous namespace - -void RemoveEmptySwitchStatements(TIntermBlock *root) -{ - RemoveEmptySwitchStatementsTraverser traverser; - root->traverse(&traverser); - traverser.updateTree(); -} - -} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.h b/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.h deleted file mode 100644 index 1018a50d822b..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/RemoveEmptySwitchStatements.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// RemoveEmptySwitchStatements.h: Remove switch statements that have an empty statement list. - -#ifndef COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ -#define COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ - -namespace sh -{ -class TIntermBlock; - -void RemoveEmptySwitchStatements(TIntermBlock *root); -} - -#endif // COMPILER_TRANSLATOR_REMOVEEMPTYSWITCHSTATEMENTS_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp b/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp deleted file mode 100644 index b86d64d7a384..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp +++ /dev/null @@ -1,116 +0,0 @@ -// -// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// RemoveNoOpCasesFromEndOfSwitchStatements.cpp: Clean up cases from the end of a switch statement -// that only contain no-ops. - -#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h" - -#include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" -#include "compiler/translator/SymbolTable.h" - -namespace sh -{ - -namespace -{ - -bool AreEmptyBlocks(TIntermSequence *statements, size_t i); - -bool IsEmptyBlock(TIntermNode *node) -{ - TIntermBlock *asBlock = node->getAsBlock(); - if (asBlock) - { - if (asBlock->getSequence()->empty()) - { - return true; - } - return AreEmptyBlocks(asBlock->getSequence(), 0u); - } - // Empty declarations should have already been pruned, otherwise they would need to be handled - // here. Note that declarations for struct types do contain a nameless child node. - ASSERT(node->getAsDeclarationNode() == nullptr || - !node->getAsDeclarationNode()->getSequence()->empty()); - // Pure literal statements should also already be pruned. - ASSERT(node->getAsConstantUnion() == nullptr); - return false; -} - -// Return true if all statements in "statements" starting from index i consist only of empty blocks -// and no-op statements. Returns true also if there are no statements. -bool AreEmptyBlocks(TIntermSequence *statements, size_t i) -{ - for (; i < statements->size(); ++i) - { - if (!IsEmptyBlock(statements->at(i))) - { - return false; - } - } - return true; -} - -void RemoveNoOpCasesFromEndOfStatementList(TIntermBlock *statementList, TSymbolTable *symbolTable) -{ - TIntermSequence *statements = statementList->getSequence(); - - bool foundDeadCase = false; - do - { - if (statements->empty()) - { - return; - } - - // Find the last case label. - size_t i = statements->size(); - while (i > 0u && !(*statements)[i - 1]->getAsCaseNode()) - { - --i; - } - // Now i is the index of the first statement following the last label inside the switch - // statement. - ASSERT(i > 0u); - - foundDeadCase = AreEmptyBlocks(statements, i); - if (foundDeadCase) - { - statements->erase(statements->begin() + (i - 1u), statements->end()); - } - } while (foundDeadCase); -} - -class RemoveNoOpCasesFromEndOfSwitchTraverser : public TIntermTraverser -{ - public: - RemoveNoOpCasesFromEndOfSwitchTraverser(TSymbolTable *symbolTable) - : TIntermTraverser(true, false, false, symbolTable) - { - } - - bool visitSwitch(Visit visit, TIntermSwitch *node) override; -}; - -bool RemoveNoOpCasesFromEndOfSwitchTraverser::visitSwitch(Visit visit, TIntermSwitch *node) -{ - // Here we may mutate the statement list, but it's safe since traversal has not yet reached - // there. - RemoveNoOpCasesFromEndOfStatementList(node->getStatementList(), mSymbolTable); - // Handle also nested switch statements. - return true; -} - -} // anonymous namespace - -void RemoveNoOpCasesFromEndOfSwitchStatements(TIntermBlock *root, TSymbolTable *symbolTable) -{ - RemoveNoOpCasesFromEndOfSwitchTraverser traverser(symbolTable); - root->traverse(&traverser); -} - -} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h b/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h deleted file mode 100644 index ebd75eb7749a..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h +++ /dev/null @@ -1,21 +0,0 @@ -// -// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// RemoveNoOpCasesFromEndOfSwitchStatements.h: Clean up cases from the end of a switch statement -// that only contain no-ops. - -#ifndef COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_ -#define COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_ - -namespace sh -{ -class TIntermBlock; -class TSymbolTable; - -void RemoveNoOpCasesFromEndOfSwitchStatements(TIntermBlock *root, TSymbolTable *symbolTable); - -} // namespace sh - -#endif // COMPILER_TRANSLATOR_REMOVENOOPCASESFROMENDOFSWITCHSTATEMENTS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp b/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp index 8c6a1a1a4699..a89257482fc2 100644 --- a/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ShaderVars.cpp @@ -32,17 +32,17 @@ bool InterpolationTypesMatch(InterpolationType a, InterpolationType b) } ShaderVariable::ShaderVariable() - : type(0), precision(0), flattenedOffsetInParentArrays(0), staticUse(false) + : type(0), precision(0), flattenedOffsetInParentArrays(0), staticUse(false), active(false) { } ShaderVariable::ShaderVariable(GLenum typeIn) - : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false) + : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false), active(false) { } ShaderVariable::ShaderVariable(GLenum typeIn, unsigned int arraySizeIn) - : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false) + : type(typeIn), precision(0), flattenedOffsetInParentArrays(0), staticUse(false), active(false) { ASSERT(arraySizeIn != 0); arraySizes.push_back(arraySizeIn); @@ -60,6 +60,7 @@ ShaderVariable::ShaderVariable(const ShaderVariable &other) arraySizes(other.arraySizes), flattenedOffsetInParentArrays(other.flattenedOffsetInParentArrays), staticUse(other.staticUse), + active(other.active), fields(other.fields), structName(other.structName) { @@ -73,6 +74,7 @@ ShaderVariable &ShaderVariable::operator=(const ShaderVariable &other) mappedName = other.mappedName; arraySizes = other.arraySizes; staticUse = other.staticUse; + active = other.active; flattenedOffsetInParentArrays = other.flattenedOffsetInParentArrays; fields = other.fields; structName = other.structName; @@ -83,8 +85,8 @@ bool ShaderVariable::operator==(const ShaderVariable &other) const { if (type != other.type || precision != other.precision || name != other.name || mappedName != other.mappedName || arraySizes != other.arraySizes || - staticUse != other.staticUse || fields.size() != other.fields.size() || - structName != other.structName) + staticUse != other.staticUse || active != other.active || + fields.size() != other.fields.size() || structName != other.structName) { return false; } @@ -454,6 +456,7 @@ InterfaceBlock::InterfaceBlock() isRowMajorLayout(false), binding(-1), staticUse(false), + active(false), blockType(BlockType::BLOCK_UNIFORM) { } @@ -471,6 +474,7 @@ InterfaceBlock::InterfaceBlock(const InterfaceBlock &other) isRowMajorLayout(other.isRowMajorLayout), binding(other.binding), staticUse(other.staticUse), + active(other.active), blockType(other.blockType), fields(other.fields) { @@ -486,6 +490,7 @@ InterfaceBlock &InterfaceBlock::operator=(const InterfaceBlock &other) isRowMajorLayout = other.isRowMajorLayout; binding = other.binding; staticUse = other.staticUse; + active = other.active; blockType = other.blockType; fields = other.fields; return *this; diff --git a/gfx/angle/checkout/src/compiler/translator/StaticType.cpp b/gfx/angle/checkout/src/compiler/translator/StaticType.cpp deleted file mode 100644 index 1f3075593a6d..000000000000 --- a/gfx/angle/checkout/src/compiler/translator/StaticType.cpp +++ /dev/null @@ -1,74 +0,0 @@ -// -// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Compile-time instances of many common TType values. These are looked up -// (statically or dynamically) through the methods defined in the namespace. -// - -#include "compiler/translator/StaticType.h" - -namespace sh -{ - -namespace StaticType -{ - -const TType *GetForFloatImage(TBasicType basicType) -{ - switch (basicType) - { - case EbtGImage2D: - return Get(); - case EbtGImage3D: - return Get(); - case EbtGImage2DArray: - return Get(); - case EbtGImageCube: - return Get(); - default: - UNREACHABLE(); - return GetBasic(); - } -} - -const TType *GetForIntImage(TBasicType basicType) -{ - switch (basicType) - { - case EbtGImage2D: - return Get(); - case EbtGImage3D: - return Get(); - case EbtGImage2DArray: - return Get(); - case EbtGImageCube: - return Get(); - default: - UNREACHABLE(); - return GetBasic(); - } -} - -const TType *GetForUintImage(TBasicType basicType) -{ - switch (basicType) - { - case EbtGImage2D: - return Get(); - case EbtGImage3D: - return Get(); - case EbtGImage2DArray: - return Get(); - case EbtGImageCube: - return Get(); - default: - UNREACHABLE(); - return GetBasic(); - } -} - -} // namespace StaticType - -} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/StaticType.h b/gfx/angle/checkout/src/compiler/translator/StaticType.h index 30b391a39509..7587e85b42f5 100644 --- a/gfx/angle/checkout/src/compiler/translator/StaticType.h +++ b/gfx/angle/checkout/src/compiler/translator/StaticType.h @@ -25,16 +25,16 @@ namespace Helpers // Generation and static allocation of type mangled name values. // -// Size of the maximum possible constexpr-generated mangled name. +// Size of the constexpr-generated mangled name. // If this value is too small, the compiler will produce errors. -static constexpr size_t kStaticMangledNameMaxLength = 10; +static constexpr size_t kStaticMangledNameLength = 2; // Type which holds the mangled names for constexpr-generated TTypes. // This simple struct is needed so that a char array can be returned by value. struct StaticMangledName { // If this array is too small, the compiler will produce errors. - char name[kStaticMangledNameMaxLength + 1] = {}; + char name[kStaticMangledNameLength + 1] = {}; }; // Generates a mangled name for a TType given its parameters. @@ -45,40 +45,9 @@ constexpr StaticMangledName BuildStaticMangledName(TBasicType basicType, unsigned char secondarySize) { StaticMangledName name = {}; - // When this function is executed constexpr (should be always), - // name.name[at] is guaranteed by the compiler to never go out of bounds. - size_t at = 0; - - bool isMatrix = primarySize > 1 && secondarySize > 1; - bool isVector = primarySize > 1 && secondarySize == 1; - - if (isMatrix) - { - name.name[at++] = 'm'; - } - else if (isVector) - { - name.name[at++] = 'v'; - } - - { - const char *basicMangledName = GetBasicMangledName(basicType); - for (size_t i = 0; basicMangledName[i] != '\0'; ++i) - { - name.name[at++] = basicMangledName[i]; - } - } - - name.name[at++] = '0' + primarySize; - if (isMatrix) - { - name.name[at++] = 'x'; - name.name[at++] = '0' + secondarySize; - } - - name.name[at++] = ';'; - - name.name[at] = '\0'; + name.name[0] = TType::GetSizeMangledName(primarySize, secondarySize); + name.name[1] = GetBasicMangledName(basicType); + name.name[2] = '\0'; return name; } @@ -222,12 +191,6 @@ constexpr const TType *GetForVec(TQualifier qualifier, unsigned char size) } } -const TType *GetForFloatImage(TBasicType basicType); - -const TType *GetForIntImage(TBasicType basicType); - -const TType *GetForUintImage(TBasicType basicType); - } // namespace StaticType } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/Symbol.cpp b/gfx/angle/checkout/src/compiler/translator/Symbol.cpp index 3e7b83a21566..cb3331c01e54 100644 --- a/gfx/angle/checkout/src/compiler/translator/Symbol.cpp +++ b/gfx/angle/checkout/src/compiler/translator/Symbol.cpp @@ -46,11 +46,13 @@ TSymbol::TSymbol(TSymbolTable *symbolTable, ImmutableString TSymbol::name() const { - if (mName != "") + if (!mName.empty()) { return mName; } - ASSERT(mSymbolType == SymbolType::AngleInternal); + // This can be called for nameless function parameters in HLSL. + ASSERT(mSymbolType == SymbolType::AngleInternal || + (mSymbolType == SymbolType::Empty && isVariable())); int uniqueId = mUniqueId.get(); ImmutableStringBuilder symbolNameOut(sizeof(uniqueId) * 2u + 1u); symbolNameOut << 's'; @@ -82,6 +84,14 @@ TStructure::TStructure(TSymbolTable *symbolTable, { } +TStructure::TStructure(const TSymbolUniqueId &id, + const ImmutableString &name, + TExtension extension, + const TFieldList *fields) + : TSymbol(id, name, SymbolType::BuiltIn, extension), TFieldListCollection(fields) +{ +} + void TStructure::createSamplerSymbols(const char *namePrefix, const TString &apiNamePrefix, TVector *outputSymbols, @@ -124,6 +134,17 @@ TInterfaceBlock::TInterfaceBlock(TSymbolTable *symbolTable, ASSERT(name != nullptr); } +TInterfaceBlock::TInterfaceBlock(const TSymbolUniqueId &id, + const ImmutableString &name, + TExtension extension, + const TFieldList *fields) + : TSymbol(id, name, SymbolType::BuiltIn, extension), + TFieldListCollection(fields), + mBlockStorage(EbsUnspecified), + mBinding(0) +{ +} + TFunction::TFunction(TSymbolTable *symbolTable, const ImmutableString &name, SymbolType symbolType, @@ -145,32 +166,7 @@ TFunction::TFunction(TSymbolTable *symbolTable, ASSERT(name != nullptr || symbolType == SymbolType::AngleInternal); } -TFunction::TFunction(TSymbolTable *symbolTable, - const ImmutableString &name, - TExtension extension, - TConstParameter *parameters, - size_t paramCount, - const TType *retType, - TOperator op, - bool knownToNotHaveSideEffects) - : TSymbol(symbolTable, name, SymbolType::BuiltIn, extension), - mParametersVector(nullptr), - mParameters(parameters), - mParamCount(paramCount), - returnType(retType), - mMangledName(""), - mOp(op), - defined(false), - mHasPrototypeDeclaration(false), - mKnownToNotHaveSideEffects(knownToNotHaveSideEffects) -{ - ASSERT(name != nullptr); - ASSERT(op != EOpNull); - ASSERT(paramCount == 0 || parameters != nullptr); - mMangledName = buildMangledName(); -} - -void TFunction::addParameter(const TConstParameter &p) +void TFunction::addParameter(const TVariable *p) { ASSERT(mParametersVector); mParametersVector->push_back(p); @@ -195,7 +191,7 @@ ImmutableString TFunction::buildMangledName() const for (size_t i = 0u; i < mParamCount; ++i) { - newName += mParameters[i].type->getMangledName(); + newName += mParameters[i]->getType().getMangledName(); } return ImmutableString(newName); } diff --git a/gfx/angle/checkout/src/compiler/translator/Symbol.h b/gfx/angle/checkout/src/compiler/translator/Symbol.h index cc5a81abe783..e453d4ffe2b5 100644 --- a/gfx/angle/checkout/src/compiler/translator/Symbol.h +++ b/gfx/angle/checkout/src/compiler/translator/Symbol.h @@ -42,8 +42,10 @@ class TSymbol : angle::NonCopyable // either statically allocated or pool allocated. ~TSymbol() = default; - // Don't call name() or getMangledName() for empty symbols (symbolType == SymbolType::Empty). + // Calling name() for empty symbols (symbolType == SymbolType::Empty) generates a similar name + // as for internal variables. ImmutableString name() const; + // Don't call getMangledName() for empty symbols (symbolType == SymbolType::Empty). virtual ImmutableString getMangledName() const; virtual bool isFunction() const { return false; } @@ -89,7 +91,7 @@ class TVariable : public TSymbol void shareConstPointer(const TConstantUnion *constArray) { unionArray = constArray; } - private: + // Note: only to be used for built-in variables with autogenerated ids! constexpr TVariable(const TSymbolUniqueId &id, const ImmutableString &name, SymbolType symbolType, @@ -99,6 +101,7 @@ class TVariable : public TSymbol { } + private: const TType *mType; const TConstantUnion *unionArray; }; @@ -125,6 +128,13 @@ class TStructure : public TSymbol, public TFieldListCollection bool atGlobalScope() const { return mAtGlobalScope; } private: + friend class TSymbolTable; + // For creating built-in structs. + TStructure(const TSymbolUniqueId &id, + const ImmutableString &name, + TExtension extension, + const TFieldList *fields); + // TODO(zmo): Find a way to get rid of the const_cast in function // setName(). At the moment keep this function private so only // friend class RegenerateStructNames may call it. @@ -150,44 +160,33 @@ class TInterfaceBlock : public TSymbol, public TFieldListCollection int blockBinding() const { return mBinding; } private: + friend class TSymbolTable; + // For creating built-in interface blocks. + TInterfaceBlock(const TSymbolUniqueId &id, + const ImmutableString &name, + TExtension extension, + const TFieldList *fields); + TLayoutBlockStorage mBlockStorage; int mBinding; // Note that we only record matrix packing on a per-field granularity. }; -// Immutable version of TParameter. -struct TConstParameter -{ - POOL_ALLOCATOR_NEW_DELETE(); - TConstParameter() : name(""), type(nullptr) {} - explicit TConstParameter(const ImmutableString &n) : name(n), type(nullptr) {} - constexpr explicit TConstParameter(const TType *t) : name(""), type(t) {} - TConstParameter(const ImmutableString &n, const TType *t) : name(n), type(t) {} - - // Both constructor arguments must be const. - TConstParameter(ImmutableString *n, TType *t) = delete; - TConstParameter(const ImmutableString *n, TType *t) = delete; - TConstParameter(ImmutableString *n, const TType *t) = delete; - - const ImmutableString name; - const TType *const type; -}; - -// The function sub-class of symbols and the parser will need to -// share this definition of a function parameter. +// Parameter class used for parsing user-defined function parameters. struct TParameter { - // Destructively converts to TConstParameter. + // Destructively converts to TVariable. // This method resets name and type to nullptrs to make sure // their content cannot be modified after the call. - TConstParameter turnToConst() + const TVariable *createVariable(TSymbolTable *symbolTable) { const ImmutableString constName(name); const TType *constType = type; name = nullptr; type = nullptr; - return TConstParameter(constName, constType); + return new TVariable(symbolTable, constName, constType, + constName.empty() ? SymbolType::Empty : SymbolType::UserDefined); } const char *name; // either pool allocated or static. @@ -205,24 +204,15 @@ class TFunction : public TSymbol const TType *retType, bool knownToNotHaveSideEffects); - // Built-in function - TFunction(TSymbolTable *symbolTable, - const ImmutableString &name, - TExtension extension, - TConstParameter *parameters, - size_t paramCount, - const TType *retType, - TOperator op, - bool knownToNotHaveSideEffects); - bool isFunction() const override { return true; } - void addParameter(const TConstParameter &p); + void addParameter(const TVariable *p); void shareParameters(const TFunction ¶metersSource); ImmutableString getMangledName() const override { - if (mMangledName == "") + ASSERT(symbolType() != SymbolType::BuiltIn); + if (mMangledName.empty()) { mMangledName = buildMangledName(); } @@ -239,21 +229,20 @@ class TFunction : public TSymbol bool hasPrototypeDeclaration() const { return mHasPrototypeDeclaration; } size_t getParamCount() const { return mParamCount; } - const TConstParameter &getParam(size_t i) const { return mParameters[i]; } + const TVariable *getParam(size_t i) const { return mParameters[i]; } bool isKnownToNotHaveSideEffects() const { return mKnownToNotHaveSideEffects; } bool isMain() const; bool isImageFunction() const; - private: + // Note: Only to be used for static built-in functions! constexpr TFunction(const TSymbolUniqueId &id, const ImmutableString &name, TExtension extension, - const TConstParameter *parameters, + const TVariable *const *parameters, size_t paramCount, const TType *retType, - const ImmutableString &mangledName, TOperator op, bool knownToNotHaveSideEffects) : TSymbol(id, name, SymbolType::BuiltIn, extension), @@ -261,7 +250,7 @@ class TFunction : public TSymbol mParameters(parameters), mParamCount(paramCount), returnType(retType), - mMangledName(mangledName), + mMangledName(nullptr), mOp(op), defined(false), mHasPrototypeDeclaration(false), @@ -269,11 +258,12 @@ class TFunction : public TSymbol { } + private: ImmutableString buildMangledName() const; - typedef TVector TParamVector; + typedef TVector TParamVector; TParamVector *mParametersVector; - const TConstParameter *mParameters; + const TVariable *const *mParameters; size_t mParamCount; const TType *const returnType; mutable ImmutableString mMangledName; diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp index 540d695cebf3..3d479fbd119d 100644 --- a/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp +++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable.cpp @@ -58,30 +58,6 @@ class TSymbolTable::TSymbolTableLevel bool mGlobalInvariant; }; -class TSymbolTable::TSymbolTableBuiltInLevel -{ - public: - TSymbolTableBuiltInLevel() = default; - - bool insert(const TSymbol *symbol); - - const TSymbol *find(const ImmutableString &name) const; - - void insertUnmangledBuiltIn(const char *name, TExtension ext); - const UnmangledBuiltIn *getUnmangledBuiltIn(const ImmutableString &name) const; - - private: - using tLevel = TUnorderedMap>; - using tLevelPair = const tLevel::value_type; - using tInsertResult = std::pair; - - tLevel mLevel; - - std::map mUnmangledBuiltIns; -}; - bool TSymbolTable::TSymbolTableLevel::insert(TSymbol *symbol) { // returning true means symbol was added to the table @@ -103,54 +79,21 @@ TSymbol *TSymbolTable::TSymbolTableLevel::find(const ImmutableString &name) cons return (*it).second; } -bool TSymbolTable::TSymbolTableBuiltInLevel::insert(const TSymbol *symbol) -{ - // returning true means symbol was added to the table - tInsertResult result = mLevel.insert(tLevelPair(symbol->getMangledName(), symbol)); - return result.second; -} - -const TSymbol *TSymbolTable::TSymbolTableBuiltInLevel::find(const ImmutableString &name) const -{ - tLevel::const_iterator it = mLevel.find(name); - if (it == mLevel.end()) - return nullptr; - else - return (*it).second; -} - -void TSymbolTable::TSymbolTableBuiltInLevel::insertUnmangledBuiltIn(const char *name, - TExtension ext) -{ - ImmutableString immName(name); - if (ext == TExtension::UNDEFINED || - mUnmangledBuiltIns.find(immName) == mUnmangledBuiltIns.end()) - { - mUnmangledBuiltIns[immName] = UnmangledBuiltIn(ext); - } -} - -const UnmangledBuiltIn *TSymbolTable::TSymbolTableBuiltInLevel::getUnmangledBuiltIn( - const ImmutableString &name) const -{ - auto it = mUnmangledBuiltIns.find(ImmutableString(name)); - if (it == mUnmangledBuiltIns.end()) - { - return nullptr; - } - return &(it->second); -} - -TSymbolTable::TSymbolTable() : mUniqueIdCounter(0), mUserDefinedUniqueIdsStart(-1) +TSymbolTable::TSymbolTable() + : mUniqueIdCounter(0), mShaderType(GL_FRAGMENT_SHADER), mGlInVariableWithArraySize(nullptr) { } TSymbolTable::~TSymbolTable() = default; -void TSymbolTable::pushBuiltInLevel() +bool TSymbolTable::isEmpty() const { - mBuiltInTable.push_back( - std::unique_ptr(new TSymbolTableBuiltInLevel)); + return mTable.empty(); +} + +bool TSymbolTable::atGlobalLevel() const +{ + return mTable.size() == 1u; } void TSymbolTable::push() @@ -195,6 +138,66 @@ const TFunction *TSymbolTable::setFunctionParameterNamesFromDefinition(const TFu return firstDeclaration; } +bool TSymbolTable::setGlInArraySize(unsigned int inputArraySize) +{ + if (mGlInVariableWithArraySize) + { + return mGlInVariableWithArraySize->getType().getOutermostArraySize() == inputArraySize; + } + const TInterfaceBlock *glPerVertex = mVar_gl_PerVertex; + TType *glInType = new TType(glPerVertex, EvqPerVertexIn, TLayoutQualifier::Create()); + glInType->makeArray(inputArraySize); + mGlInVariableWithArraySize = + new TVariable(this, ImmutableString("gl_in"), glInType, SymbolType::BuiltIn, + TExtension::EXT_geometry_shader); + return true; +} + +TVariable *TSymbolTable::getGlInVariableWithArraySize() const +{ + return mGlInVariableWithArraySize; +} + +const TVariable *TSymbolTable::gl_FragData() const +{ + return mVar_gl_FragData; +} + +const TVariable *TSymbolTable::gl_SecondaryFragDataEXT() const +{ + return mVar_gl_SecondaryFragDataEXT; +} + +void TSymbolTable::markStaticWrite(const TVariable &variable) +{ + int id = variable.uniqueId().get(); + auto iter = mVariableMetadata.find(id); + if (iter == mVariableMetadata.end()) + { + iter = mVariableMetadata.insert(std::make_pair(id, VariableMetadata())).first; + } + iter->second.staticWrite = true; +} + +void TSymbolTable::markStaticRead(const TVariable &variable) +{ + int id = variable.uniqueId().get(); + auto iter = mVariableMetadata.find(id); + if (iter == mVariableMetadata.end()) + { + iter = mVariableMetadata.insert(std::make_pair(id, VariableMetadata())).first; + } + iter->second.staticRead = true; +} + +bool TSymbolTable::isStaticallyUsed(const TVariable &variable) const +{ + ASSERT(!variable.getConstPointer()); + int id = variable.uniqueId().get(); + auto iter = mVariableMetadata.find(id); + return iter != mVariableMetadata.end(); +} + const TSymbol *TSymbolTable::find(const ImmutableString &name, int shaderVersion) const { int userDefinedLevel = static_cast(mTable.size()) - 1; @@ -208,7 +211,7 @@ const TSymbol *TSymbolTable::find(const ImmutableString &name, int shaderVersion userDefinedLevel--; } - return findBuiltIn(name, shaderVersion, false); + return findBuiltIn(name, shaderVersion); } TFunction *TSymbolTable::findUserDefinedFunction(const ImmutableString &name) const @@ -224,134 +227,17 @@ const TSymbol *TSymbolTable::findGlobal(const ImmutableString &name) const return mTable[0]->find(name); } -const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shaderVersion) const +bool TSymbolTable::declare(TSymbol *symbol) { - return findBuiltIn(name, shaderVersion, false); -} - -const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, - int shaderVersion, - bool includeGLSLBuiltins) const -{ - for (int level = LAST_BUILTIN_LEVEL; level >= 0; level--) - { - if (level == GLSL_BUILTINS && !includeGLSLBuiltins) - level--; - if (level == ESSL3_1_BUILTINS && shaderVersion != 310) - level--; - if (level == ESSL3_BUILTINS && shaderVersion < 300) - level--; - if (level == ESSL1_BUILTINS && shaderVersion != 100) - level--; - - const TSymbol *symbol = mBuiltInTable[level]->find(name); - - if (symbol) - return symbol; - } - - return nullptr; -} - -constexpr bool IsGenType(const TType *type) -{ - if (type) - { - TBasicType basicType = type->getBasicType(); - return basicType == EbtGenType || basicType == EbtGenIType || basicType == EbtGenUType || - basicType == EbtGenBType; - } - - return false; -} - -constexpr bool IsVecType(const TType *type) -{ - if (type) - { - TBasicType basicType = type->getBasicType(); - return basicType == EbtVec || basicType == EbtIVec || basicType == EbtUVec || - basicType == EbtBVec; - } - - return false; -} - -constexpr const TType *SpecificType(const TType *type, int size) -{ - ASSERT(size >= 1 && size <= 4); - - if (!type) - { - return nullptr; - } - - ASSERT(!IsVecType(type)); - - switch (type->getBasicType()) - { - case EbtGenType: - return StaticType::GetForVec(type->getQualifier(), - static_cast(size)); - case EbtGenIType: - return StaticType::GetForVec(type->getQualifier(), - static_cast(size)); - case EbtGenUType: - return StaticType::GetForVec(type->getQualifier(), - static_cast(size)); - case EbtGenBType: - return StaticType::GetForVec(type->getQualifier(), - static_cast(size)); - default: - return type; - } -} - -constexpr const TType *VectorType(const TType *type, int size) -{ - ASSERT(size >= 2 && size <= 4); - - if (!type) - { - return nullptr; - } - - ASSERT(!IsGenType(type)); - - switch (type->getBasicType()) - { - case EbtVec: - return StaticType::GetForVecMat(static_cast(size)); - case EbtIVec: - return StaticType::GetForVecMat(static_cast(size)); - case EbtUVec: - return StaticType::GetForVecMat(static_cast(size)); - case EbtBVec: - return StaticType::GetForVecMat(static_cast(size)); - default: - return type; - } -} - -bool TSymbolTable::declareVariable(TVariable *variable) -{ - ASSERT(variable->symbolType() == SymbolType::UserDefined); - return insertVariable(currentLevel(), variable); -} - -bool TSymbolTable::declareStructType(TStructure *str) -{ - return insertStructType(currentLevel(), str); -} - -bool TSymbolTable::declareInterfaceBlock(TInterfaceBlock *interfaceBlock) -{ - return insert(currentLevel(), interfaceBlock); + ASSERT(!mTable.empty()); + ASSERT(symbol->symbolType() == SymbolType::UserDefined); + ASSERT(!symbol->isFunction()); + return mTable.back()->insert(symbol); } void TSymbolTable::declareUserDefinedFunction(TFunction *function, bool insertUnmangledName) { - ASSERT(currentLevel() >= GLOBAL_LEVEL); + ASSERT(!mTable.empty()); if (insertUnmangledName) { // Insert the unmangled name to detect potential future redefinition as a variable. @@ -360,331 +246,6 @@ void TSymbolTable::declareUserDefinedFunction(TFunction *function, bool insertUn mTable[0]->insert(function); } -TVariable *TSymbolTable::insertVariable(ESymbolLevel level, - const ImmutableString &name, - const TType *type) -{ - ASSERT(level <= LAST_BUILTIN_LEVEL); - ASSERT(type->isRealized()); - return insertVariable(level, name, type, SymbolType::BuiltIn); -} - -TVariable *TSymbolTable::insertVariable(ESymbolLevel level, - const ImmutableString &name, - const TType *type, - SymbolType symbolType) -{ - ASSERT(level > LAST_BUILTIN_LEVEL || type->isRealized()); - TVariable *var = new TVariable(this, name, type, symbolType); - if (insert(level, var)) - { - return var; - } - return nullptr; -} - -void TSymbolTable::insertVariableExt(ESymbolLevel level, - TExtension ext, - const ImmutableString &name, - const TType *type) -{ - ASSERT(level <= LAST_BUILTIN_LEVEL); - ASSERT(type->isRealized()); - TVariable *var = new TVariable(this, name, type, SymbolType::BuiltIn, ext); - bool inserted = insert(level, var); - UNUSED_VARIABLE(inserted); - ASSERT(inserted); -} - -bool TSymbolTable::insertVariable(ESymbolLevel level, TVariable *variable) -{ - ASSERT(variable); - ASSERT(level > LAST_BUILTIN_LEVEL || variable->getType().isRealized()); - return insert(level, variable); -} - -bool TSymbolTable::insert(ESymbolLevel level, TSymbol *symbol) -{ - ASSERT(level > LAST_BUILTIN_LEVEL || mUserDefinedUniqueIdsStart == -1); - if (level <= LAST_BUILTIN_LEVEL) - { - return mBuiltInTable[level]->insert(symbol); - } - else - { - return mTable[level - LAST_BUILTIN_LEVEL - 1]->insert(symbol); - } -} - -bool TSymbolTable::insertStructType(ESymbolLevel level, TStructure *str) -{ - ASSERT(str); - return insert(level, str); -} - -bool TSymbolTable::insertInterfaceBlock(ESymbolLevel level, TInterfaceBlock *interfaceBlock) -{ - ASSERT(interfaceBlock); - return insert(level, interfaceBlock); -} - -template -bool TSymbolTable::insertConstInt(ESymbolLevel level, const ImmutableString &name, int value) -{ - TVariable *constant = new TVariable( - this, name, StaticType::Get(), SymbolType::BuiltIn); - TConstantUnion *unionArray = new TConstantUnion[1]; - unionArray[0].setIConst(value); - constant->shareConstPointer(unionArray); - return insert(level, constant); -} - -template -bool TSymbolTable::insertConstIntExt(ESymbolLevel level, - TExtension ext, - const ImmutableString &name, - int value) -{ - TVariable *constant = new TVariable( - this, name, StaticType::Get(), SymbolType::BuiltIn, ext); - TConstantUnion *unionArray = new TConstantUnion[1]; - unionArray[0].setIConst(value); - constant->shareConstPointer(unionArray); - return insert(level, constant); -} - -template -bool TSymbolTable::insertConstIvec3(ESymbolLevel level, - const ImmutableString &name, - const std::array &values) -{ - TVariable *constantIvec3 = new TVariable( - this, name, StaticType::Get(), SymbolType::BuiltIn); - - TConstantUnion *unionArray = new TConstantUnion[3]; - for (size_t index = 0u; index < 3u; ++index) - { - unionArray[index].setIConst(values[index]); - } - constantIvec3->shareConstPointer(unionArray); - - return insert(level, constantIvec3); -} - -void TSymbolTable::insertBuiltIn(ESymbolLevel level, - TOperator op, - TExtension ext, - const TType *rvalue, - const char *name, - const TType *ptype1, - const TType *ptype2, - const TType *ptype3, - const TType *ptype4, - const TType *ptype5) -{ - if (ptype1->getBasicType() == EbtGSampler2D) - { - insertUnmangledBuiltIn(name, ext, level); - bool gvec4 = (rvalue->getBasicType() == EbtGVec4); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - } - else if (ptype1->getBasicType() == EbtGSampler3D) - { - insertUnmangledBuiltIn(name, ext, level); - bool gvec4 = (rvalue->getBasicType() == EbtGVec4); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - } - else if (ptype1->getBasicType() == EbtGSamplerCube) - { - insertUnmangledBuiltIn(name, ext, level); - bool gvec4 = (rvalue->getBasicType() == EbtGVec4); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - } - else if (ptype1->getBasicType() == EbtGSampler2DArray) - { - insertUnmangledBuiltIn(name, ext, level); - bool gvec4 = (rvalue->getBasicType() == EbtGVec4); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, - ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, - ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, - ptype5); - } - else if (ptype1->getBasicType() == EbtGSampler2DMS) - { - insertUnmangledBuiltIn(name, ext, level); - bool gvec4 = (rvalue->getBasicType() == EbtGVec4); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, gvec4 ? StaticType::GetBasic() : rvalue, name, - StaticType::GetBasic(), ptype2, ptype3, ptype4, ptype5); - } - else if (IsGImage(ptype1->getBasicType())) - { - insertUnmangledBuiltIn(name, ext, level); - - const TType *floatType = StaticType::GetBasic(); - const TType *intType = StaticType::GetBasic(); - const TType *unsignedType = StaticType::GetBasic(); - - const TType *floatImage = StaticType::GetForFloatImage(ptype1->getBasicType()); - const TType *intImage = StaticType::GetForIntImage(ptype1->getBasicType()); - const TType *unsignedImage = StaticType::GetForUintImage(ptype1->getBasicType()); - - // GLSL ES 3.10, Revision 4, 8.12 Image Functions - if (rvalue->getBasicType() == EbtGVec4) - { - // imageLoad - insertBuiltIn(level, floatType, name, floatImage, ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, intType, name, intImage, ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, unsignedType, name, unsignedImage, ptype2, ptype3, ptype4, ptype5); - } - else if (rvalue->getBasicType() == EbtVoid) - { - // imageStore - insertBuiltIn(level, rvalue, name, floatImage, ptype2, floatType, ptype4, ptype5); - insertBuiltIn(level, rvalue, name, intImage, ptype2, intType, ptype4, ptype5); - insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, unsignedType, ptype4, ptype5); - } - else - { - // imageSize - insertBuiltIn(level, rvalue, name, floatImage, ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, rvalue, name, intImage, ptype2, ptype3, ptype4, ptype5); - insertBuiltIn(level, rvalue, name, unsignedImage, ptype2, ptype3, ptype4, ptype5); - } - } - else if (IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3) || - IsGenType(ptype4)) - { - ASSERT(!ptype5); - insertUnmangledBuiltIn(name, ext, level); - insertBuiltIn(level, op, ext, SpecificType(rvalue, 1), name, SpecificType(ptype1, 1), - SpecificType(ptype2, 1), SpecificType(ptype3, 1), SpecificType(ptype4, 1)); - insertBuiltIn(level, op, ext, SpecificType(rvalue, 2), name, SpecificType(ptype1, 2), - SpecificType(ptype2, 2), SpecificType(ptype3, 2), SpecificType(ptype4, 2)); - insertBuiltIn(level, op, ext, SpecificType(rvalue, 3), name, SpecificType(ptype1, 3), - SpecificType(ptype2, 3), SpecificType(ptype3, 3), SpecificType(ptype4, 3)); - insertBuiltIn(level, op, ext, SpecificType(rvalue, 4), name, SpecificType(ptype1, 4), - SpecificType(ptype2, 4), SpecificType(ptype3, 4), SpecificType(ptype4, 4)); - } - else if (IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3)) - { - ASSERT(!ptype4 && !ptype5); - insertUnmangledBuiltIn(name, ext, level); - insertBuiltIn(level, op, ext, VectorType(rvalue, 2), name, VectorType(ptype1, 2), - VectorType(ptype2, 2), VectorType(ptype3, 2)); - insertBuiltIn(level, op, ext, VectorType(rvalue, 3), name, VectorType(ptype1, 3), - VectorType(ptype2, 3), VectorType(ptype3, 3)); - insertBuiltIn(level, op, ext, VectorType(rvalue, 4), name, VectorType(ptype1, 4), - VectorType(ptype2, 4), VectorType(ptype3, 4)); - } - else - { - size_t paramCount = 1; - TConstParameter *params = new TConstParameter[5]; - new (params) TConstParameter(ptype1); - - if (ptype2) - { - new (params + 1) TConstParameter(ptype2); - paramCount = 2; - } - if (ptype3) - { - new (params + 2) TConstParameter(ptype3); - paramCount = 3; - } - if (ptype4) - { - new (params + 3) TConstParameter(ptype4); - paramCount = 4; - } - if (ptype5) - { - new (params + 4) TConstParameter(ptype5); - paramCount = 5; - } - TFunction *function = - new TFunction(this, ImmutableString(name), ext, params, paramCount, rvalue, op, false); - - ASSERT(hasUnmangledBuiltInAtLevel(name, level)); - insert(level, function); - } -} - -void TSymbolTable::insertBuiltInOp(ESymbolLevel level, - TOperator op, - const TType *rvalue, - const TType *ptype1, - const TType *ptype2, - const TType *ptype3, - const TType *ptype4, - const TType *ptype5) -{ - const char *name = GetOperatorString(op); - ASSERT(strlen(name) > 0); - insertUnmangledBuiltIn(name, TExtension::UNDEFINED, level); - insertBuiltIn(level, op, TExtension::UNDEFINED, rvalue, name, ptype1, ptype2, ptype3, ptype4, - ptype5); -} - -void TSymbolTable::insertBuiltInOp(ESymbolLevel level, - TOperator op, - TExtension ext, - const TType *rvalue, - const TType *ptype1, - const TType *ptype2, - const TType *ptype3, - const TType *ptype4, - const TType *ptype5) -{ - const char *name = GetOperatorString(op); - insertUnmangledBuiltIn(name, ext, level); - insertBuiltIn(level, op, ext, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5); -} - -void TSymbolTable::insertBuiltInFunctionNoParameters(ESymbolLevel level, - TOperator op, - const TType *rvalue, - const char *name) -{ - insertUnmangledBuiltIn(name, TExtension::UNDEFINED, level); - insert(level, new TFunction(this, ImmutableString(name), TExtension::UNDEFINED, nullptr, 0, - rvalue, op, false)); -} - -void TSymbolTable::insertBuiltInFunctionNoParametersExt(ESymbolLevel level, - TExtension ext, - TOperator op, - const TType *rvalue, - const char *name) -{ - insertUnmangledBuiltIn(name, ext, level); - insert(level, new TFunction(this, ImmutableString(name), ext, nullptr, 0, rvalue, op, false)); -} - void TSymbolTable::setDefaultPrecision(TBasicType type, TPrecision prec) { int indexOfLastElement = static_cast(mPrecisionStack.size()) - 1; @@ -735,55 +296,11 @@ void TSymbolTable::setGlobalInvariant(bool invariant) mTable.back()->setGlobalInvariant(invariant); } -void TSymbolTable::insertUnmangledBuiltIn(const char *name, TExtension ext, ESymbolLevel level) -{ - ASSERT(level >= 0 && level <= LAST_BUILTIN_LEVEL); - ASSERT(mUserDefinedUniqueIdsStart == -1); - mBuiltInTable[level]->insertUnmangledBuiltIn(name, ext); -} - -bool TSymbolTable::hasUnmangledBuiltInAtLevel(const char *name, ESymbolLevel level) -{ - ASSERT(level >= 0 && level <= LAST_BUILTIN_LEVEL); - return mBuiltInTable[level]->getUnmangledBuiltIn(ImmutableString(name)) != nullptr; -} - -const UnmangledBuiltIn *TSymbolTable::getUnmangledBuiltInForShaderVersion( - const ImmutableString &name, - int shaderVersion) -{ - for (int level = LAST_BUILTIN_LEVEL; level >= 0; --level) - { - if (level == ESSL3_1_BUILTINS && shaderVersion != 310) - { - --level; - } - if (level == ESSL3_BUILTINS && shaderVersion < 300) - { - --level; - } - if (level == ESSL1_BUILTINS && shaderVersion != 100) - { - --level; - } - - const UnmangledBuiltIn *builtIn = mBuiltInTable[level]->getUnmangledBuiltIn(name); - if (builtIn != nullptr) - { - return builtIn; - } - } - return nullptr; -} - -void TSymbolTable::markBuiltInInitializationFinished() -{ - mUserDefinedUniqueIdsStart = mUniqueIdCounter; -} - void TSymbolTable::clearCompilationResults() { - mUniqueIdCounter = mUserDefinedUniqueIdsStart; + mUniqueIdCounter = kLastBuiltInId + 1; + mVariableMetadata.clear(); + mGlInVariableWithArraySize = nullptr; // User-defined scopes should have already been cleared when the compilation finished. ASSERT(mTable.size() == 0u); @@ -799,12 +316,8 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type, ShShaderSpec spec, const ShBuiltInResources &resources) { - ASSERT(isEmpty()); - pushBuiltInLevel(); // COMMON_BUILTINS - pushBuiltInLevel(); // ESSL1_BUILTINS - pushBuiltInLevel(); // ESSL3_BUILTINS - pushBuiltInLevel(); // ESSL3_1_BUILTINS - pushBuiltInLevel(); // GLSL_BUILTINS + mShaderType = type; + mResources = resources; // We need just one precision stack level for predefined precisions. mPrecisionStack.push_back(std::unique_ptr(new PrecisionStackLevel)); @@ -837,986 +350,18 @@ void TSymbolTable::initializeBuiltIns(sh::GLenum type, setDefaultPrecision(EbtAtomicCounter, EbpHigh); - initializeBuiltInFunctions(type); initializeBuiltInVariables(type, spec, resources); - markBuiltInInitializationFinished(); + mUniqueIdCounter = kLastBuiltInId + 1; } void TSymbolTable::initSamplerDefaultPrecision(TBasicType samplerType) { - ASSERT(samplerType > EbtGuardSamplerBegin && samplerType < EbtGuardSamplerEnd); + ASSERT(samplerType >= EbtGuardSamplerBegin && samplerType <= EbtGuardSamplerEnd); setDefaultPrecision(samplerType, EbpLow); } -void TSymbolTable::initializeBuiltInFunctions(sh::GLenum type) +TSymbolTable::VariableMetadata::VariableMetadata() : staticRead(false), staticWrite(false) { - const TType *voidType = StaticType::GetBasic(); - const TType *float1 = StaticType::GetBasic(); - const TType *float2 = StaticType::GetBasic(); - const TType *float3 = StaticType::GetBasic(); - const TType *float4 = StaticType::GetBasic(); - const TType *int1 = StaticType::GetBasic(); - const TType *int2 = StaticType::GetBasic(); - const TType *int3 = StaticType::GetBasic(); - const TType *uint1 = StaticType::GetBasic(); - const TType *bool1 = StaticType::GetBasic(); - const TType *genType = StaticType::GetBasic(); - const TType *genIType = StaticType::GetBasic(); - const TType *genUType = StaticType::GetBasic(); - const TType *genBType = StaticType::GetBasic(); - - // - // Angle and Trigonometric Functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpRadians, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpDegrees, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpSin, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpCos, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpTan, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpAsin, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpAcos, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpAtan, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpAtan, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpSinh, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpCosh, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpTanh, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpAsinh, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpAcosh, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpAtanh, genType, genType); - - // - // Exponential Functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpPow, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpExp, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpLog, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpExp2, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpLog2, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpSqrt, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpInversesqrt, genType, genType); - - // - // Common Functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpAbs, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpAbs, genIType, genIType); - insertBuiltInOp(COMMON_BUILTINS, EOpSign, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpSign, genIType, genIType); - insertBuiltInOp(COMMON_BUILTINS, EOpFloor, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpTrunc, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpRound, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpRoundEven, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpCeil, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpFract, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpMod, genType, genType, float1); - insertBuiltInOp(COMMON_BUILTINS, EOpMod, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpMin, genType, genType, float1); - insertBuiltInOp(COMMON_BUILTINS, EOpMin, genType, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genIType, genIType, genIType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genIType, genIType, int1); - insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genUType, genUType, genUType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMin, genUType, genUType, uint1); - insertBuiltInOp(COMMON_BUILTINS, EOpMax, genType, genType, float1); - insertBuiltInOp(COMMON_BUILTINS, EOpMax, genType, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genIType, genIType, genIType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genIType, genIType, int1); - insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genUType, genUType, genUType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMax, genUType, genUType, uint1); - insertBuiltInOp(COMMON_BUILTINS, EOpClamp, genType, genType, float1, float1); - insertBuiltInOp(COMMON_BUILTINS, EOpClamp, genType, genType, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genIType, genIType, int1, int1); - insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genIType, genIType, genIType, genIType); - insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genUType, genUType, uint1, uint1); - insertBuiltInOp(ESSL3_BUILTINS, EOpClamp, genUType, genUType, genUType, genUType); - insertBuiltInOp(COMMON_BUILTINS, EOpMix, genType, genType, genType, float1); - insertBuiltInOp(COMMON_BUILTINS, EOpMix, genType, genType, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpMix, genType, genType, genType, genBType); - insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpStep, genType, float1, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpSmoothstep, genType, float1, float1, genType); - - const TType *outGenType = StaticType::GetQualified(); - const TType *outGenIType = StaticType::GetQualified(); - - insertBuiltInOp(ESSL3_BUILTINS, EOpModf, genType, genType, outGenType); - - insertBuiltInOp(ESSL3_BUILTINS, EOpIsnan, genBType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpIsinf, genBType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, genIType); - insertBuiltInOp(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, genUType); - - insertBuiltInOp(ESSL3_1_BUILTINS, EOpFrexp, genType, genType, outGenIType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpLdexp, genType, genType, genIType); - - insertBuiltInOp(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, uint1); - insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, uint1); - insertBuiltInOp(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, uint1); - - insertBuiltInOp(ESSL3_1_BUILTINS, EOpPackUnorm4x8, uint1, float4); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpPackSnorm4x8, uint1, float4); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpUnpackUnorm4x8, float4, uint1); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpUnpackSnorm4x8, float4, uint1); - - // - // Geometric Functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpLength, float1, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpDistance, float1, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpDot, float1, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpCross, float3, float3, float3); - insertBuiltInOp(COMMON_BUILTINS, EOpNormalize, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpFaceforward, genType, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpReflect, genType, genType, genType); - insertBuiltInOp(COMMON_BUILTINS, EOpRefract, genType, genType, genType, float1); - - const TType *mat2 = StaticType::GetBasic(); - const TType *mat3 = StaticType::GetBasic(); - const TType *mat4 = StaticType::GetBasic(); - const TType *mat2x3 = StaticType::GetBasic(); - const TType *mat3x2 = StaticType::GetBasic(); - const TType *mat2x4 = StaticType::GetBasic(); - const TType *mat4x2 = StaticType::GetBasic(); - const TType *mat3x4 = StaticType::GetBasic(); - const TType *mat4x3 = StaticType::GetBasic(); - - // - // Matrix Functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat2, mat2, mat2); - insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat3, mat3, mat3); - insertBuiltInOp(COMMON_BUILTINS, EOpMulMatrixComponentWise, mat4, mat4, mat4); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x3, mat2x3, mat2x3); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x2, mat3x2, mat3x2); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat2x4, mat2x4, mat2x4); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x2, mat4x2, mat4x2); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat3x4, mat3x4, mat3x4); - insertBuiltInOp(ESSL3_BUILTINS, EOpMulMatrixComponentWise, mat4x3, mat4x3, mat4x3); - - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2, float2, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3, float3, float3); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4, float4, float4); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, float3, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, float2, float3); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, float4, float2); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, float2, float4); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, float4, float3); - insertBuiltInOp(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, float3, float4); - - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2, mat2); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3, mat3); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4, mat4); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2x3, mat3x2); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3x2, mat2x3); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat2x4, mat4x2); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4x2, mat2x4); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat3x4, mat4x3); - insertBuiltInOp(ESSL3_BUILTINS, EOpTranspose, mat4x3, mat3x4); - - insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat2); - insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat3); - insertBuiltInOp(ESSL3_BUILTINS, EOpDeterminant, float1, mat4); - - insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat2, mat2); - insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat3, mat3); - insertBuiltInOp(ESSL3_BUILTINS, EOpInverse, mat4, mat4); - - const TType *vec = StaticType::GetBasic(); - const TType *ivec = StaticType::GetBasic(); - const TType *uvec = StaticType::GetBasic(); - const TType *bvec = StaticType::GetBasic(); - - // - // Vector relational functions. - // - insertBuiltInOp(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpLessThanComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpLessThanComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpLessThanEqualComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpLessThanEqualComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpGreaterThanComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpGreaterThanEqualComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpEqualComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpEqualComponentWise, bvec, bvec, bvec); - insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, vec, vec); - insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, ivec, ivec); - insertBuiltInOp(ESSL3_BUILTINS, EOpNotEqualComponentWise, bvec, uvec, uvec); - insertBuiltInOp(COMMON_BUILTINS, EOpNotEqualComponentWise, bvec, bvec, bvec); - insertBuiltInOp(COMMON_BUILTINS, EOpAny, bool1, bvec); - insertBuiltInOp(COMMON_BUILTINS, EOpAll, bool1, bvec); - insertBuiltInOp(COMMON_BUILTINS, EOpLogicalNotComponentWise, bvec, bvec); - - // - // Integer functions - // - const TType *outGenUType = StaticType::GetQualified(); - - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldExtract, genIType, genIType, int1, int1); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldExtract, genUType, genUType, int1, int1); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldInsert, genIType, genIType, genIType, int1, int1); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldInsert, genUType, genUType, genUType, int1, int1); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldReverse, genIType, genIType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitfieldReverse, genUType, genUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitCount, genIType, genIType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpBitCount, genIType, genUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindLSB, genIType, genIType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindLSB, genIType, genUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindMSB, genIType, genIType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpFindMSB, genIType, genUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpUaddCarry, genUType, genUType, genUType, outGenUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpUsubBorrow, genUType, genUType, genUType, outGenUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpUmulExtended, voidType, genUType, genUType, outGenUType, - outGenUType); - insertBuiltInOp(ESSL3_1_BUILTINS, EOpImulExtended, voidType, genIType, genIType, outGenIType, - outGenIType); - - const TType *sampler2D = StaticType::GetBasic(); - const TType *samplerCube = StaticType::GetBasic(); - const TType *samplerExternalOES = StaticType::GetBasic(); - - // - // Texture Functions for GLSL ES 1.0 - // - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4); - insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3); - - // These are extension functions from OES_EGL_image_external and - // NV_EGL_stream_consumer_external. We don't have a way to mark a built-in with two alternative - // extensions, so these are marked with none. This is fine, since these functions overload core - // function names and the functions require a samplerExternalOES parameter, which can only be - // created if one of the extensions is enabled. - // TODO(oetuaho): Consider implementing a cleaner solution. - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4); - - // Note that ARB_texture_rectangle extension directive defaults to enabled in case the extension - // is supported. The symbols are still conditional on the extension. - const TType *sampler2DRect = StaticType::GetBasic(); - insertBuiltIn(ESSL1_BUILTINS, TExtension::ARB_texture_rectangle, float4, "texture2DRect", - sampler2DRect, float2); - insertBuiltIn(ESSL1_BUILTINS, TExtension::ARB_texture_rectangle, float4, "texture2DRectProj", - sampler2DRect, float3); - insertBuiltIn(ESSL1_BUILTINS, TExtension::ARB_texture_rectangle, float4, "texture2DRectProj", - sampler2DRect, float4); - - /* The *Grad* variants are new to both vertex and fragment shaders; the fragment - * shader specific pieces are added separately below. - */ - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, "texture2DGradEXT", - sampler2D, float2, float2, float2); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, - "texture2DProjGradEXT", sampler2D, float3, float2, float2); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, - "texture2DProjGradEXT", sampler2D, float4, float2, float2); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, "textureCubeGradEXT", - samplerCube, float3, float3, float3); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, float1); - - insertBuiltInOp(ESSL1_BUILTINS, EOpDFdx, TExtension::OES_standard_derivatives, genType, - genType); - insertBuiltInOp(ESSL1_BUILTINS, EOpDFdy, TExtension::OES_standard_derivatives, genType, - genType); - insertBuiltInOp(ESSL1_BUILTINS, EOpFwidth, TExtension::OES_standard_derivatives, genType, - genType); - - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, "texture2DLodEXT", - sampler2D, float2, float1); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, - "texture2DProjLodEXT", sampler2D, float3, float1); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, - "texture2DProjLodEXT", sampler2D, float4, float1); - insertBuiltIn(ESSL1_BUILTINS, TExtension::EXT_shader_texture_lod, float4, - "textureCubeLodEXT", samplerCube, float3, float1); - } - - if (type == GL_VERTEX_SHADER) - { - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1); - insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1); - } - - const TType *gvec4 = StaticType::GetBasic(); - - const TType *gsampler2D = StaticType::GetBasic(); - const TType *gsamplerCube = StaticType::GetBasic(); - const TType *gsampler3D = StaticType::GetBasic(); - const TType *gsampler2DArray = StaticType::GetBasic(); - const TType *gsampler2DMS = StaticType::GetBasic(); - - // - // Texture Functions for GLSL ES 3.0 - // - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, "texture", - samplerExternalOES, float2); - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, "textureProj", - samplerExternalOES, float3); - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, "textureProj", - samplerExternalOES, float4); - - const TType *samplerExternal2DY2YEXT = StaticType::GetBasic(); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texture", - samplerExternal2DY2YEXT, float2); - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj", - samplerExternal2DY2YEXT, float3); - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj", - samplerExternal2DY2YEXT, float4); - - const TType *yuvCscStandardEXT = StaticType::GetBasic(); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float3, "rgb_2_yuv", float3, - yuvCscStandardEXT); - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float3, "yuv_2_rgb", float3, - yuvCscStandardEXT); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, "texture", - samplerExternalOES, float2, float1); - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, - "textureProj", samplerExternalOES, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, - "textureProj", samplerExternalOES, float4, float1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texture", - samplerExternal2DY2YEXT, float2, float1); - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj", - samplerExternal2DY2YEXT, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "textureProj", - samplerExternal2DY2YEXT, float4, float1); - } - - const TType *sampler2DShadow = StaticType::GetBasic(); - const TType *samplerCubeShadow = StaticType::GetBasic(); - const TType *sampler2DArrayShadow = StaticType::GetBasic(); - - insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3); - insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4); - insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, float1); - } - - insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1); - insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1); - insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1); - insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1); - insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1); - insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1); - insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1); - insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2DMS); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, int2, "textureSize", - samplerExternalOES, int1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, int2, "textureSize", - samplerExternal2DY2YEXT, int1); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltInOp(ESSL3_BUILTINS, EOpDFdx, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpDFdy, genType, genType); - insertBuiltInOp(ESSL3_BUILTINS, EOpFwidth, genType, genType); - } - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2, - float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2, - float1); - } - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2); - - if (type == GL_FRAGMENT_SHADER) - { - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3, float1); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2, - float1); - } - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, - int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, - int2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::OES_EGL_image_external_essl3, float4, "texelFetch", - samplerExternalOES, int2, int1); - - insertBuiltIn(ESSL3_BUILTINS, TExtension::EXT_YUV_target, float4, "texelFetch", - samplerExternal2DY2YEXT, int2, int1); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, int3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, int1, int2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, float2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, float3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, float2, float2); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, float3, float3); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, float2); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, float2, - float2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, float2, float2, - int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, float3, float3, - int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, float2, - float2, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, float2, - float2, int2); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, float4, float2, - float2, int2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, float2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, float2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, float3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, float2, - float2); - - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, float2, - float2, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, float2, - float2, int2); - insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, float3, - float3, int3); - insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, float4, float2, - float2, int2); - - const TType *atomicCounter = StaticType::GetBasic(); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounter", atomicCounter); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounterIncrement", atomicCounter); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCounterDecrement", atomicCounter); - - // Insert all atomic memory functions - const TType *int1InOut = StaticType::GetQualified(); - const TType *uint1InOut = StaticType::GetQualified(); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicAdd", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicAdd", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicMin", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicMin", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicMax", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicMax", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicAnd", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicAnd", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicOr", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicOr", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicXor", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicXor", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicExchange", uint1InOut, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicExchange", int1InOut, int1); - insertBuiltIn(ESSL3_1_BUILTINS, uint1, "atomicCompSwap", uint1InOut, uint1, uint1); - insertBuiltIn(ESSL3_1_BUILTINS, int1, "atomicCompSwap", int1InOut, int1, int1); - - const TType *gimage2D = StaticType::GetBasic(); - const TType *gimage3D = StaticType::GetBasic(); - const TType *gimage2DArray = StaticType::GetBasic(); - const TType *gimageCube = StaticType::GetBasic(); - - insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2D, int2, gvec4); - insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage3D, int3, gvec4); - insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimage2DArray, int3, gvec4); - insertBuiltIn(ESSL3_1_BUILTINS, voidType, "imageStore", gimageCube, int3, gvec4); - - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2D, int2); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage3D, int3); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimage2DArray, int3); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "imageLoad", gimageCube, int3); - - insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimage2D); - insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage3D); - insertBuiltIn(ESSL3_1_BUILTINS, int3, "imageSize", gimage2DArray); - insertBuiltIn(ESSL3_1_BUILTINS, int2, "imageSize", gimageCube); - - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrier, voidType, - "memoryBarrier"); - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierAtomicCounter, voidType, - "memoryBarrierAtomicCounter"); - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierBuffer, voidType, - "memoryBarrierBuffer"); - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierImage, voidType, - "memoryBarrierImage"); - - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "texelFetch", gsampler2DMS, int2, int1); - - // Insert all variations of textureGather. - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2D, float2); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2D, float2, int1); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2DArray, float3); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsampler2DArray, float3, int1); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsamplerCube, float3); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGather", gsamplerCube, float3, int1); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DShadow, float2); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DShadow, float2, float1); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DArrayShadow, float3); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", sampler2DArrayShadow, float3, float1); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", samplerCubeShadow, float3); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGather", samplerCubeShadow, float3, float1); - - // Insert all variations of textureGatherOffset. - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2D, float2, int2); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2D, float2, int2, int1); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2DArray, float3, int2); - insertBuiltIn(ESSL3_1_BUILTINS, gvec4, "textureGatherOffset", gsampler2DArray, float3, int2, - int1); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGatherOffset", sampler2DShadow, float2, float1, - int2); - insertBuiltIn(ESSL3_1_BUILTINS, float4, "textureGatherOffset", sampler2DArrayShadow, float3, - float1, int2); - - if (type == GL_COMPUTE_SHADER) - { - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpBarrier, voidType, "barrier"); - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpMemoryBarrierShared, voidType, - "memoryBarrierShared"); - insertBuiltInFunctionNoParameters(ESSL3_1_BUILTINS, EOpGroupMemoryBarrier, voidType, - "groupMemoryBarrier"); - } - - if (type == GL_GEOMETRY_SHADER_EXT) - { - TExtension extension = TExtension::EXT_geometry_shader; - insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, EOpEmitVertex, voidType, - "EmitVertex"); - insertBuiltInFunctionNoParametersExt(ESSL3_1_BUILTINS, extension, EOpEndPrimitive, voidType, - "EndPrimitive"); - } -} - -void TSymbolTable::initializeBuiltInVariables(sh::GLenum type, - ShShaderSpec spec, - const ShBuiltInResources &resources) -{ - const TSourceLoc zeroSourceLoc = {0, 0, 0, 0}; - - // - // Depth range in window coordinates - // - TFieldList *fields = new TFieldList(); - auto highpFloat1 = new TType(EbtFloat, EbpHigh, EvqGlobal, 1); - TField *near = new TField(highpFloat1, ImmutableString("near"), zeroSourceLoc); - TField *far = new TField(highpFloat1, ImmutableString("far"), zeroSourceLoc); - TField *diff = new TField(highpFloat1, ImmutableString("diff"), zeroSourceLoc); - fields->push_back(near); - fields->push_back(far); - fields->push_back(diff); - TStructure *depthRangeStruct = new TStructure(this, ImmutableString("gl_DepthRangeParameters"), - fields, SymbolType::BuiltIn); - insertStructType(COMMON_BUILTINS, depthRangeStruct); - TType *depthRangeType = new TType(depthRangeStruct); - depthRangeType->setQualifier(EvqUniform); - depthRangeType->realize(); - insertVariable(COMMON_BUILTINS, ImmutableString("gl_DepthRange"), depthRangeType); - - // - // Implementation dependent built-in constants. - // - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxVertexAttribs"), - resources.MaxVertexAttribs); - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxVertexUniformVectors"), - resources.MaxVertexUniformVectors); - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxVertexTextureImageUnits"), - resources.MaxVertexTextureImageUnits); - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxCombinedTextureImageUnits"), - resources.MaxCombinedTextureImageUnits); - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxTextureImageUnits"), - resources.MaxTextureImageUnits); - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxFragmentUniformVectors"), - resources.MaxFragmentUniformVectors); - - insertConstInt(ESSL1_BUILTINS, ImmutableString("gl_MaxVaryingVectors"), - resources.MaxVaryingVectors); - - insertConstInt(COMMON_BUILTINS, ImmutableString("gl_MaxDrawBuffers"), - resources.MaxDrawBuffers); - insertConstIntExt(COMMON_BUILTINS, TExtension::EXT_blend_func_extended, - ImmutableString("gl_MaxDualSourceDrawBuffersEXT"), - resources.MaxDualSourceDrawBuffers); - - insertConstInt(ESSL3_BUILTINS, ImmutableString("gl_MaxVertexOutputVectors"), - resources.MaxVertexOutputVectors); - insertConstInt(ESSL3_BUILTINS, ImmutableString("gl_MaxFragmentInputVectors"), - resources.MaxFragmentInputVectors); - insertConstInt(ESSL3_BUILTINS, ImmutableString("gl_MinProgramTexelOffset"), - resources.MinProgramTexelOffset); - insertConstInt(ESSL3_BUILTINS, ImmutableString("gl_MaxProgramTexelOffset"), - resources.MaxProgramTexelOffset); - - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxImageUnits"), - resources.MaxImageUnits); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxVertexImageUniforms"), - resources.MaxVertexImageUniforms); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxFragmentImageUniforms"), - resources.MaxFragmentImageUniforms); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeImageUniforms"), - resources.MaxComputeImageUniforms); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxCombinedImageUniforms"), - resources.MaxCombinedImageUniforms); - - insertConstInt(ESSL3_1_BUILTINS, - ImmutableString("gl_MaxCombinedShaderOutputResources"), - resources.MaxCombinedShaderOutputResources); - - insertConstIvec3(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeWorkGroupCount"), - resources.MaxComputeWorkGroupCount); - insertConstIvec3(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeWorkGroupSize"), - resources.MaxComputeWorkGroupSize); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeUniformComponents"), - resources.MaxComputeUniformComponents); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeTextureImageUnits"), - resources.MaxComputeTextureImageUnits); - - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxComputeAtomicCounters"), - resources.MaxComputeAtomicCounters); - insertConstInt(ESSL3_1_BUILTINS, - ImmutableString("gl_MaxComputeAtomicCounterBuffers"), - resources.MaxComputeAtomicCounterBuffers); - - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxVertexAtomicCounters"), - resources.MaxVertexAtomicCounters); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxFragmentAtomicCounters"), - resources.MaxFragmentAtomicCounters); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxCombinedAtomicCounters"), - resources.MaxCombinedAtomicCounters); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxAtomicCounterBindings"), - resources.MaxAtomicCounterBindings); - - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxVertexAtomicCounterBuffers"), - resources.MaxVertexAtomicCounterBuffers); - insertConstInt(ESSL3_1_BUILTINS, - ImmutableString("gl_MaxFragmentAtomicCounterBuffers"), - resources.MaxFragmentAtomicCounterBuffers); - insertConstInt(ESSL3_1_BUILTINS, - ImmutableString("gl_MaxCombinedAtomicCounterBuffers"), - resources.MaxCombinedAtomicCounterBuffers); - insertConstInt(ESSL3_1_BUILTINS, ImmutableString("gl_MaxAtomicCounterBufferSize"), - resources.MaxAtomicCounterBufferSize); - - { - TExtension ext = TExtension::EXT_geometry_shader; - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryInputComponents"), - resources.MaxGeometryInputComponents); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryOutputComponents"), - resources.MaxGeometryOutputComponents); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryImageUniforms"), - resources.MaxGeometryImageUniforms); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryTextureImageUnits"), - resources.MaxGeometryTextureImageUnits); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryOutputVertices"), - resources.MaxGeometryOutputVertices); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryTotalOutputComponents"), - resources.MaxGeometryTotalOutputComponents); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryUniformComponents"), - resources.MaxGeometryUniformComponents); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryAtomicCounters"), - resources.MaxGeometryAtomicCounters); - insertConstIntExt(ESSL3_1_BUILTINS, ext, - ImmutableString("gl_MaxGeometryAtomicCounterBuffers"), - resources.MaxGeometryAtomicCounterBuffers); - } - - // - // Insert some special built-in variables that are not in - // the built-in header files. - // - - if (resources.OVR_multiview && type != GL_COMPUTE_SHADER) - { - const TType *viewIDType = StaticType::Get(); - insertVariableExt(ESSL3_BUILTINS, TExtension::OVR_multiview, - ImmutableString("gl_ViewID_OVR"), viewIDType); - - // ESSL 1.00 doesn't have unsigned integers, so gl_ViewID_OVR is a signed integer in ESSL - // 1.00. This is specified in the WEBGL_multiview spec. - const TType *viewIDIntType = StaticType::Get(); - insertVariableExt(ESSL1_BUILTINS, TExtension::OVR_multiview, - ImmutableString("gl_ViewID_OVR"), viewIDIntType); - } - - const TType *positionType = StaticType::Get(); - const TType *primitiveIDType = StaticType::Get(); - const TType *layerType = StaticType::Get(); - - switch (type) - { - case GL_FRAGMENT_SHADER: - { - const TType *fragCoordType = StaticType::Get(); - insertVariable(COMMON_BUILTINS, ImmutableString("gl_FragCoord"), fragCoordType); - const TType *frontFacingType = StaticType::GetQualified(); - insertVariable(COMMON_BUILTINS, ImmutableString("gl_FrontFacing"), frontFacingType); - const TType *pointCoordType = - StaticType::Get(); - insertVariable(COMMON_BUILTINS, ImmutableString("gl_PointCoord"), pointCoordType); - - const TType *fragColorType = StaticType::Get(); - insertVariable(ESSL1_BUILTINS, ImmutableString("gl_FragColor"), fragColorType); - - TType *fragDataType = new TType(EbtFloat, EbpMedium, EvqFragData, 4); - if (spec != SH_WEBGL2_SPEC && spec != SH_WEBGL3_SPEC) - { - fragDataType->makeArray(resources.MaxDrawBuffers); - } - else - { - fragDataType->makeArray(1u); - } - fragDataType->realize(); - insertVariable(ESSL1_BUILTINS, ImmutableString("gl_FragData"), fragDataType); - - if (resources.EXT_blend_func_extended) - { - const TType *secondaryFragColorType = - StaticType::Get(); - insertVariableExt(ESSL1_BUILTINS, TExtension::EXT_blend_func_extended, - ImmutableString("gl_SecondaryFragColorEXT"), - secondaryFragColorType); - TType *secondaryFragDataType = - new TType(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1); - secondaryFragDataType->makeArray(resources.MaxDualSourceDrawBuffers); - secondaryFragDataType->realize(); - insertVariableExt(ESSL1_BUILTINS, TExtension::EXT_blend_func_extended, - ImmutableString("gl_SecondaryFragDataEXT"), - secondaryFragDataType); - } - - if (resources.EXT_frag_depth) - { - TType *fragDepthEXTType = - new TType(EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, - EvqFragDepthEXT, 1); - fragDepthEXTType->realize(); - insertVariableExt(ESSL1_BUILTINS, TExtension::EXT_frag_depth, - ImmutableString("gl_FragDepthEXT"), fragDepthEXTType); - } - - const TType *fragDepthType = StaticType::Get(); - insertVariable(ESSL3_BUILTINS, ImmutableString("gl_FragDepth"), fragDepthType); - - const TType *lastFragColorType = - StaticType::Get(); - - if (resources.EXT_shader_framebuffer_fetch || resources.NV_shader_framebuffer_fetch) - { - TType *lastFragDataType = new TType(EbtFloat, EbpMedium, EvqLastFragData, 4, 1); - lastFragDataType->makeArray(resources.MaxDrawBuffers); - lastFragDataType->realize(); - - if (resources.EXT_shader_framebuffer_fetch) - { - insertVariableExt(ESSL1_BUILTINS, TExtension::EXT_shader_framebuffer_fetch, - ImmutableString("gl_LastFragData"), lastFragDataType); - } - else if (resources.NV_shader_framebuffer_fetch) - { - insertVariableExt(ESSL1_BUILTINS, TExtension::NV_shader_framebuffer_fetch, - ImmutableString("gl_LastFragColor"), lastFragColorType); - insertVariableExt(ESSL1_BUILTINS, TExtension::NV_shader_framebuffer_fetch, - ImmutableString("gl_LastFragData"), lastFragDataType); - } - } - else if (resources.ARM_shader_framebuffer_fetch) - { - insertVariableExt(ESSL1_BUILTINS, TExtension::ARM_shader_framebuffer_fetch, - ImmutableString("gl_LastFragColorARM"), lastFragColorType); - } - - if (resources.EXT_geometry_shader) - { - TExtension extension = TExtension::EXT_geometry_shader; - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_PrimitiveID"), - primitiveIDType); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_Layer"), - layerType); - } - - break; - } - case GL_VERTEX_SHADER: - { - insertVariable(COMMON_BUILTINS, ImmutableString("gl_Position"), positionType); - const TType *pointSizeType = StaticType::Get(); - insertVariable(COMMON_BUILTINS, ImmutableString("gl_PointSize"), pointSizeType); - const TType *instanceIDType = StaticType::Get(); - insertVariable(ESSL3_BUILTINS, ImmutableString("gl_InstanceID"), instanceIDType); - const TType *vertexIDType = StaticType::Get(); - insertVariable(ESSL3_BUILTINS, ImmutableString("gl_VertexID"), vertexIDType); - - // For internal use by ANGLE - not exposed to the parser. - const TType *viewportIndexType = - StaticType::Get(); - insertVariable(GLSL_BUILTINS, ImmutableString("gl_ViewportIndex"), viewportIndexType); - // gl_Layer exists in other shader stages in ESSL, but not in vertex shader so far. - insertVariable(GLSL_BUILTINS, ImmutableString("gl_Layer"), layerType); - break; - } - case GL_COMPUTE_SHADER: - { - const TType *numWorkGroupsType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_NumWorkGroups"), - numWorkGroupsType); - const TType *workGroupSizeType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_WorkGroupSize"), - workGroupSizeType); - const TType *workGroupIDType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_WorkGroupID"), workGroupIDType); - const TType *localInvocationIDType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_LocalInvocationID"), - localInvocationIDType); - const TType *globalInvocationIDType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_GlobalInvocationID"), - globalInvocationIDType); - const TType *localInvocationIndexType = - StaticType::Get(); - insertVariable(ESSL3_1_BUILTINS, ImmutableString("gl_LocalInvocationIndex"), - localInvocationIndexType); - break; - } - - case GL_GEOMETRY_SHADER_EXT: - { - TExtension extension = TExtension::EXT_geometry_shader; - - // Add built-in interface block gl_PerVertex and the built-in array gl_in. - // TODO(jiawei.shao@intel.com): implement GL_EXT_geometry_point_size. - TFieldList *glPerVertexFieldList = new TFieldList(); - TField *glPositionField = - new TField(new TType(*positionType), ImmutableString("gl_Position"), zeroSourceLoc); - glPerVertexFieldList->push_back(glPositionField); - - const ImmutableString glPerVertexString("gl_PerVertex"); - TInterfaceBlock *glPerVertexInBlock = - new TInterfaceBlock(this, glPerVertexString, glPerVertexFieldList, - TLayoutQualifier::Create(), SymbolType::BuiltIn, extension); - insertInterfaceBlock(ESSL3_1_BUILTINS, glPerVertexInBlock); - - // The array size of gl_in is undefined until we get a valid input primitive - // declaration. - TType *glInType = - new TType(glPerVertexInBlock, EvqPerVertexIn, TLayoutQualifier::Create()); - glInType->makeArray(0u); - glInType->realize(); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_in"), glInType); - - TInterfaceBlock *glPerVertexOutBlock = - new TInterfaceBlock(this, glPerVertexString, glPerVertexFieldList, - TLayoutQualifier::Create(), SymbolType::BuiltIn); - TType *glPositionInBlockType = new TType(EbtFloat, EbpHigh, EvqPosition, 4); - glPositionInBlockType->setInterfaceBlock(glPerVertexOutBlock); - glPositionInBlockType->realize(); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_Position"), - glPositionInBlockType); - - const TType *primitiveIDInType = - StaticType::Get(); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_PrimitiveIDIn"), - primitiveIDInType); - const TType *invocationIDType = - StaticType::Get(); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_InvocationID"), - invocationIDType); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_PrimitiveID"), - primitiveIDType); - insertVariableExt(ESSL3_1_BUILTINS, extension, ImmutableString("gl_Layer"), layerType); - - break; - } - default: - UNREACHABLE(); - } } } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable.h b/gfx/angle/checkout/src/compiler/translator/SymbolTable.h index eff63d4d7115..e3667c623e4d 100644 --- a/gfx/angle/checkout/src/compiler/translator/SymbolTable.h +++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable.h @@ -30,7 +30,6 @@ // are tracked in the intermediate representation, not the symbol table. // -#include #include #include "common/angleutils.h" @@ -39,13 +38,12 @@ #include "compiler/translator/InfoSink.h" #include "compiler/translator/IntermNode.h" #include "compiler/translator/Symbol.h" +#include "compiler/translator/SymbolTable_autogen.h" namespace sh { -// Define ESymbolLevel as int rather than an enum since level can go -// above GLOBAL_LEVEL and cause atBuiltInLevel() to fail if the -// compiler optimizes the >= of the last element to ==. +// Define ESymbolLevel as int rather than an enum so that we can do arithmetic on it. typedef int ESymbolLevel; const int COMMON_BUILTINS = 0; const int ESSL1_BUILTINS = 1; @@ -55,18 +53,15 @@ const int ESSL3_1_BUILTINS = 3; // features in ANGLE's GLSL backend. They're not visible to the parser. const int GLSL_BUILTINS = 4; const int LAST_BUILTIN_LEVEL = GLSL_BUILTINS; -const int GLOBAL_LEVEL = 5; struct UnmangledBuiltIn { - constexpr UnmangledBuiltIn() : extension(TExtension::UNDEFINED) {} - constexpr UnmangledBuiltIn(TExtension extension) : extension(extension) {} TExtension extension; }; -class TSymbolTable : angle::NonCopyable +class TSymbolTable : angle::NonCopyable, TSymbolTableBase { public: TSymbolTable(); @@ -76,22 +71,16 @@ class TSymbolTable : angle::NonCopyable ~TSymbolTable(); - // When the symbol table is initialized with the built-ins, there should - // 'push' calls, so that built-ins are at level 0 and the shader - // globals are at level 1. - bool isEmpty() const { return mTable.empty(); } - bool atBuiltInLevel() const { return currentLevel() <= LAST_BUILTIN_LEVEL; } - bool atGlobalLevel() const { return currentLevel() == GLOBAL_LEVEL; } + bool isEmpty() const; + bool atGlobalLevel() const; void push(); void pop(); - // The declare* entry points are used when parsing and declare symbols at the current scope. - // They return the created true in case the declaration was successful, and false if the - // declaration failed due to redefinition. - bool declareVariable(TVariable *variable); - bool declareStructType(TStructure *str); - bool declareInterfaceBlock(TInterfaceBlock *interfaceBlock); + // Declare a non-function symbol at the current scope. Return true in case the declaration was + // successful, and false if the declaration failed due to redefinition. + bool declare(TSymbol *symbol); + // Functions are always declared at global scope. void declareUserDefinedFunction(TFunction *function, bool insertUnmangledName); @@ -101,6 +90,19 @@ class TSymbolTable : angle::NonCopyable const TFunction *setFunctionParameterNamesFromDefinition(const TFunction *function, bool *wasDefinedOut); + // Return false if the gl_in array size has already been initialized with a mismatching value. + bool setGlInArraySize(unsigned int inputArraySize); + TVariable *getGlInVariableWithArraySize() const; + + const TVariable *gl_FragData() const; + const TVariable *gl_SecondaryFragDataEXT() const; + + void markStaticRead(const TVariable &variable); + void markStaticWrite(const TVariable &variable); + + // Note: Should not call this for constant variables. + bool isStaticallyUsed(const TVariable &variable) const; + // find() is guaranteed not to retain a reference to the ImmutableString, so an ImmutableString // with a reference to a short-lived char * is fine to pass here. const TSymbol *find(const ImmutableString &name, int shaderVersion) const; @@ -109,10 +111,6 @@ class TSymbolTable : angle::NonCopyable const TSymbol *findBuiltIn(const ImmutableString &name, int shaderVersion) const; - const TSymbol *findBuiltIn(const ImmutableString &name, - int shaderVersion, - bool includeGLSLBuiltins) const; - void setDefaultPrecision(TBasicType type, TPrecision prec); // Searches down the precisionStack for a precision qualifier @@ -146,138 +144,16 @@ class TSymbolTable : angle::NonCopyable friend class TSymbolUniqueId; int nextUniqueIdValue(); - class TSymbolTableBuiltInLevel; class TSymbolTableLevel; - void pushBuiltInLevel(); - - ESymbolLevel currentLevel() const - { - return static_cast(mTable.size() + LAST_BUILTIN_LEVEL); - } - - // The insert* entry points are used when initializing the symbol table with built-ins. - // They return the created symbol / true in case the declaration was successful, and nullptr / - // false if the declaration failed due to redefinition. - TVariable *insertVariable(ESymbolLevel level, const ImmutableString &name, const TType *type); - void insertVariableExt(ESymbolLevel level, - TExtension ext, - const ImmutableString &name, - const TType *type); - bool insertVariable(ESymbolLevel level, TVariable *variable); - bool insertStructType(ESymbolLevel level, TStructure *str); - bool insertInterfaceBlock(ESymbolLevel level, TInterfaceBlock *interfaceBlock); - - template - bool insertConstInt(ESymbolLevel level, const ImmutableString &name, int value); - - template - bool insertConstIntExt(ESymbolLevel level, - TExtension ext, - const ImmutableString &name, - int value); - - template - bool insertConstIvec3(ESymbolLevel level, - const ImmutableString &name, - const std::array &values); - - // Note that for inserted built-in functions the const char *name needs to remain valid for the - // lifetime of the SymbolTable. SymbolTable does not allocate a copy of it. - void insertBuiltIn(ESymbolLevel level, - TOperator op, - TExtension ext, - const TType *rvalue, - const char *name, - const TType *ptype1, - const TType *ptype2 = 0, - const TType *ptype3 = 0, - const TType *ptype4 = 0, - const TType *ptype5 = 0); - - void insertBuiltIn(ESymbolLevel level, - const TType *rvalue, - const char *name, - const TType *ptype1, - const TType *ptype2 = 0, - const TType *ptype3 = 0, - const TType *ptype4 = 0, - const TType *ptype5 = 0) - { - insertUnmangledBuiltIn(name, TExtension::UNDEFINED, level); - insertBuiltIn(level, EOpCallBuiltInFunction, TExtension::UNDEFINED, rvalue, name, ptype1, - ptype2, ptype3, ptype4, ptype5); - } - - void insertBuiltIn(ESymbolLevel level, - TExtension ext, - const TType *rvalue, - const char *name, - const TType *ptype1, - const TType *ptype2 = 0, - const TType *ptype3 = 0, - const TType *ptype4 = 0, - const TType *ptype5 = 0) - { - insertUnmangledBuiltIn(name, ext, level); - insertBuiltIn(level, EOpCallBuiltInFunction, ext, rvalue, name, ptype1, ptype2, ptype3, - ptype4, ptype5); - } - - void insertBuiltInOp(ESymbolLevel level, - TOperator op, - const TType *rvalue, - const TType *ptype1, - const TType *ptype2 = 0, - const TType *ptype3 = 0, - const TType *ptype4 = 0, - const TType *ptype5 = 0); - - void insertBuiltInOp(ESymbolLevel level, - TOperator op, - TExtension ext, - const TType *rvalue, - const TType *ptype1, - const TType *ptype2 = 0, - const TType *ptype3 = 0, - const TType *ptype4 = 0, - const TType *ptype5 = 0); - - void insertBuiltInFunctionNoParameters(ESymbolLevel level, - TOperator op, - const TType *rvalue, - const char *name); - - void insertBuiltInFunctionNoParametersExt(ESymbolLevel level, - TExtension ext, - TOperator op, - const TType *rvalue, - const char *name); - - TVariable *insertVariable(ESymbolLevel level, - const ImmutableString &name, - const TType *type, - SymbolType symbolType); - - bool insert(ESymbolLevel level, TSymbol *symbol); - TFunction *findUserDefinedFunction(const ImmutableString &name) const; - // Used to insert unmangled functions to check redeclaration of built-ins in ESSL 3.00 and - // above. - void insertUnmangledBuiltIn(const char *name, TExtension ext, ESymbolLevel level); - - bool hasUnmangledBuiltInAtLevel(const char *name, ESymbolLevel level); - void initSamplerDefaultPrecision(TBasicType samplerType); - void initializeBuiltInFunctions(sh::GLenum type); - void initializeBuiltInVariables(sh::GLenum type, + void initializeBuiltInVariables(sh::GLenum shaderType, ShShaderSpec spec, const ShBuiltInResources &resources); - void markBuiltInInitializationFinished(); - std::vector> mBuiltInTable; std::vector> mTable; // There's one precision stack level for predefined precisions and then one level for each scope @@ -287,10 +163,24 @@ class TSymbolTable : angle::NonCopyable int mUniqueIdCounter; - // -1 before built-in init has finished, one past the last built-in id afterwards. - // TODO(oetuaho): Make this a compile-time constant once the symbol table is initialized at - // compile time. http://anglebug.com/1432 - int mUserDefinedUniqueIdsStart; + static const int kLastBuiltInId; + + sh::GLenum mShaderType; + ShBuiltInResources mResources; + + struct VariableMetadata + { + VariableMetadata(); + bool staticRead; + bool staticWrite; + }; + + // Indexed by unique id. Map instead of vector since the variables are fairly sparse. + std::map mVariableMetadata; + + // Store gl_in variable with its array size once the array size can be determined. The array + // size can also be checked against latter input primitive type declaration. + TVariable *mGlInVariableWithArraySize; }; } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp new file mode 100644 index 000000000000..71cf356df9bf --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.cpp @@ -0,0 +1,20440 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_builtin_symbols.py using data from builtin_variables.json and +// builtin_function_declarations.txt. +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// SymbolTable_autogen.cpp: +// Compile-time initialized built-ins. + +#include "compiler/translator/SymbolTable.h" + +#include "angle_gl.h" +#include "compiler/translator/ImmutableString.h" +#include "compiler/translator/StaticType.h" +#include "compiler/translator/Symbol.h" +#include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" + +namespace sh +{ + +// Since some of the BuiltInId declarations are used outside of constexpr expressions, we need to +// have these definitions without an initializer. C++17 should eventually remove the need for this. +constexpr const TSymbolUniqueId BuiltInId::radians_Float1; +constexpr const TSymbolUniqueId BuiltInId::radians_Float2; +constexpr const TSymbolUniqueId BuiltInId::radians_Float3; +constexpr const TSymbolUniqueId BuiltInId::radians_Float4; +constexpr const TSymbolUniqueId BuiltInId::degrees_Float1; +constexpr const TSymbolUniqueId BuiltInId::degrees_Float2; +constexpr const TSymbolUniqueId BuiltInId::degrees_Float3; +constexpr const TSymbolUniqueId BuiltInId::degrees_Float4; +constexpr const TSymbolUniqueId BuiltInId::sin_Float1; +constexpr const TSymbolUniqueId BuiltInId::sin_Float2; +constexpr const TSymbolUniqueId BuiltInId::sin_Float3; +constexpr const TSymbolUniqueId BuiltInId::sin_Float4; +constexpr const TSymbolUniqueId BuiltInId::cos_Float1; +constexpr const TSymbolUniqueId BuiltInId::cos_Float2; +constexpr const TSymbolUniqueId BuiltInId::cos_Float3; +constexpr const TSymbolUniqueId BuiltInId::cos_Float4; +constexpr const TSymbolUniqueId BuiltInId::tan_Float1; +constexpr const TSymbolUniqueId BuiltInId::tan_Float2; +constexpr const TSymbolUniqueId BuiltInId::tan_Float3; +constexpr const TSymbolUniqueId BuiltInId::tan_Float4; +constexpr const TSymbolUniqueId BuiltInId::asin_Float1; +constexpr const TSymbolUniqueId BuiltInId::asin_Float2; +constexpr const TSymbolUniqueId BuiltInId::asin_Float3; +constexpr const TSymbolUniqueId BuiltInId::asin_Float4; +constexpr const TSymbolUniqueId BuiltInId::acos_Float1; +constexpr const TSymbolUniqueId BuiltInId::acos_Float2; +constexpr const TSymbolUniqueId BuiltInId::acos_Float3; +constexpr const TSymbolUniqueId BuiltInId::acos_Float4; +constexpr const TSymbolUniqueId BuiltInId::atan_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::atan_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::atan_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::atan_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::atan_Float1; +constexpr const TSymbolUniqueId BuiltInId::atan_Float2; +constexpr const TSymbolUniqueId BuiltInId::atan_Float3; +constexpr const TSymbolUniqueId BuiltInId::atan_Float4; +constexpr const TSymbolUniqueId BuiltInId::sinh_Float1; +constexpr const TSymbolUniqueId BuiltInId::sinh_Float2; +constexpr const TSymbolUniqueId BuiltInId::sinh_Float3; +constexpr const TSymbolUniqueId BuiltInId::sinh_Float4; +constexpr const TSymbolUniqueId BuiltInId::cosh_Float1; +constexpr const TSymbolUniqueId BuiltInId::cosh_Float2; +constexpr const TSymbolUniqueId BuiltInId::cosh_Float3; +constexpr const TSymbolUniqueId BuiltInId::cosh_Float4; +constexpr const TSymbolUniqueId BuiltInId::tanh_Float1; +constexpr const TSymbolUniqueId BuiltInId::tanh_Float2; +constexpr const TSymbolUniqueId BuiltInId::tanh_Float3; +constexpr const TSymbolUniqueId BuiltInId::tanh_Float4; +constexpr const TSymbolUniqueId BuiltInId::asinh_Float1; +constexpr const TSymbolUniqueId BuiltInId::asinh_Float2; +constexpr const TSymbolUniqueId BuiltInId::asinh_Float3; +constexpr const TSymbolUniqueId BuiltInId::asinh_Float4; +constexpr const TSymbolUniqueId BuiltInId::acosh_Float1; +constexpr const TSymbolUniqueId BuiltInId::acosh_Float2; +constexpr const TSymbolUniqueId BuiltInId::acosh_Float3; +constexpr const TSymbolUniqueId BuiltInId::acosh_Float4; +constexpr const TSymbolUniqueId BuiltInId::atanh_Float1; +constexpr const TSymbolUniqueId BuiltInId::atanh_Float2; +constexpr const TSymbolUniqueId BuiltInId::atanh_Float3; +constexpr const TSymbolUniqueId BuiltInId::atanh_Float4; +constexpr const TSymbolUniqueId BuiltInId::pow_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::pow_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::pow_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::pow_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::exp_Float1; +constexpr const TSymbolUniqueId BuiltInId::exp_Float2; +constexpr const TSymbolUniqueId BuiltInId::exp_Float3; +constexpr const TSymbolUniqueId BuiltInId::exp_Float4; +constexpr const TSymbolUniqueId BuiltInId::log_Float1; +constexpr const TSymbolUniqueId BuiltInId::log_Float2; +constexpr const TSymbolUniqueId BuiltInId::log_Float3; +constexpr const TSymbolUniqueId BuiltInId::log_Float4; +constexpr const TSymbolUniqueId BuiltInId::exp2_Float1; +constexpr const TSymbolUniqueId BuiltInId::exp2_Float2; +constexpr const TSymbolUniqueId BuiltInId::exp2_Float3; +constexpr const TSymbolUniqueId BuiltInId::exp2_Float4; +constexpr const TSymbolUniqueId BuiltInId::log2_Float1; +constexpr const TSymbolUniqueId BuiltInId::log2_Float2; +constexpr const TSymbolUniqueId BuiltInId::log2_Float3; +constexpr const TSymbolUniqueId BuiltInId::log2_Float4; +constexpr const TSymbolUniqueId BuiltInId::sqrt_Float1; +constexpr const TSymbolUniqueId BuiltInId::sqrt_Float2; +constexpr const TSymbolUniqueId BuiltInId::sqrt_Float3; +constexpr const TSymbolUniqueId BuiltInId::sqrt_Float4; +constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float1; +constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float2; +constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float3; +constexpr const TSymbolUniqueId BuiltInId::inversesqrt_Float4; +constexpr const TSymbolUniqueId BuiltInId::abs_Float1; +constexpr const TSymbolUniqueId BuiltInId::abs_Float2; +constexpr const TSymbolUniqueId BuiltInId::abs_Float3; +constexpr const TSymbolUniqueId BuiltInId::abs_Float4; +constexpr const TSymbolUniqueId BuiltInId::abs_Int1; +constexpr const TSymbolUniqueId BuiltInId::abs_Int2; +constexpr const TSymbolUniqueId BuiltInId::abs_Int3; +constexpr const TSymbolUniqueId BuiltInId::abs_Int4; +constexpr const TSymbolUniqueId BuiltInId::sign_Float1; +constexpr const TSymbolUniqueId BuiltInId::sign_Float2; +constexpr const TSymbolUniqueId BuiltInId::sign_Float3; +constexpr const TSymbolUniqueId BuiltInId::sign_Float4; +constexpr const TSymbolUniqueId BuiltInId::sign_Int1; +constexpr const TSymbolUniqueId BuiltInId::sign_Int2; +constexpr const TSymbolUniqueId BuiltInId::sign_Int3; +constexpr const TSymbolUniqueId BuiltInId::sign_Int4; +constexpr const TSymbolUniqueId BuiltInId::floor_Float1; +constexpr const TSymbolUniqueId BuiltInId::floor_Float2; +constexpr const TSymbolUniqueId BuiltInId::floor_Float3; +constexpr const TSymbolUniqueId BuiltInId::floor_Float4; +constexpr const TSymbolUniqueId BuiltInId::trunc_Float1; +constexpr const TSymbolUniqueId BuiltInId::trunc_Float2; +constexpr const TSymbolUniqueId BuiltInId::trunc_Float3; +constexpr const TSymbolUniqueId BuiltInId::trunc_Float4; +constexpr const TSymbolUniqueId BuiltInId::round_Float1; +constexpr const TSymbolUniqueId BuiltInId::round_Float2; +constexpr const TSymbolUniqueId BuiltInId::round_Float3; +constexpr const TSymbolUniqueId BuiltInId::round_Float4; +constexpr const TSymbolUniqueId BuiltInId::roundEven_Float1; +constexpr const TSymbolUniqueId BuiltInId::roundEven_Float2; +constexpr const TSymbolUniqueId BuiltInId::roundEven_Float3; +constexpr const TSymbolUniqueId BuiltInId::roundEven_Float4; +constexpr const TSymbolUniqueId BuiltInId::ceil_Float1; +constexpr const TSymbolUniqueId BuiltInId::ceil_Float2; +constexpr const TSymbolUniqueId BuiltInId::ceil_Float3; +constexpr const TSymbolUniqueId BuiltInId::ceil_Float4; +constexpr const TSymbolUniqueId BuiltInId::fract_Float1; +constexpr const TSymbolUniqueId BuiltInId::fract_Float2; +constexpr const TSymbolUniqueId BuiltInId::fract_Float3; +constexpr const TSymbolUniqueId BuiltInId::fract_Float4; +constexpr const TSymbolUniqueId BuiltInId::mod_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::mod_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::mod_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::mod_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::mod_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::mod_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::mod_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::min_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::min_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::min_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::min_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::min_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::min_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::min_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::min_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::min_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::min_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::min_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::min_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::min_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::min_Int4_Int1; +constexpr const TSymbolUniqueId BuiltInId::min_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::min_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::min_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::min_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::min_UInt2_UInt1; +constexpr const TSymbolUniqueId BuiltInId::min_UInt3_UInt1; +constexpr const TSymbolUniqueId BuiltInId::min_UInt4_UInt1; +constexpr const TSymbolUniqueId BuiltInId::max_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::max_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::max_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::max_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::max_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::max_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::max_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::max_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::max_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::max_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::max_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::max_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::max_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::max_Int4_Int1; +constexpr const TSymbolUniqueId BuiltInId::max_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::max_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::max_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::max_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::max_UInt2_UInt1; +constexpr const TSymbolUniqueId BuiltInId::max_UInt3_UInt1; +constexpr const TSymbolUniqueId BuiltInId::max_UInt4_UInt1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float1_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float2_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float3_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float4_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::clamp_Float4_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int2_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int3_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int4_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int2_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int3_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::clamp_Int4_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt1_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt2_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt3_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt4_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt2_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt3_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::clamp_UInt4_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::mix_Float1_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::mix_Float1_Float1_Bool1; +constexpr const TSymbolUniqueId BuiltInId::mix_Float2_Float2_Bool2; +constexpr const TSymbolUniqueId BuiltInId::mix_Float3_Float3_Bool3; +constexpr const TSymbolUniqueId BuiltInId::mix_Float4_Float4_Bool4; +constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::step_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::step_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::step_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float2; +constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float3; +constexpr const TSymbolUniqueId BuiltInId::step_Float1_Float4; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float4_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float2; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float3; +constexpr const TSymbolUniqueId BuiltInId::smoothstep_Float1_Float1_Float4; +constexpr const TSymbolUniqueId BuiltInId::modf_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::modf_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::modf_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::modf_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::isnan_Float1; +constexpr const TSymbolUniqueId BuiltInId::isnan_Float2; +constexpr const TSymbolUniqueId BuiltInId::isnan_Float3; +constexpr const TSymbolUniqueId BuiltInId::isnan_Float4; +constexpr const TSymbolUniqueId BuiltInId::isinf_Float1; +constexpr const TSymbolUniqueId BuiltInId::isinf_Float2; +constexpr const TSymbolUniqueId BuiltInId::isinf_Float3; +constexpr const TSymbolUniqueId BuiltInId::isinf_Float4; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float1; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float2; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float3; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToInt_Float4; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float1; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float2; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float3; +constexpr const TSymbolUniqueId BuiltInId::floatBitsToUint_Float4; +constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int1; +constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int2; +constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int3; +constexpr const TSymbolUniqueId BuiltInId::intBitsToFloat_Int4; +constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt1; +constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt2; +constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt3; +constexpr const TSymbolUniqueId BuiltInId::uintBitsToFloat_UInt4; +constexpr const TSymbolUniqueId BuiltInId::frexp_Float1_Int1; +constexpr const TSymbolUniqueId BuiltInId::frexp_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::frexp_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::frexp_Float4_Int4; +constexpr const TSymbolUniqueId BuiltInId::ldexp_Float1_Int1; +constexpr const TSymbolUniqueId BuiltInId::ldexp_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::ldexp_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::ldexp_Float4_Int4; +constexpr const TSymbolUniqueId BuiltInId::packSnorm2x16_Float2; +constexpr const TSymbolUniqueId BuiltInId::packUnorm2x16_Float2; +constexpr const TSymbolUniqueId BuiltInId::packHalf2x16_Float2; +constexpr const TSymbolUniqueId BuiltInId::unpackSnorm2x16_UInt1; +constexpr const TSymbolUniqueId BuiltInId::unpackUnorm2x16_UInt1; +constexpr const TSymbolUniqueId BuiltInId::unpackHalf2x16_UInt1; +constexpr const TSymbolUniqueId BuiltInId::packUnorm4x8_Float4; +constexpr const TSymbolUniqueId BuiltInId::packSnorm4x8_Float4; +constexpr const TSymbolUniqueId BuiltInId::unpackUnorm4x8_UInt1; +constexpr const TSymbolUniqueId BuiltInId::unpackSnorm4x8_UInt1; +constexpr const TSymbolUniqueId BuiltInId::length_Float1; +constexpr const TSymbolUniqueId BuiltInId::length_Float2; +constexpr const TSymbolUniqueId BuiltInId::length_Float3; +constexpr const TSymbolUniqueId BuiltInId::length_Float4; +constexpr const TSymbolUniqueId BuiltInId::distance_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::distance_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::distance_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::distance_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::dot_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::dot_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::dot_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::dot_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::cross_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::normalize_Float1; +constexpr const TSymbolUniqueId BuiltInId::normalize_Float2; +constexpr const TSymbolUniqueId BuiltInId::normalize_Float3; +constexpr const TSymbolUniqueId BuiltInId::normalize_Float4; +constexpr const TSymbolUniqueId BuiltInId::faceforward_Float1_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::faceforward_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::faceforward_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::faceforward_Float4_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::reflect_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::reflect_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::reflect_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::reflect_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::refract_Float1_Float1_Float1; +constexpr const TSymbolUniqueId BuiltInId::refract_Float2_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::refract_Float3_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::refract_Float4_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x2_Float2x2; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x3_Float3x3; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x4_Float4x4; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x3_Float2x3; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x2_Float3x2; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float2x4_Float2x4; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x2_Float4x2; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float3x4_Float3x4; +constexpr const TSymbolUniqueId BuiltInId::matrixCompMult_Float4x3_Float4x3; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float2; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float3; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float2; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float2_Float4; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float4_Float3; +constexpr const TSymbolUniqueId BuiltInId::outerProduct_Float3_Float4; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x2; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x3; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x4; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x2; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x3; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x2; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float2x4; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float4x3; +constexpr const TSymbolUniqueId BuiltInId::transpose_Float3x4; +constexpr const TSymbolUniqueId BuiltInId::determinant_Float2x2; +constexpr const TSymbolUniqueId BuiltInId::determinant_Float3x3; +constexpr const TSymbolUniqueId BuiltInId::determinant_Float4x4; +constexpr const TSymbolUniqueId BuiltInId::inverse_Float2x2; +constexpr const TSymbolUniqueId BuiltInId::inverse_Float3x3; +constexpr const TSymbolUniqueId BuiltInId::inverse_Float4x4; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::lessThan_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::lessThan_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::lessThanEqual_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::greaterThan_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::greaterThanEqual_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::equal_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::equal_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::equal_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::equal_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::equal_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::equal_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::equal_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::equal_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::equal_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::equal_Bool2_Bool2; +constexpr const TSymbolUniqueId BuiltInId::equal_Bool3_Bool3; +constexpr const TSymbolUniqueId BuiltInId::equal_Bool4_Bool4; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Float4_Float4; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::notEqual_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool2_Bool2; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool3_Bool3; +constexpr const TSymbolUniqueId BuiltInId::notEqual_Bool4_Bool4; +constexpr const TSymbolUniqueId BuiltInId::any_Bool2; +constexpr const TSymbolUniqueId BuiltInId::any_Bool3; +constexpr const TSymbolUniqueId BuiltInId::any_Bool4; +constexpr const TSymbolUniqueId BuiltInId::all_Bool2; +constexpr const TSymbolUniqueId BuiltInId::all_Bool3; +constexpr const TSymbolUniqueId BuiltInId::all_Bool4; +constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool2; +constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool3; +constexpr const TSymbolUniqueId BuiltInId::notFunc_Bool4; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int2_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int3_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_Int4_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt2_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt3_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldExtract_UInt4_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int2; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int3; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_Int4; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt1; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt2; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt3; +constexpr const TSymbolUniqueId BuiltInId::bitfieldReverse_UInt4; +constexpr const TSymbolUniqueId BuiltInId::bitCount_Int1; +constexpr const TSymbolUniqueId BuiltInId::bitCount_Int2; +constexpr const TSymbolUniqueId BuiltInId::bitCount_Int3; +constexpr const TSymbolUniqueId BuiltInId::bitCount_Int4; +constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt1; +constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt2; +constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt3; +constexpr const TSymbolUniqueId BuiltInId::bitCount_UInt4; +constexpr const TSymbolUniqueId BuiltInId::findLSB_Int1; +constexpr const TSymbolUniqueId BuiltInId::findLSB_Int2; +constexpr const TSymbolUniqueId BuiltInId::findLSB_Int3; +constexpr const TSymbolUniqueId BuiltInId::findLSB_Int4; +constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt1; +constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt2; +constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt3; +constexpr const TSymbolUniqueId BuiltInId::findLSB_UInt4; +constexpr const TSymbolUniqueId BuiltInId::findMSB_Int1; +constexpr const TSymbolUniqueId BuiltInId::findMSB_Int2; +constexpr const TSymbolUniqueId BuiltInId::findMSB_Int3; +constexpr const TSymbolUniqueId BuiltInId::findMSB_Int4; +constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt1; +constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt2; +constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt3; +constexpr const TSymbolUniqueId BuiltInId::findMSB_UInt4; +constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt1_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt2_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt3_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::uaddCarry_UInt4_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt1_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt2_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt3_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::usubBorrow_UInt4_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2; +constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3; +constexpr const TSymbolUniqueId BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4; +constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int1_Int1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int2_Int2_Int2_Int2; +constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int3_Int3_Int3_Int3; +constexpr const TSymbolUniqueId BuiltInId::imulExtended_Int4_Int4_Int4_Int4; +constexpr const TSymbolUniqueId BuiltInId::texture2D_Sampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureCube_SamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture2D_SamplerExternalOES1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_SamplerExternalOES1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_SamplerExternalOES1_Float4; +constexpr const TSymbolUniqueId BuiltInId::texture2DRect_Sampler2DRect1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture2DRectProj_Sampler2DRect1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture2DRectProj_Sampler2DRect1_Float4; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DRect1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DRect1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DRect1_Float4; +constexpr const TSymbolUniqueId BuiltInId::texture2DGradEXT_Sampler2D1_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture2D_Sampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProj_Sampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureCube_SamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float1; +constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float2; +constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float3; +constexpr const TSymbolUniqueId BuiltInId::dFdxExt_Float4; +constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float1; +constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float2; +constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float3; +constexpr const TSymbolUniqueId BuiltInId::dFdyExt_Float4; +constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float1; +constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float2; +constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float3; +constexpr const TSymbolUniqueId BuiltInId::fwidthExt_Float4; +constexpr const TSymbolUniqueId BuiltInId::texture2DLodEXT_Sampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjLodEXT_Sampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureCubeLodEXT_SamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DLod_Sampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture2DProjLod_Sampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureCubeLod_SamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler3D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler3D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler3D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_ISamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_USamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler3D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler3D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler3D1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_SamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_ISamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_USamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_ISampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureLod_USampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DShadow1_Float3; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCubeShadow1_Float4; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArrayShadow1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DShadow1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureLod_Sampler2DShadow1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler3D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler3D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler3D1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerCube1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_ISamplerCube1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_USamplerCube1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DArray1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2DArray1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2DArray1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DShadow1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerCubeShadow1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DArrayShadow1_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_Sampler2DMS1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_ISampler2DMS1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_USampler2DMS1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_ISampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_USampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjLod_Sampler2DShadow1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2D1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2D1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2D1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler3D1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler3D1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler3D1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2DArray1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2DArray1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2DArray1_Int3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2D1_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler2D1_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler2D1_Float2_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler3D1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler3D1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler3D1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_SamplerCube1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISamplerCube1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_USamplerCube1_Float3_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DShadow1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_SamplerCubeShadow1_Float4_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DArray1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_ISampler2DArray1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_USampler2DArray1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2D1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler2D1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler2D1_Float3_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2D1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler2D1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler2D1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler3D1_Float4_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_ISampler3D1_Float4_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_USampler3D1_Float4_Float3_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler3D1_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler3D1_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler3D1_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float4_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler3D1_Float4_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2D1_Float2_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler2D1_Float2_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler2D1_Float2_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler3D1_Float3_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler3D1_Float3_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler3D1_Float3_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_Sampler2DArray1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_ISampler2DArray1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureLodOffset_USampler2DArray1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2D1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler2D1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler2D1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2D1_Float4_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler2D1_Float4_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler2D1_Float4_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler3D1_Float4_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_ISampler3D1_Float4_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_USampler3D1_Float4_Float1_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler2D1_Int2_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler2D1_Int2_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler2D1_Int2_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler3D1_Int3_Int1_Int3; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler3D1_Int3_Int1_Int3; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler3D1_Int3_Int1_Int3; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::texelFetchOffset_USampler2DArray1_Int3_Int1_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3; +constexpr const TSymbolUniqueId BuiltInId::textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3; +constexpr const TSymbolUniqueId + BuiltInId::textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3; +constexpr const TSymbolUniqueId + BuiltInId::textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2D1_Float2_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2D1_Float2_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2D1_Float2_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler3D1_Float3_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler3D1_Float3_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler3D1_Float3_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureOffset_USampler2DArray1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float3_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler2D1_Float4_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_USampler3D1_Float4_Int3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternalOES1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float4; +constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerExternalOES1_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_SamplerExternalOES1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4; +constexpr const TSymbolUniqueId BuiltInId::rgb_2_yuv_Float3_YuvCscStandardEXT1; +constexpr const TSymbolUniqueId BuiltInId::yuv_2_rgb_Float3_YuvCscStandardEXT1; +constexpr const TSymbolUniqueId BuiltInId::textureSize_SamplerExternal2DY2YEXT1_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler2D1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler3D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_ISamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_USamplerCube1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_ISampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_USampler2DArray1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler2D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_ISampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_USampler3D1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_Sampler2DShadow1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerCubeShadow1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_Sampler2DShadow1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternalOES1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternalOES1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4_Float1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_Sampler2DMS1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_ISampler2DMS1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::texelFetch_USampler2DMS1_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2D1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2D1_Float2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2D1_Float2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2D1_Float2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2DArray1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArray1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISampler2DArray1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USampler2DArray1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USamplerCube1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCube1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_ISamplerCube1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_USamplerCube1_Float3_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DShadow1_Float2; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DShadow1_Float2_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArrayShadow1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_Sampler2DArrayShadow1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCubeShadow1_Float3; +constexpr const TSymbolUniqueId BuiltInId::textureGather_SamplerCubeShadow1_Float3_Float1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2_Int1; +constexpr const TSymbolUniqueId BuiltInId::textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2; +constexpr const TSymbolUniqueId + BuiltInId::textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2; +constexpr const TSymbolUniqueId BuiltInId::dFdx_Float1; +constexpr const TSymbolUniqueId BuiltInId::dFdx_Float2; +constexpr const TSymbolUniqueId BuiltInId::dFdx_Float3; +constexpr const TSymbolUniqueId BuiltInId::dFdx_Float4; +constexpr const TSymbolUniqueId BuiltInId::dFdy_Float1; +constexpr const TSymbolUniqueId BuiltInId::dFdy_Float2; +constexpr const TSymbolUniqueId BuiltInId::dFdy_Float3; +constexpr const TSymbolUniqueId BuiltInId::dFdy_Float4; +constexpr const TSymbolUniqueId BuiltInId::fwidth_Float1; +constexpr const TSymbolUniqueId BuiltInId::fwidth_Float2; +constexpr const TSymbolUniqueId BuiltInId::fwidth_Float3; +constexpr const TSymbolUniqueId BuiltInId::fwidth_Float4; +constexpr const TSymbolUniqueId BuiltInId::atomicCounter_AtomicCounter1; +constexpr const TSymbolUniqueId BuiltInId::atomicCounterIncrement_AtomicCounter1; +constexpr const TSymbolUniqueId BuiltInId::atomicCounterDecrement_AtomicCounter1; +constexpr const TSymbolUniqueId BuiltInId::atomicAdd_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicAdd_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicMin_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicMin_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicMax_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicMax_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicAnd_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicAnd_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicOr_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicOr_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicXor_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicXor_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicExchange_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicExchange_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::atomicCompSwap_UInt1_UInt1_UInt1; +constexpr const TSymbolUniqueId BuiltInId::atomicCompSwap_Int1_Int1_Int1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_Image2D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage2D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage2D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_Image3D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage3D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage3D1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_Image2DArray1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_IImage2DArray1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_UImage2DArray1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_ImageCube1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_IImageCube1; +constexpr const TSymbolUniqueId BuiltInId::imageSize_UImageCube1; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image2D1_Int2; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage2D1_Int2; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage2D1_Int2; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image3D1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage3D1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage3D1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_Image2DArray1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImage2DArray1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImage2DArray1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_ImageCube1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_IImageCube1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageLoad_UImageCube1_Int3; +constexpr const TSymbolUniqueId BuiltInId::imageStore_Image2D1_Int2_Float4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage2D1_Int2_Int4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage2D1_Int2_UInt4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_Image3D1_Int3_Float4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage3D1_Int3_Int4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage3D1_Int3_UInt4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_Image2DArray1_Int3_Float4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_IImage2DArray1_Int3_Int4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_UImage2DArray1_Int3_UInt4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_ImageCube1_Int3_Float4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_IImageCube1_Int3_Int4; +constexpr const TSymbolUniqueId BuiltInId::imageStore_UImageCube1_Int3_UInt4; +constexpr const TSymbolUniqueId BuiltInId::memoryBarrier; +constexpr const TSymbolUniqueId BuiltInId::memoryBarrierAtomicCounter; +constexpr const TSymbolUniqueId BuiltInId::memoryBarrierBuffer; +constexpr const TSymbolUniqueId BuiltInId::memoryBarrierImage; +constexpr const TSymbolUniqueId BuiltInId::barrier; +constexpr const TSymbolUniqueId BuiltInId::memoryBarrierShared; +constexpr const TSymbolUniqueId BuiltInId::groupMemoryBarrier; +constexpr const TSymbolUniqueId BuiltInId::EmitVertex; +constexpr const TSymbolUniqueId BuiltInId::EndPrimitive; +constexpr const TSymbolUniqueId BuiltInId::gl_DepthRangeParameters; +constexpr const TSymbolUniqueId BuiltInId::gl_DepthRange; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAttribs; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexUniformVectors; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexTextureImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedTextureImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxTextureImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentUniformVectors; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVaryingVectors; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxDrawBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxDualSourceDrawBuffersEXT; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexOutputVectors; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentInputVectors; +constexpr const TSymbolUniqueId BuiltInId::gl_MinProgramTexelOffset; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxProgramTexelOffset; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexImageUniforms; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentImageUniforms; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeImageUniforms; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedImageUniforms; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedShaderOutputResources; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeWorkGroupCount; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeWorkGroupSize; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeUniformComponents; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeTextureImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeAtomicCounters; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxComputeAtomicCounterBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAtomicCounters; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentAtomicCounters; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedAtomicCounters; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxAtomicCounterBindings; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxVertexAtomicCounterBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxFragmentAtomicCounterBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxCombinedAtomicCounterBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxAtomicCounterBufferSize; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryInputComponents; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryOutputComponents; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryImageUniforms; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryTextureImageUnits; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryOutputVertices; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryTotalOutputComponents; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryUniformComponents; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryAtomicCounters; +constexpr const TSymbolUniqueId BuiltInId::gl_MaxGeometryAtomicCounterBuffers; +constexpr const TSymbolUniqueId BuiltInId::gl_FragCoord; +constexpr const TSymbolUniqueId BuiltInId::gl_FrontFacing; +constexpr const TSymbolUniqueId BuiltInId::gl_PointCoord; +constexpr const TSymbolUniqueId BuiltInId::gl_FragColor; +constexpr const TSymbolUniqueId BuiltInId::gl_FragData; +constexpr const TSymbolUniqueId BuiltInId::gl_FragDepth; +constexpr const TSymbolUniqueId BuiltInId::gl_SecondaryFragColorEXT; +constexpr const TSymbolUniqueId BuiltInId::gl_SecondaryFragDataEXT; +constexpr const TSymbolUniqueId BuiltInId::gl_FragDepthEXT; +constexpr const TSymbolUniqueId BuiltInId::gl_LastFragData; +constexpr const TSymbolUniqueId BuiltInId::gl_LastFragColor; +constexpr const TSymbolUniqueId BuiltInId::gl_LastFragDataNV; +constexpr const TSymbolUniqueId BuiltInId::gl_LastFragColorARM; +constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveID; +constexpr const TSymbolUniqueId BuiltInId::gl_Layer; +constexpr const TSymbolUniqueId BuiltInId::gl_Position; +constexpr const TSymbolUniqueId BuiltInId::gl_PointSize; +constexpr const TSymbolUniqueId BuiltInId::gl_InstanceID; +constexpr const TSymbolUniqueId BuiltInId::gl_VertexID; +constexpr const TSymbolUniqueId BuiltInId::gl_ViewportIndex; +constexpr const TSymbolUniqueId BuiltInId::gl_LayerVS; +constexpr const TSymbolUniqueId BuiltInId::gl_NumWorkGroups; +constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupSize; +constexpr const TSymbolUniqueId BuiltInId::gl_WorkGroupID; +constexpr const TSymbolUniqueId BuiltInId::gl_LocalInvocationID; +constexpr const TSymbolUniqueId BuiltInId::gl_GlobalInvocationID; +constexpr const TSymbolUniqueId BuiltInId::gl_LocalInvocationIndex; +constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveIDIn; +constexpr const TSymbolUniqueId BuiltInId::gl_InvocationID; +constexpr const TSymbolUniqueId BuiltInId::gl_PrimitiveIDGS; +constexpr const TSymbolUniqueId BuiltInId::gl_LayerGS; +constexpr const TSymbolUniqueId BuiltInId::gl_PerVertex; +constexpr const TSymbolUniqueId BuiltInId::gl_in; +constexpr const TSymbolUniqueId BuiltInId::gl_PerVertexOutBlock; +constexpr const TSymbolUniqueId BuiltInId::gl_PositionGS; +constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVR; +constexpr const TSymbolUniqueId BuiltInId::gl_ViewID_OVRESSL1; + +const int TSymbolTable::kLastBuiltInId = 1008; + +namespace BuiltInName +{ + +constexpr const ImmutableString _empty(""); +constexpr const ImmutableString EmitVertex("EmitVertex"); +constexpr const ImmutableString EndPrimitive("EndPrimitive"); +constexpr const ImmutableString abs("abs"); +constexpr const ImmutableString acos("acos"); +constexpr const ImmutableString acosh("acosh"); +constexpr const ImmutableString all("all"); +constexpr const ImmutableString any("any"); +constexpr const ImmutableString asin("asin"); +constexpr const ImmutableString asinh("asinh"); +constexpr const ImmutableString atan("atan"); +constexpr const ImmutableString atanh("atanh"); +constexpr const ImmutableString atomicAdd("atomicAdd"); +constexpr const ImmutableString atomicAnd("atomicAnd"); +constexpr const ImmutableString atomicCompSwap("atomicCompSwap"); +constexpr const ImmutableString atomicCompSwap_0D0D0D("atomicCompSwap(0D0D0D"); +constexpr const ImmutableString atomicCounter("atomicCounter"); +constexpr const ImmutableString atomicCounterDecrement("atomicCounterDecrement"); +constexpr const ImmutableString atomicCounterIncrement("atomicCounterIncrement"); +constexpr const ImmutableString atomicExchange("atomicExchange"); +constexpr const ImmutableString atomicMax("atomicMax"); +constexpr const ImmutableString atomicMin("atomicMin"); +constexpr const ImmutableString atomicOr("atomicOr"); +constexpr const ImmutableString atomicXor("atomicXor"); +constexpr const ImmutableString barrier("barrier"); +constexpr const ImmutableString bitCount("bitCount"); +constexpr const ImmutableString bitfieldExtract("bitfieldExtract"); +constexpr const ImmutableString bitfieldExtract_0D0C0C("bitfieldExtract(0D0C0C"); +constexpr const ImmutableString bitfieldExtract_1C0C0C("bitfieldExtract(1C0C0C"); +constexpr const ImmutableString bitfieldInsert("bitfieldInsert"); +constexpr const ImmutableString bitfieldInsert_0C0C0C0C("bitfieldInsert(0C0C0C0C"); +constexpr const ImmutableString bitfieldInsert_0D0D0C0C("bitfieldInsert(0D0D0C0C"); +constexpr const ImmutableString bitfieldInsert_1C1C0C0C("bitfieldInsert(1C1C0C0C"); +constexpr const ImmutableString bitfieldInsert_1D1D0C0C("bitfieldInsert(1D1D0C0C"); +constexpr const ImmutableString bitfieldInsert_2C2C0C0C("bitfieldInsert(2C2C0C0C"); +constexpr const ImmutableString bitfieldInsert_2D2D0C0C("bitfieldInsert(2D2D0C0C"); +constexpr const ImmutableString bitfieldInsert_3C3C0C0C("bitfieldInsert(3C3C0C0C"); +constexpr const ImmutableString bitfieldInsert_3D3D0C0C("bitfieldInsert(3D3D0C0C"); +constexpr const ImmutableString bitfieldReverse("bitfieldReverse"); +constexpr const ImmutableString ceil("ceil"); +constexpr const ImmutableString clamp("clamp"); +constexpr const ImmutableString clamp_0D0D0D("clamp(0D0D0D"); +constexpr const ImmutableString clamp_1B0B0B("clamp(1B0B0B"); +constexpr const ImmutableString clamp_1B1B1B("clamp(1B1B1B"); +constexpr const ImmutableString clamp_1C0C0C("clamp(1C0C0C"); +constexpr const ImmutableString clamp_1C1C1C("clamp(1C1C1C"); +constexpr const ImmutableString clamp_2C2C2C("clamp(2C2C2C"); +constexpr const ImmutableString clamp_3B0B0B("clamp(3B0B0B"); +constexpr const ImmutableString clamp_3C0C0C("clamp(3C0C0C"); +constexpr const ImmutableString clamp_3D0D0D("clamp(3D0D0D"); +constexpr const ImmutableString cos("cos"); +constexpr const ImmutableString cosh("cosh"); +constexpr const ImmutableString cross("cross"); +constexpr const ImmutableString dFdx("dFdx"); +constexpr const ImmutableString dFdxExt("dFdx"); +constexpr const ImmutableString dFdy("dFdy"); +constexpr const ImmutableString dFdyExt("dFdy"); +constexpr const ImmutableString degrees("degrees"); +constexpr const ImmutableString determinant("determinant"); +constexpr const ImmutableString diff("diff"); +constexpr const ImmutableString distance("distance"); +constexpr const ImmutableString dot("dot"); +constexpr const ImmutableString equal("equal"); +constexpr const ImmutableString exp("exp"); +constexpr const ImmutableString exp2("exp2"); +constexpr const ImmutableString faceforward("faceforward"); +constexpr const ImmutableString faceforward_1B1B1B("faceforward(1B1B1B"); +constexpr const ImmutableString faceforward_2B2B2B("faceforward(2B2B2B"); +constexpr const ImmutableString faceforward_3B3B3B("faceforward(3B3B3B"); +constexpr const ImmutableString far("far"); +constexpr const ImmutableString findLSB("findLSB"); +constexpr const ImmutableString findMSB("findMSB"); +constexpr const ImmutableString floatBitsToInt("floatBitsToInt"); +constexpr const ImmutableString floatBitsToUint("floatBitsToUint"); +constexpr const ImmutableString floor("floor"); +constexpr const ImmutableString fract("fract"); +constexpr const ImmutableString frexp("frexp"); +constexpr const ImmutableString frexp_3B3C("frexp(3B3C"); +constexpr const ImmutableString fwidth("fwidth"); +constexpr const ImmutableString fwidthExt("fwidth"); +constexpr const ImmutableString gl_DepthRange("gl_DepthRange"); +constexpr const ImmutableString gl_DepthRangeParameters("gl_DepthRangeParameters"); +constexpr const ImmutableString gl_FragColor("gl_FragColor"); +constexpr const ImmutableString gl_FragCoord("gl_FragCoord"); +constexpr const ImmutableString gl_FragData("gl_FragData"); +constexpr const ImmutableString gl_FragDepth("gl_FragDepth"); +constexpr const ImmutableString gl_FragDepthEXT("gl_FragDepthEXT"); +constexpr const ImmutableString gl_FrontFacing("gl_FrontFacing"); +constexpr const ImmutableString gl_GlobalInvocationID("gl_GlobalInvocationID"); +constexpr const ImmutableString gl_InstanceID("gl_InstanceID"); +constexpr const ImmutableString gl_InvocationID("gl_InvocationID"); +constexpr const ImmutableString gl_LastFragColor("gl_LastFragColor"); +constexpr const ImmutableString gl_LastFragColorARM("gl_LastFragColorARM"); +constexpr const ImmutableString gl_LastFragData("gl_LastFragData"); +constexpr const ImmutableString gl_Layer("gl_Layer"); +constexpr const ImmutableString gl_LocalInvocationID("gl_LocalInvocationID"); +constexpr const ImmutableString gl_LocalInvocationIndex("gl_LocalInvocationIndex"); +constexpr const ImmutableString gl_MaxAtomicCounterBindings("gl_MaxAtomicCounterBindings"); +constexpr const ImmutableString gl_MaxAtomicCounterBufferSize("gl_MaxAtomicCounterBufferSize"); +constexpr const ImmutableString gl_MaxCombinedAtomicCounterBuffers( + "gl_MaxCombinedAtomicCounterBuffers"); +constexpr const ImmutableString gl_MaxCombinedAtomicCounters("gl_MaxCombinedAtomicCounters"); +constexpr const ImmutableString gl_MaxCombinedImageUniforms("gl_MaxCombinedImageUniforms"); +constexpr const ImmutableString gl_MaxCombinedShaderOutputResources( + "gl_MaxCombinedShaderOutputResources"); +constexpr const ImmutableString gl_MaxCombinedTextureImageUnits("gl_MaxCombinedTextureImageUnits"); +constexpr const ImmutableString gl_MaxComputeAtomicCounterBuffers( + "gl_MaxComputeAtomicCounterBuffers"); +constexpr const ImmutableString gl_MaxComputeAtomicCounters("gl_MaxComputeAtomicCounters"); +constexpr const ImmutableString gl_MaxComputeImageUniforms("gl_MaxComputeImageUniforms"); +constexpr const ImmutableString gl_MaxComputeTextureImageUnits("gl_MaxComputeTextureImageUnits"); +constexpr const ImmutableString gl_MaxComputeUniformComponents("gl_MaxComputeUniformComponents"); +constexpr const ImmutableString gl_MaxComputeWorkGroupCount("gl_MaxComputeWorkGroupCount"); +constexpr const ImmutableString gl_MaxComputeWorkGroupSize("gl_MaxComputeWorkGroupSize"); +constexpr const ImmutableString gl_MaxDrawBuffers("gl_MaxDrawBuffers"); +constexpr const ImmutableString gl_MaxDualSourceDrawBuffersEXT("gl_MaxDualSourceDrawBuffersEXT"); +constexpr const ImmutableString gl_MaxFragmentAtomicCounterBuffers( + "gl_MaxFragmentAtomicCounterBuffers"); +constexpr const ImmutableString gl_MaxFragmentAtomicCounters("gl_MaxFragmentAtomicCounters"); +constexpr const ImmutableString gl_MaxFragmentImageUniforms("gl_MaxFragmentImageUniforms"); +constexpr const ImmutableString gl_MaxFragmentInputVectors("gl_MaxFragmentInputVectors"); +constexpr const ImmutableString gl_MaxFragmentUniformVectors("gl_MaxFragmentUniformVectors"); +constexpr const ImmutableString gl_MaxGeometryAtomicCounterBuffers( + "gl_MaxGeometryAtomicCounterBuffers"); +constexpr const ImmutableString gl_MaxGeometryAtomicCounters("gl_MaxGeometryAtomicCounters"); +constexpr const ImmutableString gl_MaxGeometryImageUniforms("gl_MaxGeometryImageUniforms"); +constexpr const ImmutableString gl_MaxGeometryInputComponents("gl_MaxGeometryInputComponents"); +constexpr const ImmutableString gl_MaxGeometryOutputComponents("gl_MaxGeometryOutputComponents"); +constexpr const ImmutableString gl_MaxGeometryOutputVertices("gl_MaxGeometryOutputVertices"); +constexpr const ImmutableString gl_MaxGeometryTextureImageUnits("gl_MaxGeometryTextureImageUnits"); +constexpr const ImmutableString gl_MaxGeometryTotalOutputComponents( + "gl_MaxGeometryTotalOutputComponents"); +constexpr const ImmutableString gl_MaxGeometryUniformComponents("gl_MaxGeometryUniformComponents"); +constexpr const ImmutableString gl_MaxImageUnits("gl_MaxImageUnits"); +constexpr const ImmutableString gl_MaxProgramTexelOffset("gl_MaxProgramTexelOffset"); +constexpr const ImmutableString gl_MaxTextureImageUnits("gl_MaxTextureImageUnits"); +constexpr const ImmutableString gl_MaxVaryingVectors("gl_MaxVaryingVectors"); +constexpr const ImmutableString gl_MaxVertexAtomicCounterBuffers( + "gl_MaxVertexAtomicCounterBuffers"); +constexpr const ImmutableString gl_MaxVertexAtomicCounters("gl_MaxVertexAtomicCounters"); +constexpr const ImmutableString gl_MaxVertexAttribs("gl_MaxVertexAttribs"); +constexpr const ImmutableString gl_MaxVertexImageUniforms("gl_MaxVertexImageUniforms"); +constexpr const ImmutableString gl_MaxVertexOutputVectors("gl_MaxVertexOutputVectors"); +constexpr const ImmutableString gl_MaxVertexTextureImageUnits("gl_MaxVertexTextureImageUnits"); +constexpr const ImmutableString gl_MaxVertexUniformVectors("gl_MaxVertexUniformVectors"); +constexpr const ImmutableString gl_MinProgramTexelOffset("gl_MinProgramTexelOffset"); +constexpr const ImmutableString gl_NumWorkGroups("gl_NumWorkGroups"); +constexpr const ImmutableString gl_PerVertex("gl_PerVertex"); +constexpr const ImmutableString gl_PointCoord("gl_PointCoord"); +constexpr const ImmutableString gl_PointSize("gl_PointSize"); +constexpr const ImmutableString gl_Position("gl_Position"); +constexpr const ImmutableString gl_PrimitiveID("gl_PrimitiveID"); +constexpr const ImmutableString gl_PrimitiveIDIn("gl_PrimitiveIDIn"); +constexpr const ImmutableString gl_SecondaryFragColorEXT("gl_SecondaryFragColorEXT"); +constexpr const ImmutableString gl_SecondaryFragDataEXT("gl_SecondaryFragDataEXT"); +constexpr const ImmutableString gl_VertexID("gl_VertexID"); +constexpr const ImmutableString gl_ViewID_OVR("gl_ViewID_OVR"); +constexpr const ImmutableString gl_ViewportIndex("gl_ViewportIndex"); +constexpr const ImmutableString gl_WorkGroupID("gl_WorkGroupID"); +constexpr const ImmutableString gl_WorkGroupSize("gl_WorkGroupSize"); +constexpr const ImmutableString gl_in("gl_in"); +constexpr const ImmutableString greaterThan("greaterThan"); +constexpr const ImmutableString greaterThanEqual("greaterThanEqual"); +constexpr const ImmutableString groupMemoryBarrier("groupMemoryBarrier"); +constexpr const ImmutableString imageLoad("imageLoad"); +constexpr const ImmutableString imageSize("imageSize"); +constexpr const ImmutableString imageStore("imageStore"); +constexpr const ImmutableString imageStore_0c1C3B("imageStore(0c1C3B"); +constexpr const ImmutableString imageStore_0d1C3C("imageStore(0d1C3C"); +constexpr const ImmutableString imageStore_0e1C3D("imageStore(0e1C3D"); +constexpr const ImmutableString imageStore_0l2C3B("imageStore(0l2C3B"); +constexpr const ImmutableString imageStore_0n2C3D("imageStore(0n2C3D"); +constexpr const ImmutableString imulExtended("imulExtended"); +constexpr const ImmutableString imulExtended_0C0C0C0C("imulExtended(0C0C0C0C"); +constexpr const ImmutableString imulExtended_1C1C1C1C("imulExtended(1C1C1C1C"); +constexpr const ImmutableString imulExtended_2C2C2C2C("imulExtended(2C2C2C2C"); +constexpr const ImmutableString imulExtended_3C3C3C3C("imulExtended(3C3C3C3C"); +constexpr const ImmutableString intBitsToFloat("intBitsToFloat"); +constexpr const ImmutableString inverse("inverse"); +constexpr const ImmutableString inversesqrt("inversesqrt"); +constexpr const ImmutableString isinf("isinf"); +constexpr const ImmutableString isnan("isnan"); +constexpr const ImmutableString ldexp("ldexp"); +constexpr const ImmutableString length("length"); +constexpr const ImmutableString lessThan("lessThan"); +constexpr const ImmutableString lessThanEqual("lessThanEqual"); +constexpr const ImmutableString log("log"); +constexpr const ImmutableString log2("log2"); +constexpr const ImmutableString matrixCompMult("matrixCompMult"); +constexpr const ImmutableString max("max"); +constexpr const ImmutableString memoryBarrier("memoryBarrier"); +constexpr const ImmutableString memoryBarrierAtomicCounter("memoryBarrierAtomicCounter"); +constexpr const ImmutableString memoryBarrierBuffer("memoryBarrierBuffer"); +constexpr const ImmutableString memoryBarrierImage("memoryBarrierImage"); +constexpr const ImmutableString memoryBarrierShared("memoryBarrierShared"); +constexpr const ImmutableString min("min"); +constexpr const ImmutableString mix("mix"); +constexpr const ImmutableString mix_0B0B0E("mix(0B0B0E"); +constexpr const ImmutableString mix_1B1B1B("mix(1B1B1B"); +constexpr const ImmutableString mix_3B3B0B("mix(3B3B0B"); +constexpr const ImmutableString mix_3B3B3B("mix(3B3B3B"); +constexpr const ImmutableString mod("mod"); +constexpr const ImmutableString modf("modf"); +constexpr const ImmutableString near("near"); +constexpr const ImmutableString normalize("normalize"); +constexpr const ImmutableString notEqual("notEqual"); +constexpr const ImmutableString notFunc("not"); +constexpr const ImmutableString outerProduct("outerProduct"); +constexpr const ImmutableString packHalf2x16("packHalf2x16"); +constexpr const ImmutableString packSnorm2x16("packSnorm2x16"); +constexpr const ImmutableString packSnorm4x8("packSnorm4x8"); +constexpr const ImmutableString packUnorm2x16("packUnorm2x16"); +constexpr const ImmutableString packUnorm4x8("packUnorm4x8"); +constexpr const ImmutableString pow("pow"); +constexpr const ImmutableString radians("radians"); +constexpr const ImmutableString reflect("reflect"); +constexpr const ImmutableString refract("refract"); +constexpr const ImmutableString refract_3B3B0B("refract(3B3B0B"); +constexpr const ImmutableString rgb_2_yuv("rgb_2_yuv"); +constexpr const ImmutableString round("round"); +constexpr const ImmutableString roundEven("roundEven"); +constexpr const ImmutableString sign("sign"); +constexpr const ImmutableString sin("sin"); +constexpr const ImmutableString sinh("sinh"); +constexpr const ImmutableString smoothstep("smoothstep"); +constexpr const ImmutableString smoothstep_1B1B1B("smoothstep(1B1B1B"); +constexpr const ImmutableString smoothstep_3B3B3B("smoothstep(3B3B3B"); +constexpr const ImmutableString sqrt("sqrt"); +constexpr const ImmutableString step("step"); +constexpr const ImmutableString tan("tan"); +constexpr const ImmutableString tanh("tanh"); +constexpr const ImmutableString texelFetch("texelFetch"); +constexpr const ImmutableString texelFetchOffset("texelFetchOffset"); +constexpr const ImmutableString texelFetchOffset_0H1C0C1C("texelFetchOffset(0H1C0C1C"); +constexpr const ImmutableString texelFetchOffset_0I2C0C2C("texelFetchOffset(0I2C0C2C"); +constexpr const ImmutableString texelFetchOffset_0K2C0C1C("texelFetchOffset(0K2C0C1C"); +constexpr const ImmutableString texelFetchOffset_0P1C0C1C("texelFetchOffset(0P1C0C1C"); +constexpr const ImmutableString texelFetchOffset_0Q2C0C2C("texelFetchOffset(0Q2C0C2C"); +constexpr const ImmutableString texelFetchOffset_0S2C0C1C("texelFetchOffset(0S2C0C1C"); +constexpr const ImmutableString texelFetchOffset_0U1C0C1C("texelFetchOffset(0U1C0C1C"); +constexpr const ImmutableString texelFetchOffset_0V2C0C2C("texelFetchOffset(0V2C0C2C"); +constexpr const ImmutableString texelFetchOffset_0X2C0C1C("texelFetchOffset(0X2C0C1C"); +constexpr const ImmutableString texelFetch_0H1C0C("texelFetch(0H1C0C"); +constexpr const ImmutableString texelFetch_0I2C0C("texelFetch(0I2C0C"); +constexpr const ImmutableString texelFetch_0K2C0C("texelFetch(0K2C0C"); +constexpr const ImmutableString texelFetch_0L1C0C("texelFetch(0L1C0C"); +constexpr const ImmutableString texelFetch_0O1C0C("texelFetch(0O1C0C"); +constexpr const ImmutableString texelFetch_0T1C0C("texelFetch(0T1C0C"); +constexpr const ImmutableString texelFetch_0V2C0C("texelFetch(0V2C0C"); +constexpr const ImmutableString texelFetch_0X2C0C("texelFetch(0X2C0C"); +constexpr const ImmutableString texture("texture"); +constexpr const ImmutableString texture2D("texture2D"); +constexpr const ImmutableString texture2DGradEXT("texture2DGradEXT"); +constexpr const ImmutableString texture2DGradEXT_0H1B1B1B("texture2DGradEXT(0H1B1B1B"); +constexpr const ImmutableString texture2DLod("texture2DLod"); +constexpr const ImmutableString texture2DLodEXT("texture2DLodEXT"); +constexpr const ImmutableString texture2DProj("texture2DProj"); +constexpr const ImmutableString texture2DProjGradEXT("texture2DProjGradEXT"); +constexpr const ImmutableString texture2DProjGradEXT_0H2B1B1B("texture2DProjGradEXT(0H2B1B1B"); +constexpr const ImmutableString texture2DProjGradEXT_0H3B1B1B("texture2DProjGradEXT(0H3B1B1B"); +constexpr const ImmutableString texture2DProjLod("texture2DProjLod"); +constexpr const ImmutableString texture2DProjLodEXT("texture2DProjLodEXT"); +constexpr const ImmutableString texture2DProjLod_0H2B0B("texture2DProjLod(0H2B0B"); +constexpr const ImmutableString texture2DProj_0H2B0B("texture2DProj(0H2B0B"); +constexpr const ImmutableString texture2DRect("texture2DRect"); +constexpr const ImmutableString texture2DRectProj("texture2DRectProj"); +constexpr const ImmutableString textureCube("textureCube"); +constexpr const ImmutableString textureCubeGradEXT("textureCubeGradEXT"); +constexpr const ImmutableString textureCubeGradEXT_0J2B2B2B("textureCubeGradEXT(0J2B2B2B"); +constexpr const ImmutableString textureCubeLod("textureCubeLod"); +constexpr const ImmutableString textureCubeLodEXT("textureCubeLodEXT"); +constexpr const ImmutableString textureGather("textureGather"); +constexpr const ImmutableString textureGatherOffset("textureGatherOffset"); +constexpr const ImmutableString textureGatherOffset_0H1B1C0C("textureGatherOffset(0H1B1C0C"); +constexpr const ImmutableString textureGatherOffset_0K2B1C0C("textureGatherOffset(0K2B1C0C"); +constexpr const ImmutableString textureGatherOffset_0P1B1C0C("textureGatherOffset(0P1B1C0C"); +constexpr const ImmutableString textureGatherOffset_0S2B1C0C("textureGatherOffset(0S2B1C0C"); +constexpr const ImmutableString textureGatherOffset_0U1B1C("textureGatherOffset(0U1B1C"); +constexpr const ImmutableString textureGatherOffset_0U1B1C0C("textureGatherOffset(0U1B1C0C"); +constexpr const ImmutableString textureGatherOffset_0X2B1C0C("textureGatherOffset(0X2B1C0C"); +constexpr const ImmutableString textureGatherOffset_0Z1B0B1C("textureGatherOffset(0Z1B0B1C"); +constexpr const ImmutableString textureGatherOffset_0b2B0B1C("textureGatherOffset(0b2B0B1C"); +constexpr const ImmutableString textureGather_0J2B0C("textureGather(0J2B0C"); +constexpr const ImmutableString textureGather_0P1B0C("textureGather(0P1B0C"); +constexpr const ImmutableString textureGather_0R2B0C("textureGather(0R2B0C"); +constexpr const ImmutableString textureGather_0a2B0B("textureGather(0a2B0B"); +constexpr const ImmutableString textureGrad("textureGrad"); +constexpr const ImmutableString textureGradOffset("textureGradOffset"); +constexpr const ImmutableString textureGradOffset_0H1B1B1B1C("textureGradOffset(0H1B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0I2B2B2B2C("textureGradOffset(0I2B2B2B2C"); +constexpr const ImmutableString textureGradOffset_0K2B1B1B1C("textureGradOffset(0K2B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0P1B1B1B1C("textureGradOffset(0P1B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0Q2B2B2B2C("textureGradOffset(0Q2B2B2B2C"); +constexpr const ImmutableString textureGradOffset_0S2B1B1B1C("textureGradOffset(0S2B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0U1B1B1B1C("textureGradOffset(0U1B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0V2B2B2B2C("textureGradOffset(0V2B2B2B2C"); +constexpr const ImmutableString textureGradOffset_0X2B1B1B1C("textureGradOffset(0X2B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0Z2B1B1B1C("textureGradOffset(0Z2B1B1B1C"); +constexpr const ImmutableString textureGradOffset_0b3B1B1B1C("textureGradOffset(0b3B1B1B1C"); +constexpr const ImmutableString textureGrad_0H1B1B1B("textureGrad(0H1B1B1B"); +constexpr const ImmutableString textureGrad_0I2B2B2B("textureGrad(0I2B2B2B"); +constexpr const ImmutableString textureGrad_0J2B2B2B("textureGrad(0J2B2B2B"); +constexpr const ImmutableString textureGrad_0K2B1B1B("textureGrad(0K2B1B1B"); +constexpr const ImmutableString textureGrad_0P1B1B1B("textureGrad(0P1B1B1B"); +constexpr const ImmutableString textureGrad_0Q2B2B2B("textureGrad(0Q2B2B2B"); +constexpr const ImmutableString textureGrad_0R2B2B2B("textureGrad(0R2B2B2B"); +constexpr const ImmutableString textureGrad_0S2B1B1B("textureGrad(0S2B1B1B"); +constexpr const ImmutableString textureGrad_0U1B1B1B("textureGrad(0U1B1B1B"); +constexpr const ImmutableString textureGrad_0V2B2B2B("textureGrad(0V2B2B2B"); +constexpr const ImmutableString textureGrad_0W2B2B2B("textureGrad(0W2B2B2B"); +constexpr const ImmutableString textureGrad_0X2B1B1B("textureGrad(0X2B1B1B"); +constexpr const ImmutableString textureGrad_0Z2B1B1B("textureGrad(0Z2B1B1B"); +constexpr const ImmutableString textureGrad_0a3B2B2B("textureGrad(0a3B2B2B"); +constexpr const ImmutableString textureGrad_0b3B1B1B("textureGrad(0b3B1B1B"); +constexpr const ImmutableString textureLod("textureLod"); +constexpr const ImmutableString textureLodOffset("textureLodOffset"); +constexpr const ImmutableString textureLodOffset_0H1B0B1C("textureLodOffset(0H1B0B1C"); +constexpr const ImmutableString textureLodOffset_0I2B0B2C("textureLodOffset(0I2B0B2C"); +constexpr const ImmutableString textureLodOffset_0K2B0B1C("textureLodOffset(0K2B0B1C"); +constexpr const ImmutableString textureLodOffset_0P1B0B1C("textureLodOffset(0P1B0B1C"); +constexpr const ImmutableString textureLodOffset_0Q2B0B2C("textureLodOffset(0Q2B0B2C"); +constexpr const ImmutableString textureLodOffset_0S2B0B1C("textureLodOffset(0S2B0B1C"); +constexpr const ImmutableString textureLodOffset_0U1B0B1C("textureLodOffset(0U1B0B1C"); +constexpr const ImmutableString textureLodOffset_0V2B0B2C("textureLodOffset(0V2B0B2C"); +constexpr const ImmutableString textureLodOffset_0X2B0B1C("textureLodOffset(0X2B0B1C"); +constexpr const ImmutableString textureLodOffset_0Z2B0B1C("textureLodOffset(0Z2B0B1C"); +constexpr const ImmutableString textureLod_0J2B0B("textureLod(0J2B0B"); +constexpr const ImmutableString textureLod_0P1B0B("textureLod(0P1B0B"); +constexpr const ImmutableString textureLod_0S2B0B("textureLod(0S2B0B"); +constexpr const ImmutableString textureLod_0Z2B0B("textureLod(0Z2B0B"); +constexpr const ImmutableString textureOffset("textureOffset"); +constexpr const ImmutableString textureOffset_0H1B1C0B("textureOffset(0H1B1C0B"); +constexpr const ImmutableString textureOffset_0I2B2C0B("textureOffset(0I2B2C0B"); +constexpr const ImmutableString textureOffset_0K2B1C0B("textureOffset(0K2B1C0B"); +constexpr const ImmutableString textureOffset_0P1B1C("textureOffset(0P1B1C"); +constexpr const ImmutableString textureOffset_0P1B1C0B("textureOffset(0P1B1C0B"); +constexpr const ImmutableString textureOffset_0Q2B2C("textureOffset(0Q2B2C"); +constexpr const ImmutableString textureOffset_0Q2B2C0B("textureOffset(0Q2B2C0B"); +constexpr const ImmutableString textureOffset_0S2B1C("textureOffset(0S2B1C"); +constexpr const ImmutableString textureOffset_0S2B1C0B("textureOffset(0S2B1C0B"); +constexpr const ImmutableString textureOffset_0U1B1C0B("textureOffset(0U1B1C0B"); +constexpr const ImmutableString textureOffset_0V2B2C("textureOffset(0V2B2C"); +constexpr const ImmutableString textureOffset_0V2B2C0B("textureOffset(0V2B2C0B"); +constexpr const ImmutableString textureOffset_0X2B1C0B("textureOffset(0X2B1C0B"); +constexpr const ImmutableString textureOffset_0Z2B1C0B("textureOffset(0Z2B1C0B"); +constexpr const ImmutableString textureProj("textureProj"); +constexpr const ImmutableString textureProjGrad("textureProjGrad"); +constexpr const ImmutableString textureProjGradOffset("textureProjGradOffset"); +constexpr const ImmutableString textureProjGradOffset_0H2B1B1B1C( + "textureProjGradOffset(0H2B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0H3B1B1B1C( + "textureProjGradOffset(0H3B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0I3B2B2B2C( + "textureProjGradOffset(0I3B2B2B2C"); +constexpr const ImmutableString textureProjGradOffset_0P2B1B1B1C( + "textureProjGradOffset(0P2B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0P3B1B1B1C( + "textureProjGradOffset(0P3B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0Q3B2B2B2C( + "textureProjGradOffset(0Q3B2B2B2C"); +constexpr const ImmutableString textureProjGradOffset_0U2B1B1B1C( + "textureProjGradOffset(0U2B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0U3B1B1B1C( + "textureProjGradOffset(0U3B1B1B1C"); +constexpr const ImmutableString textureProjGradOffset_0V3B2B2B2C( + "textureProjGradOffset(0V3B2B2B2C"); +constexpr const ImmutableString textureProjGradOffset_0Z3B1B1B1C( + "textureProjGradOffset(0Z3B1B1B1C"); +constexpr const ImmutableString textureProjGrad_0H2B1B1B("textureProjGrad(0H2B1B1B"); +constexpr const ImmutableString textureProjGrad_0H3B1B1B("textureProjGrad(0H3B1B1B"); +constexpr const ImmutableString textureProjGrad_0I3B2B2B("textureProjGrad(0I3B2B2B"); +constexpr const ImmutableString textureProjGrad_0P2B1B1B("textureProjGrad(0P2B1B1B"); +constexpr const ImmutableString textureProjGrad_0P3B1B1B("textureProjGrad(0P3B1B1B"); +constexpr const ImmutableString textureProjGrad_0Q3B2B2B("textureProjGrad(0Q3B2B2B"); +constexpr const ImmutableString textureProjGrad_0U2B1B1B("textureProjGrad(0U2B1B1B"); +constexpr const ImmutableString textureProjGrad_0U3B1B1B("textureProjGrad(0U3B1B1B"); +constexpr const ImmutableString textureProjGrad_0V3B2B2B("textureProjGrad(0V3B2B2B"); +constexpr const ImmutableString textureProjGrad_0Z3B1B1B("textureProjGrad(0Z3B1B1B"); +constexpr const ImmutableString textureProjLod("textureProjLod"); +constexpr const ImmutableString textureProjLodOffset("textureProjLodOffset"); +constexpr const ImmutableString textureProjLodOffset_0H2B0B1C("textureProjLodOffset(0H2B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0H3B0B1C("textureProjLodOffset(0H3B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0I3B0B2C("textureProjLodOffset(0I3B0B2C"); +constexpr const ImmutableString textureProjLodOffset_0P2B0B1C("textureProjLodOffset(0P2B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0P3B0B1C("textureProjLodOffset(0P3B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0Q3B0B2C("textureProjLodOffset(0Q3B0B2C"); +constexpr const ImmutableString textureProjLodOffset_0U2B0B1C("textureProjLodOffset(0U2B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0U3B0B1C("textureProjLodOffset(0U3B0B1C"); +constexpr const ImmutableString textureProjLodOffset_0V3B0B2C("textureProjLodOffset(0V3B0B2C"); +constexpr const ImmutableString textureProjLodOffset_0Z3B0B1C("textureProjLodOffset(0Z3B0B1C"); +constexpr const ImmutableString textureProjLod_0H3B0B("textureProjLod(0H3B0B"); +constexpr const ImmutableString textureProjLod_0Q3B0B("textureProjLod(0Q3B0B"); +constexpr const ImmutableString textureProjLod_0V3B0B("textureProjLod(0V3B0B"); +constexpr const ImmutableString textureProjLod_0Z3B0B("textureProjLod(0Z3B0B"); +constexpr const ImmutableString textureProjOffset("textureProjOffset"); +constexpr const ImmutableString textureProjOffset_0H2B1C("textureProjOffset(0H2B1C"); +constexpr const ImmutableString textureProjOffset_0H2B1C0B("textureProjOffset(0H2B1C0B"); +constexpr const ImmutableString textureProjOffset_0H3B1C("textureProjOffset(0H3B1C"); +constexpr const ImmutableString textureProjOffset_0H3B1C0B("textureProjOffset(0H3B1C0B"); +constexpr const ImmutableString textureProjOffset_0I3B2C0B("textureProjOffset(0I3B2C0B"); +constexpr const ImmutableString textureProjOffset_0P2B1C0B("textureProjOffset(0P2B1C0B"); +constexpr const ImmutableString textureProjOffset_0P3B1C0B("textureProjOffset(0P3B1C0B"); +constexpr const ImmutableString textureProjOffset_0Q3B2C("textureProjOffset(0Q3B2C"); +constexpr const ImmutableString textureProjOffset_0Q3B2C0B("textureProjOffset(0Q3B2C0B"); +constexpr const ImmutableString textureProjOffset_0U2B1C("textureProjOffset(0U2B1C"); +constexpr const ImmutableString textureProjOffset_0U2B1C0B("textureProjOffset(0U2B1C0B"); +constexpr const ImmutableString textureProjOffset_0U3B1C0B("textureProjOffset(0U3B1C0B"); +constexpr const ImmutableString textureProjOffset_0V3B2C("textureProjOffset(0V3B2C"); +constexpr const ImmutableString textureProjOffset_0V3B2C0B("textureProjOffset(0V3B2C0B"); +constexpr const ImmutableString textureProjOffset_0Z3B1C0B("textureProjOffset(0Z3B1C0B"); +constexpr const ImmutableString textureSize("textureSize"); +constexpr const ImmutableString texture_0V2B0B("texture(0V2B0B"); +constexpr const ImmutableString texture_0W2B0B("texture(0W2B0B"); +constexpr const ImmutableString transpose("transpose"); +constexpr const ImmutableString trunc("trunc"); +constexpr const ImmutableString uaddCarry("uaddCarry"); +constexpr const ImmutableString uaddCarry_2D2D2D("uaddCarry(2D2D2D"); +constexpr const ImmutableString uaddCarry_3D3D3D("uaddCarry(3D3D3D"); +constexpr const ImmutableString uintBitsToFloat("uintBitsToFloat"); +constexpr const ImmutableString umulExtended("umulExtended"); +constexpr const ImmutableString umulExtended_0D0D0D0D("umulExtended(0D0D0D0D"); +constexpr const ImmutableString umulExtended_1D1D1D1D("umulExtended(1D1D1D1D"); +constexpr const ImmutableString umulExtended_2D2D2D2D("umulExtended(2D2D2D2D"); +constexpr const ImmutableString umulExtended_3D3D3D3D("umulExtended(3D3D3D3D"); +constexpr const ImmutableString unpackHalf2x16("unpackHalf2x16"); +constexpr const ImmutableString unpackSnorm2x16("unpackSnorm2x16"); +constexpr const ImmutableString unpackSnorm4x8("unpackSnorm4x8"); +constexpr const ImmutableString unpackUnorm2x16("unpackUnorm2x16"); +constexpr const ImmutableString unpackUnorm4x8("unpackUnorm4x8"); +constexpr const ImmutableString usubBorrow("usubBorrow"); +constexpr const ImmutableString usubBorrow_0D0D0D("usubBorrow(0D0D0D"); +constexpr const ImmutableString usubBorrow_1D1D1D("usubBorrow(1D1D1D"); +constexpr const ImmutableString usubBorrow_3D3D3D("usubBorrow(3D3D3D"); +constexpr const ImmutableString yuv_2_rgb("yuv_2_rgb"); + +} // namespace BuiltInName + +// TODO(oetuaho): Would be nice to make this a class instead of a namespace so that we could friend +// this from TVariable. Now symbol constructors taking an id have to be public even though they're +// not supposed to be accessible from outside of here. http://anglebug.com/2390 +namespace BuiltInVariable +{ + +constexpr const TVariable kVar_gl_FragColor( + BuiltInId::gl_FragColor, + BuiltInName::gl_FragColor, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_FragCoord( + BuiltInId::gl_FragCoord, + BuiltInName::gl_FragCoord, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_FragDepth( + BuiltInId::gl_FragDepth, + BuiltInName::gl_FragDepth, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_FrontFacing( + BuiltInId::gl_FrontFacing, + BuiltInName::gl_FrontFacing, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_GlobalInvocationID( + BuiltInId::gl_GlobalInvocationID, + BuiltInName::gl_GlobalInvocationID, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_InstanceID( + BuiltInId::gl_InstanceID, + BuiltInName::gl_InstanceID, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_InvocationID( + BuiltInId::gl_InvocationID, + BuiltInName::gl_InvocationID, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_LastFragColor( + BuiltInId::gl_LastFragColor, + BuiltInName::gl_LastFragColor, + SymbolType::BuiltIn, + TExtension::NV_shader_framebuffer_fetch, + StaticType::Get()); +constexpr const TVariable kVar_gl_LastFragColorARM( + BuiltInId::gl_LastFragColorARM, + BuiltInName::gl_LastFragColorARM, + SymbolType::BuiltIn, + TExtension::ARM_shader_framebuffer_fetch, + StaticType::Get()); +constexpr const TVariable kVar_gl_Layer(BuiltInId::gl_Layer, + BuiltInName::gl_Layer, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_LayerGS(BuiltInId::gl_LayerGS, + BuiltInName::gl_Layer, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_LayerVS(BuiltInId::gl_LayerVS, + BuiltInName::gl_Layer, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_LocalInvocationID( + BuiltInId::gl_LocalInvocationID, + BuiltInName::gl_LocalInvocationID, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_LocalInvocationIndex( + BuiltInId::gl_LocalInvocationIndex, + BuiltInName::gl_LocalInvocationIndex, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_NumWorkGroups( + BuiltInId::gl_NumWorkGroups, + BuiltInName::gl_NumWorkGroups, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_PointCoord( + BuiltInId::gl_PointCoord, + BuiltInName::gl_PointCoord, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_PointSize( + BuiltInId::gl_PointSize, + BuiltInName::gl_PointSize, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_Position(BuiltInId::gl_Position, + BuiltInName::gl_Position, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_PrimitiveID( + BuiltInId::gl_PrimitiveID, + BuiltInName::gl_PrimitiveID, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_PrimitiveIDGS( + BuiltInId::gl_PrimitiveIDGS, + BuiltInName::gl_PrimitiveID, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_PrimitiveIDIn( + BuiltInId::gl_PrimitiveIDIn, + BuiltInName::gl_PrimitiveIDIn, + SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, + StaticType::Get()); +constexpr const TVariable kVar_gl_SecondaryFragColorEXT( + BuiltInId::gl_SecondaryFragColorEXT, + BuiltInName::gl_SecondaryFragColorEXT, + SymbolType::BuiltIn, + TExtension::EXT_blend_func_extended, + StaticType::Get()); +constexpr const TVariable kVar_gl_VertexID(BuiltInId::gl_VertexID, + BuiltInName::gl_VertexID, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_ViewID_OVR( + BuiltInId::gl_ViewID_OVR, + BuiltInName::gl_ViewID_OVR, + SymbolType::BuiltIn, + TExtension::OVR_multiview, + StaticType::Get()); +constexpr const TVariable kVar_gl_ViewID_OVRESSL1( + BuiltInId::gl_ViewID_OVRESSL1, + BuiltInName::gl_ViewID_OVR, + SymbolType::BuiltIn, + TExtension::OVR_multiview, + StaticType::Get()); +constexpr const TVariable kVar_gl_ViewportIndex( + BuiltInId::gl_ViewportIndex, + BuiltInName::gl_ViewportIndex, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_WorkGroupID( + BuiltInId::gl_WorkGroupID, + BuiltInName::gl_WorkGroupID, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_gl_WorkGroupSize( + BuiltInId::gl_WorkGroupSize, + BuiltInName::gl_WorkGroupSize, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0B(BuiltInId::pt0B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0C(BuiltInId::pt0C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0D(BuiltInId::pt0D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0E(BuiltInId::pt0E, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0F( + BuiltInId::pt0F, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0G( + BuiltInId::pt0G, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0H(BuiltInId::pt0H, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0I(BuiltInId::pt0I, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0J( + BuiltInId::pt0J, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0K( + BuiltInId::pt0K, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0L( + BuiltInId::pt0L, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0M( + BuiltInId::pt0M, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0N( + BuiltInId::pt0N, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0O( + BuiltInId::pt0O, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0P( + BuiltInId::pt0P, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0Q( + BuiltInId::pt0Q, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0R( + BuiltInId::pt0R, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0S( + BuiltInId::pt0S, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0T( + BuiltInId::pt0T, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0U( + BuiltInId::pt0U, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0V( + BuiltInId::pt0V, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0W( + BuiltInId::pt0W, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0X( + BuiltInId::pt0X, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0Y( + BuiltInId::pt0Y, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0Z( + BuiltInId::pt0Z, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0a( + BuiltInId::pt0a, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0b( + BuiltInId::pt0b, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0c(BuiltInId::pt0c, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0d(BuiltInId::pt0d, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0e(BuiltInId::pt0e, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0f(BuiltInId::pt0f, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0g(BuiltInId::pt0g, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0h(BuiltInId::pt0h, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0i( + BuiltInId::pt0i, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0j( + BuiltInId::pt0j, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0k( + BuiltInId::pt0k, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0l(BuiltInId::pt0l, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0m( + BuiltInId::pt0m, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt0n( + BuiltInId::pt0n, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt1B(BuiltInId::pt1B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt1C(BuiltInId::pt1C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt1D(BuiltInId::pt1D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt1E(BuiltInId::pt1E, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt2B(BuiltInId::pt2B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt2C(BuiltInId::pt2C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt2D(BuiltInId::pt2D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt2E(BuiltInId::pt2E, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt3B(BuiltInId::pt3B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt3C(BuiltInId::pt3C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt3D(BuiltInId::pt3D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt3E(BuiltInId::pt3E, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt5B(BuiltInId::pt5B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt6B(BuiltInId::pt6B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt7B(BuiltInId::pt7B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt9B(BuiltInId::pt9B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_ptAB(BuiltInId::ptAB, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_ptBB(BuiltInId::ptBB, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_ptDB(BuiltInId::ptDB, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_ptEB(BuiltInId::ptEB, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_ptFB(BuiltInId::ptFB, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_io_0C(BuiltInId::pt_io_0C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_io_0D(BuiltInId::pt_io_0D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_0B(BuiltInId::pt_o_0B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_0C(BuiltInId::pt_o_0C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_0D(BuiltInId::pt_o_0D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_1B(BuiltInId::pt_o_1B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_1C(BuiltInId::pt_o_1C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_1D(BuiltInId::pt_o_1D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_2B(BuiltInId::pt_o_2B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_2C(BuiltInId::pt_o_2C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_2D(BuiltInId::pt_o_2D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_3B(BuiltInId::pt_o_3B, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_3C(BuiltInId::pt_o_3C, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); +constexpr const TVariable kVar_pt_o_3D(BuiltInId::pt_o_3D, + BuiltInName::_empty, + SymbolType::BuiltIn, + TExtension::UNDEFINED, + StaticType::Get()); + +const TVariable *gl_FragColor() +{ + return &kVar_gl_FragColor; +} + +const TVariable *gl_FragCoord() +{ + return &kVar_gl_FragCoord; +} + +const TVariable *gl_FragDepth() +{ + return &kVar_gl_FragDepth; +} + +const TVariable *gl_FrontFacing() +{ + return &kVar_gl_FrontFacing; +} + +const TVariable *gl_GlobalInvocationID() +{ + return &kVar_gl_GlobalInvocationID; +} + +const TVariable *gl_InstanceID() +{ + return &kVar_gl_InstanceID; +} + +const TVariable *gl_InvocationID() +{ + return &kVar_gl_InvocationID; +} + +const TVariable *gl_LastFragColor() +{ + return &kVar_gl_LastFragColor; +} + +const TVariable *gl_LastFragColorARM() +{ + return &kVar_gl_LastFragColorARM; +} + +const TVariable *gl_Layer() +{ + return &kVar_gl_Layer; +} + +const TVariable *gl_LayerGS() +{ + return &kVar_gl_LayerGS; +} + +const TVariable *gl_LayerVS() +{ + return &kVar_gl_LayerVS; +} + +const TVariable *gl_LocalInvocationID() +{ + return &kVar_gl_LocalInvocationID; +} + +const TVariable *gl_LocalInvocationIndex() +{ + return &kVar_gl_LocalInvocationIndex; +} + +const TVariable *gl_NumWorkGroups() +{ + return &kVar_gl_NumWorkGroups; +} + +const TVariable *gl_PointCoord() +{ + return &kVar_gl_PointCoord; +} + +const TVariable *gl_PointSize() +{ + return &kVar_gl_PointSize; +} + +const TVariable *gl_Position() +{ + return &kVar_gl_Position; +} + +const TVariable *gl_PrimitiveID() +{ + return &kVar_gl_PrimitiveID; +} + +const TVariable *gl_PrimitiveIDGS() +{ + return &kVar_gl_PrimitiveIDGS; +} + +const TVariable *gl_PrimitiveIDIn() +{ + return &kVar_gl_PrimitiveIDIn; +} + +const TVariable *gl_SecondaryFragColorEXT() +{ + return &kVar_gl_SecondaryFragColorEXT; +} + +const TVariable *gl_VertexID() +{ + return &kVar_gl_VertexID; +} + +const TVariable *gl_ViewID_OVR() +{ + return &kVar_gl_ViewID_OVR; +} + +const TVariable *gl_ViewID_OVRESSL1() +{ + return &kVar_gl_ViewID_OVRESSL1; +} + +const TVariable *gl_ViewportIndex() +{ + return &kVar_gl_ViewportIndex; +} + +const TVariable *gl_WorkGroupID() +{ + return &kVar_gl_WorkGroupID; +} + +const TVariable *gl_WorkGroupSize() +{ + return &kVar_gl_WorkGroupSize; +} + +}; // namespace BuiltInVariable + +namespace BuiltInParameters +{ + +constexpr const TVariable **empty = nullptr; +constexpr const TVariable *p0B0B0B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0B0B0E[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt0E}; +constexpr const TVariable *p0B0B1B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p0B0B2B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0B0B3B[3] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0B0C[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0B1B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p0B2B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0B3B[2] = {&BuiltInVariable::kVar_pt0B, &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0B_o_0B[2] = {&BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt_o_0B}; +constexpr const TVariable *p0B_o_0C[2] = {&BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt_o_0C}; +constexpr const TVariable *p0C0C0C0C[4] = {&BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0C0C_o_0C_o_0C[4] = { + &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt_o_0C, + &BuiltInVariable::kVar_pt_o_0C}; +constexpr const TVariable *p0D0C0C[3] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0D0D0C0C[4] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0D0D0D[3] = {&BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D, + &BuiltInVariable::kVar_pt0D}; +constexpr const TVariable *p0D0D_o_0D_o_0D[4] = { + &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt_o_0D, + &BuiltInVariable::kVar_pt_o_0D}; +constexpr const TVariable *p0F[1] = {&BuiltInVariable::kVar_pt0F}; +constexpr const TVariable *p0H0C[2] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0H1B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H1B0C[3] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0H1B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H1B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0H1B1C0C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0H1C0C1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H2B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H2B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0H3B0B1C[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H3B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0H3B1C0B[4] = {&BuiltInVariable::kVar_pt0H, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0I0C[2] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0I2B0B2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0I2B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0I2B2C0B[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0I2C0C2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0I3B0B2C[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0I3B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0I3B2C0B[4] = {&BuiltInVariable::kVar_pt0I, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0J0C[2] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0J2B0B[3] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0J2B0C[3] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0J2B2B2B[4] = {&BuiltInVariable::kVar_pt0J, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0K0C[2] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0K2B0B1C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0K2B0C[3] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0K2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0K2B1C0B[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0K2B1C0C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0K2C0C1C[4] = {&BuiltInVariable::kVar_pt0K, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0L0C[2] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0L1B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0L1C0C[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0L2B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0L3B0B[3] = {&BuiltInVariable::kVar_pt0L, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0M0C[2] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0M1B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0M1C0C[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0M2B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0M3B0B[3] = {&BuiltInVariable::kVar_pt0M, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0N1B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p0N2B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0N3B[2] = {&BuiltInVariable::kVar_pt0N, &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0O1C0C[3] = {&BuiltInVariable::kVar_pt0O, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0P0C[2] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0P1B0B1C[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P1B0C[3] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0P1B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P1B1C0B[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0P1B1C0C[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0P1C0C1C[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P2B0B1C[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P2B1C0B[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0P3B0B1C[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P3B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0P3B1C0B[4] = {&BuiltInVariable::kVar_pt0P, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0Q0C[2] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0Q2B0B2C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0Q2B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0Q2B2C0B[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0Q2C0C2C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0Q3B0B2C[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0Q3B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0Q3B2C0B[4] = {&BuiltInVariable::kVar_pt0Q, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0R0C[2] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0R2B0B[3] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0R2B0C[3] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0R2B2B2B[4] = {&BuiltInVariable::kVar_pt0R, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0S0C[2] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0S2B0B1C[4] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0S2B0C[3] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0S2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0S2B1C0B[4] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0S2B1C0C[4] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0S2C0C1C[4] = {&BuiltInVariable::kVar_pt0S, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0T1C0C[3] = {&BuiltInVariable::kVar_pt0T, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0U0C[2] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0U1B0B1C[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U1B0C[3] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0U1B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U1B1C0B[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0U1B1C0C[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0U1C0C1C[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U2B0B1C[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U2B1C0B[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0U3B0B1C[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U3B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0U3B1C0B[4] = {&BuiltInVariable::kVar_pt0U, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0V0C[2] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0V2B0B2C[4] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0V2B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0V2B2C0B[4] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0V2C0C2C[4] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0V3B0B2C[4] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0V3B2B2B2C[5] = { + &BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p0V3B2C0B[4] = {&BuiltInVariable::kVar_pt0V, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0W0C[2] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0W2B0B[3] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0W2B0C[3] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0W2B2B2B[4] = {&BuiltInVariable::kVar_pt0W, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0X0C[2] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0X2B0B1C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0X2B0C[3] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0X2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0X2B1C0B[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0X2B1C0C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0X2C0C1C[4] = {&BuiltInVariable::kVar_pt0X, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Y1C0C[3] = {&BuiltInVariable::kVar_pt0Y, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0Z0C[2] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0Z1B0B1C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Z2B0B1C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Z2B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Z2B1C0B[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0Z3B0B1C[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Z3B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0Z3B1C0B[4] = {&BuiltInVariable::kVar_pt0Z, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0a0C[2] = {&BuiltInVariable::kVar_pt0a, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0a2B0B[3] = {&BuiltInVariable::kVar_pt0a, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0a3B0B[3] = {&BuiltInVariable::kVar_pt0a, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p0a3B2B2B[4] = {&BuiltInVariable::kVar_pt0a, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p0b0C[2] = {&BuiltInVariable::kVar_pt0b, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p0b2B0B1C[4] = {&BuiltInVariable::kVar_pt0b, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0b3B1B1B1C[5] = { + &BuiltInVariable::kVar_pt0b, &BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p0c1C3B[3] = {&BuiltInVariable::kVar_pt0c, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0d1C3C[3] = {&BuiltInVariable::kVar_pt0d, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p0e1C3D[3] = {&BuiltInVariable::kVar_pt0e, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt3D}; +constexpr const TVariable *p0f2C3B[3] = {&BuiltInVariable::kVar_pt0f, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0g2C3C[3] = {&BuiltInVariable::kVar_pt0g, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p0h2C3D[3] = {&BuiltInVariable::kVar_pt0h, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3D}; +constexpr const TVariable *p0i2C3B[3] = {&BuiltInVariable::kVar_pt0i, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0j2C3C[3] = {&BuiltInVariable::kVar_pt0j, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p0k2C3D[3] = {&BuiltInVariable::kVar_pt0k, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3D}; +constexpr const TVariable *p0l2C3B[3] = {&BuiltInVariable::kVar_pt0l, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p0m2C3C[3] = {&BuiltInVariable::kVar_pt0m, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p0n2C3D[3] = {&BuiltInVariable::kVar_pt0n, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt3D}; +constexpr const TVariable *p1B0B0B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p1B1B0B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p1B1B1B[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p1B1B1E[3] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt1E}; +constexpr const TVariable *p1B1C[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p1B2B[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p1B3B[2] = {&BuiltInVariable::kVar_pt1B, &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p1B_o_1B[2] = {&BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt_o_1B}; +constexpr const TVariable *p1B_o_1C[2] = {&BuiltInVariable::kVar_pt1B, + &BuiltInVariable::kVar_pt_o_1C}; +constexpr const TVariable *p1C0C0C[3] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p1C1C0C0C[4] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p1C1C1C[3] = {&BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C, + &BuiltInVariable::kVar_pt1C}; +constexpr const TVariable *p1C1C_o_1C_o_1C[4] = { + &BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt1C, &BuiltInVariable::kVar_pt_o_1C, + &BuiltInVariable::kVar_pt_o_1C}; +constexpr const TVariable *p1D0C0C[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p1D0D0D[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt0D, + &BuiltInVariable::kVar_pt0D}; +constexpr const TVariable *p1D1D0C0C[4] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p1D1D1D[3] = {&BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D, + &BuiltInVariable::kVar_pt1D}; +constexpr const TVariable *p1D1D_o_1D_o_1D[4] = { + &BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt1D, &BuiltInVariable::kVar_pt_o_1D, + &BuiltInVariable::kVar_pt_o_1D}; +constexpr const TVariable *p1E1E[2] = {&BuiltInVariable::kVar_pt1E, &BuiltInVariable::kVar_pt1E}; +constexpr const TVariable *p2B0B0B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p2B0G[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt0G}; +constexpr const TVariable *p2B1B[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p2B2B0B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p2B2B2B[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p2B2B2E[3] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt2E}; +constexpr const TVariable *p2B2C[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p2B3B[2] = {&BuiltInVariable::kVar_pt2B, &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p2B_o_2B[2] = {&BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt_o_2B}; +constexpr const TVariable *p2B_o_2C[2] = {&BuiltInVariable::kVar_pt2B, + &BuiltInVariable::kVar_pt_o_2C}; +constexpr const TVariable *p2C0C0C[3] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p2C2C0C0C[4] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p2C2C2C[3] = {&BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C, + &BuiltInVariable::kVar_pt2C}; +constexpr const TVariable *p2C2C_o_2C_o_2C[4] = { + &BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt2C, &BuiltInVariable::kVar_pt_o_2C, + &BuiltInVariable::kVar_pt_o_2C}; +constexpr const TVariable *p2D0C0C[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p2D0D0D[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt0D, + &BuiltInVariable::kVar_pt0D}; +constexpr const TVariable *p2D2D0C0C[4] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p2D2D2D[3] = {&BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D, + &BuiltInVariable::kVar_pt2D}; +constexpr const TVariable *p2D2D_o_2D_o_2D[4] = { + &BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt2D, &BuiltInVariable::kVar_pt_o_2D, + &BuiltInVariable::kVar_pt_o_2D}; +constexpr const TVariable *p2E2E[2] = {&BuiltInVariable::kVar_pt2E, &BuiltInVariable::kVar_pt2E}; +constexpr const TVariable *p3B0B0B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt0B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p3B1B[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt1B}; +constexpr const TVariable *p3B2B[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt2B}; +constexpr const TVariable *p3B3B0B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt0B}; +constexpr const TVariable *p3B3B3B[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt3B}; +constexpr const TVariable *p3B3B3E[3] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt3E}; +constexpr const TVariable *p3B3C[2] = {&BuiltInVariable::kVar_pt3B, &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p3B_o_3B[2] = {&BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt_o_3B}; +constexpr const TVariable *p3B_o_3C[2] = {&BuiltInVariable::kVar_pt3B, + &BuiltInVariable::kVar_pt_o_3C}; +constexpr const TVariable *p3C0C0C[3] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p3C3C0C0C[4] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p3C3C3C[3] = {&BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C, + &BuiltInVariable::kVar_pt3C}; +constexpr const TVariable *p3C3C_o_3C_o_3C[4] = { + &BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt3C, &BuiltInVariable::kVar_pt_o_3C, + &BuiltInVariable::kVar_pt_o_3C}; +constexpr const TVariable *p3D0C0C[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p3D0D0D[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt0D, + &BuiltInVariable::kVar_pt0D}; +constexpr const TVariable *p3D3D0C0C[4] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D, + &BuiltInVariable::kVar_pt0C, + &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p3D3D3D[3] = {&BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D, + &BuiltInVariable::kVar_pt3D}; +constexpr const TVariable *p3D3D_o_3D_o_3D[4] = { + &BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt3D, &BuiltInVariable::kVar_pt_o_3D, + &BuiltInVariable::kVar_pt_o_3D}; +constexpr const TVariable *p3E3E[2] = {&BuiltInVariable::kVar_pt3E, &BuiltInVariable::kVar_pt3E}; +constexpr const TVariable *p5B5B[2] = {&BuiltInVariable::kVar_pt5B, &BuiltInVariable::kVar_pt5B}; +constexpr const TVariable *p6B6B[2] = {&BuiltInVariable::kVar_pt6B, &BuiltInVariable::kVar_pt6B}; +constexpr const TVariable *p7B7B[2] = {&BuiltInVariable::kVar_pt7B, &BuiltInVariable::kVar_pt7B}; +constexpr const TVariable *p9B9B[2] = {&BuiltInVariable::kVar_pt9B, &BuiltInVariable::kVar_pt9B}; +constexpr const TVariable *pABAB[2] = {&BuiltInVariable::kVar_ptAB, &BuiltInVariable::kVar_ptAB}; +constexpr const TVariable *pBBBB[2] = {&BuiltInVariable::kVar_ptBB, &BuiltInVariable::kVar_ptBB}; +constexpr const TVariable *pDBDB[2] = {&BuiltInVariable::kVar_ptDB, &BuiltInVariable::kVar_ptDB}; +constexpr const TVariable *pEBEB[2] = {&BuiltInVariable::kVar_ptEB, &BuiltInVariable::kVar_ptEB}; +constexpr const TVariable *pFBFB[2] = {&BuiltInVariable::kVar_ptFB, &BuiltInVariable::kVar_ptFB}; +constexpr const TVariable *p_io_0C0C0C[3] = { + &BuiltInVariable::kVar_pt_io_0C, &BuiltInVariable::kVar_pt0C, &BuiltInVariable::kVar_pt0C}; +constexpr const TVariable *p_io_0D0D0D[3] = { + &BuiltInVariable::kVar_pt_io_0D, &BuiltInVariable::kVar_pt0D, &BuiltInVariable::kVar_pt0D}; + +} // namespace BuiltInParameters + +namespace UnmangledBuiltIns +{ + +constexpr const UnmangledBuiltIn ARB_texture_rectangle(TExtension::ARB_texture_rectangle); +constexpr const UnmangledBuiltIn EXT_YUV_target(TExtension::EXT_YUV_target); +constexpr const UnmangledBuiltIn EXT_geometry_shader(TExtension::EXT_geometry_shader); +constexpr const UnmangledBuiltIn EXT_shader_texture_lod(TExtension::EXT_shader_texture_lod); +constexpr const UnmangledBuiltIn OES_standard_derivatives(TExtension::OES_standard_derivatives); +constexpr const UnmangledBuiltIn UNDEFINED(TExtension::UNDEFINED); + +} // namespace UnmangledBuiltIns + +// TODO(oetuaho): Would be nice to make this a class instead of a namespace so that we could friend +// this from TFunction. Now symbol constructors taking an id have to be public even though they're +// not supposed to be accessible from outside of here. http://anglebug.com/2390 +namespace BuiltInFunction +{ + +constexpr const TFunction kFunction_radians_0B( + BuiltInId::radians_Float1, + BuiltInName::radians, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpRadians, + true); +constexpr const TFunction kFunction_radians_1B( + BuiltInId::radians_Float2, + BuiltInName::radians, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpRadians, + true); +constexpr const TFunction kFunction_radians_2B( + BuiltInId::radians_Float3, + BuiltInName::radians, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpRadians, + true); +constexpr const TFunction kFunction_radians_3B( + BuiltInId::radians_Float4, + BuiltInName::radians, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpRadians, + true); +constexpr const TFunction kFunction_degrees_0B( + BuiltInId::degrees_Float1, + BuiltInName::degrees, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpDegrees, + true); +constexpr const TFunction kFunction_degrees_1B( + BuiltInId::degrees_Float2, + BuiltInName::degrees, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpDegrees, + true); +constexpr const TFunction kFunction_degrees_2B( + BuiltInId::degrees_Float3, + BuiltInName::degrees, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpDegrees, + true); +constexpr const TFunction kFunction_degrees_3B( + BuiltInId::degrees_Float4, + BuiltInName::degrees, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpDegrees, + true); +constexpr const TFunction kFunction_sin_0B( + BuiltInId::sin_Float1, + BuiltInName::sin, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpSin, + true); +constexpr const TFunction kFunction_sin_1B( + BuiltInId::sin_Float2, + BuiltInName::sin, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpSin, + true); +constexpr const TFunction kFunction_sin_2B( + BuiltInId::sin_Float3, + BuiltInName::sin, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpSin, + true); +constexpr const TFunction kFunction_sin_3B( + BuiltInId::sin_Float4, + BuiltInName::sin, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpSin, + true); +constexpr const TFunction kFunction_cos_0B( + BuiltInId::cos_Float1, + BuiltInName::cos, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpCos, + true); +constexpr const TFunction kFunction_cos_1B( + BuiltInId::cos_Float2, + BuiltInName::cos, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpCos, + true); +constexpr const TFunction kFunction_cos_2B( + BuiltInId::cos_Float3, + BuiltInName::cos, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpCos, + true); +constexpr const TFunction kFunction_cos_3B( + BuiltInId::cos_Float4, + BuiltInName::cos, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpCos, + true); +constexpr const TFunction kFunction_tan_0B( + BuiltInId::tan_Float1, + BuiltInName::tan, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpTan, + true); +constexpr const TFunction kFunction_tan_1B( + BuiltInId::tan_Float2, + BuiltInName::tan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpTan, + true); +constexpr const TFunction kFunction_tan_2B( + BuiltInId::tan_Float3, + BuiltInName::tan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpTan, + true); +constexpr const TFunction kFunction_tan_3B( + BuiltInId::tan_Float4, + BuiltInName::tan, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpTan, + true); +constexpr const TFunction kFunction_asin_0B( + BuiltInId::asin_Float1, + BuiltInName::asin, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAsin, + true); +constexpr const TFunction kFunction_asin_1B( + BuiltInId::asin_Float2, + BuiltInName::asin, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAsin, + true); +constexpr const TFunction kFunction_asin_2B( + BuiltInId::asin_Float3, + BuiltInName::asin, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAsin, + true); +constexpr const TFunction kFunction_asin_3B( + BuiltInId::asin_Float4, + BuiltInName::asin, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAsin, + true); +constexpr const TFunction kFunction_acos_0B( + BuiltInId::acos_Float1, + BuiltInName::acos, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAcos, + true); +constexpr const TFunction kFunction_acos_1B( + BuiltInId::acos_Float2, + BuiltInName::acos, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAcos, + true); +constexpr const TFunction kFunction_acos_2B( + BuiltInId::acos_Float3, + BuiltInName::acos, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAcos, + true); +constexpr const TFunction kFunction_acos_3B( + BuiltInId::acos_Float4, + BuiltInName::acos, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAcos, + true); +constexpr const TFunction kFunction_atan_0B0B( + BuiltInId::atan_Float1_Float1, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_1B1B( + BuiltInId::atan_Float2_Float2, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_2B2B( + BuiltInId::atan_Float3_Float3, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_3B3B( + BuiltInId::atan_Float4_Float4, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_0B( + BuiltInId::atan_Float1, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_1B( + BuiltInId::atan_Float2, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_2B( + BuiltInId::atan_Float3, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_atan_3B( + BuiltInId::atan_Float4, + BuiltInName::atan, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAtan, + true); +constexpr const TFunction kFunction_sinh_0B( + BuiltInId::sinh_Float1, + BuiltInName::sinh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpSinh, + true); +constexpr const TFunction kFunction_sinh_1B( + BuiltInId::sinh_Float2, + BuiltInName::sinh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpSinh, + true); +constexpr const TFunction kFunction_sinh_2B( + BuiltInId::sinh_Float3, + BuiltInName::sinh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpSinh, + true); +constexpr const TFunction kFunction_sinh_3B( + BuiltInId::sinh_Float4, + BuiltInName::sinh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpSinh, + true); +constexpr const TFunction kFunction_cosh_0B( + BuiltInId::cosh_Float1, + BuiltInName::cosh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpCosh, + true); +constexpr const TFunction kFunction_cosh_1B( + BuiltInId::cosh_Float2, + BuiltInName::cosh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpCosh, + true); +constexpr const TFunction kFunction_cosh_2B( + BuiltInId::cosh_Float3, + BuiltInName::cosh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpCosh, + true); +constexpr const TFunction kFunction_cosh_3B( + BuiltInId::cosh_Float4, + BuiltInName::cosh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpCosh, + true); +constexpr const TFunction kFunction_tanh_0B( + BuiltInId::tanh_Float1, + BuiltInName::tanh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpTanh, + true); +constexpr const TFunction kFunction_tanh_1B( + BuiltInId::tanh_Float2, + BuiltInName::tanh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpTanh, + true); +constexpr const TFunction kFunction_tanh_2B( + BuiltInId::tanh_Float3, + BuiltInName::tanh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpTanh, + true); +constexpr const TFunction kFunction_tanh_3B( + BuiltInId::tanh_Float4, + BuiltInName::tanh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpTanh, + true); +constexpr const TFunction kFunction_asinh_0B( + BuiltInId::asinh_Float1, + BuiltInName::asinh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAsinh, + true); +constexpr const TFunction kFunction_asinh_1B( + BuiltInId::asinh_Float2, + BuiltInName::asinh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAsinh, + true); +constexpr const TFunction kFunction_asinh_2B( + BuiltInId::asinh_Float3, + BuiltInName::asinh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAsinh, + true); +constexpr const TFunction kFunction_asinh_3B( + BuiltInId::asinh_Float4, + BuiltInName::asinh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAsinh, + true); +constexpr const TFunction kFunction_acosh_0B( + BuiltInId::acosh_Float1, + BuiltInName::acosh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAcosh, + true); +constexpr const TFunction kFunction_acosh_1B( + BuiltInId::acosh_Float2, + BuiltInName::acosh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAcosh, + true); +constexpr const TFunction kFunction_acosh_2B( + BuiltInId::acosh_Float3, + BuiltInName::acosh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAcosh, + true); +constexpr const TFunction kFunction_acosh_3B( + BuiltInId::acosh_Float4, + BuiltInName::acosh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAcosh, + true); +constexpr const TFunction kFunction_atanh_0B( + BuiltInId::atanh_Float1, + BuiltInName::atanh, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAtanh, + true); +constexpr const TFunction kFunction_atanh_1B( + BuiltInId::atanh_Float2, + BuiltInName::atanh, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAtanh, + true); +constexpr const TFunction kFunction_atanh_2B( + BuiltInId::atanh_Float3, + BuiltInName::atanh, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAtanh, + true); +constexpr const TFunction kFunction_atanh_3B( + BuiltInId::atanh_Float4, + BuiltInName::atanh, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAtanh, + true); +constexpr const TFunction kFunction_pow_0B0B( + BuiltInId::pow_Float1_Float1, + BuiltInName::pow, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpPow, + true); +constexpr const TFunction kFunction_pow_1B1B( + BuiltInId::pow_Float2_Float2, + BuiltInName::pow, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpPow, + true); +constexpr const TFunction kFunction_pow_2B2B( + BuiltInId::pow_Float3_Float3, + BuiltInName::pow, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpPow, + true); +constexpr const TFunction kFunction_pow_3B3B( + BuiltInId::pow_Float4_Float4, + BuiltInName::pow, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpPow, + true); +constexpr const TFunction kFunction_exp_0B( + BuiltInId::exp_Float1, + BuiltInName::exp, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpExp, + true); +constexpr const TFunction kFunction_exp_1B( + BuiltInId::exp_Float2, + BuiltInName::exp, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpExp, + true); +constexpr const TFunction kFunction_exp_2B( + BuiltInId::exp_Float3, + BuiltInName::exp, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpExp, + true); +constexpr const TFunction kFunction_exp_3B( + BuiltInId::exp_Float4, + BuiltInName::exp, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpExp, + true); +constexpr const TFunction kFunction_log_0B( + BuiltInId::log_Float1, + BuiltInName::log, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpLog, + true); +constexpr const TFunction kFunction_log_1B( + BuiltInId::log_Float2, + BuiltInName::log, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpLog, + true); +constexpr const TFunction kFunction_log_2B( + BuiltInId::log_Float3, + BuiltInName::log, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpLog, + true); +constexpr const TFunction kFunction_log_3B( + BuiltInId::log_Float4, + BuiltInName::log, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpLog, + true); +constexpr const TFunction kFunction_exp2_0B( + BuiltInId::exp2_Float1, + BuiltInName::exp2, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpExp2, + true); +constexpr const TFunction kFunction_exp2_1B( + BuiltInId::exp2_Float2, + BuiltInName::exp2, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpExp2, + true); +constexpr const TFunction kFunction_exp2_2B( + BuiltInId::exp2_Float3, + BuiltInName::exp2, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpExp2, + true); +constexpr const TFunction kFunction_exp2_3B( + BuiltInId::exp2_Float4, + BuiltInName::exp2, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpExp2, + true); +constexpr const TFunction kFunction_log2_0B( + BuiltInId::log2_Float1, + BuiltInName::log2, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpLog2, + true); +constexpr const TFunction kFunction_log2_1B( + BuiltInId::log2_Float2, + BuiltInName::log2, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpLog2, + true); +constexpr const TFunction kFunction_log2_2B( + BuiltInId::log2_Float3, + BuiltInName::log2, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpLog2, + true); +constexpr const TFunction kFunction_log2_3B( + BuiltInId::log2_Float4, + BuiltInName::log2, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpLog2, + true); +constexpr const TFunction kFunction_sqrt_0B( + BuiltInId::sqrt_Float1, + BuiltInName::sqrt, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpSqrt, + true); +constexpr const TFunction kFunction_sqrt_1B( + BuiltInId::sqrt_Float2, + BuiltInName::sqrt, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpSqrt, + true); +constexpr const TFunction kFunction_sqrt_2B( + BuiltInId::sqrt_Float3, + BuiltInName::sqrt, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpSqrt, + true); +constexpr const TFunction kFunction_sqrt_3B( + BuiltInId::sqrt_Float4, + BuiltInName::sqrt, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpSqrt, + true); +constexpr const TFunction kFunction_inversesqrt_0B( + BuiltInId::inversesqrt_Float1, + BuiltInName::inversesqrt, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpInversesqrt, + true); +constexpr const TFunction kFunction_inversesqrt_1B( + BuiltInId::inversesqrt_Float2, + BuiltInName::inversesqrt, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpInversesqrt, + true); +constexpr const TFunction kFunction_inversesqrt_2B( + BuiltInId::inversesqrt_Float3, + BuiltInName::inversesqrt, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpInversesqrt, + true); +constexpr const TFunction kFunction_inversesqrt_3B( + BuiltInId::inversesqrt_Float4, + BuiltInName::inversesqrt, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpInversesqrt, + true); +constexpr const TFunction kFunction_abs_0B( + BuiltInId::abs_Float1, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_1B( + BuiltInId::abs_Float2, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_2B( + BuiltInId::abs_Float3, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_3B( + BuiltInId::abs_Float4, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_0C(BuiltInId::abs_Int1, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_1C(BuiltInId::abs_Int2, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_2C(BuiltInId::abs_Int3, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_abs_3C(BuiltInId::abs_Int4, + BuiltInName::abs, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpAbs, + true); +constexpr const TFunction kFunction_sign_0B( + BuiltInId::sign_Float1, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_1B( + BuiltInId::sign_Float2, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_2B( + BuiltInId::sign_Float3, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_3B( + BuiltInId::sign_Float4, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_0C( + BuiltInId::sign_Int1, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_1C( + BuiltInId::sign_Int2, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_2C( + BuiltInId::sign_Int3, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_sign_3C( + BuiltInId::sign_Int4, + BuiltInName::sign, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpSign, + true); +constexpr const TFunction kFunction_floor_0B( + BuiltInId::floor_Float1, + BuiltInName::floor, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFloor, + true); +constexpr const TFunction kFunction_floor_1B( + BuiltInId::floor_Float2, + BuiltInName::floor, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFloor, + true); +constexpr const TFunction kFunction_floor_2B( + BuiltInId::floor_Float3, + BuiltInName::floor, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFloor, + true); +constexpr const TFunction kFunction_floor_3B( + BuiltInId::floor_Float4, + BuiltInName::floor, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFloor, + true); +constexpr const TFunction kFunction_trunc_0B( + BuiltInId::trunc_Float1, + BuiltInName::trunc, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpTrunc, + true); +constexpr const TFunction kFunction_trunc_1B( + BuiltInId::trunc_Float2, + BuiltInName::trunc, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpTrunc, + true); +constexpr const TFunction kFunction_trunc_2B( + BuiltInId::trunc_Float3, + BuiltInName::trunc, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpTrunc, + true); +constexpr const TFunction kFunction_trunc_3B( + BuiltInId::trunc_Float4, + BuiltInName::trunc, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpTrunc, + true); +constexpr const TFunction kFunction_round_0B( + BuiltInId::round_Float1, + BuiltInName::round, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpRound, + true); +constexpr const TFunction kFunction_round_1B( + BuiltInId::round_Float2, + BuiltInName::round, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpRound, + true); +constexpr const TFunction kFunction_round_2B( + BuiltInId::round_Float3, + BuiltInName::round, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpRound, + true); +constexpr const TFunction kFunction_round_3B( + BuiltInId::round_Float4, + BuiltInName::round, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpRound, + true); +constexpr const TFunction kFunction_roundEven_0B( + BuiltInId::roundEven_Float1, + BuiltInName::roundEven, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpRoundEven, + true); +constexpr const TFunction kFunction_roundEven_1B( + BuiltInId::roundEven_Float2, + BuiltInName::roundEven, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpRoundEven, + true); +constexpr const TFunction kFunction_roundEven_2B( + BuiltInId::roundEven_Float3, + BuiltInName::roundEven, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpRoundEven, + true); +constexpr const TFunction kFunction_roundEven_3B( + BuiltInId::roundEven_Float4, + BuiltInName::roundEven, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpRoundEven, + true); +constexpr const TFunction kFunction_ceil_0B( + BuiltInId::ceil_Float1, + BuiltInName::ceil, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpCeil, + true); +constexpr const TFunction kFunction_ceil_1B( + BuiltInId::ceil_Float2, + BuiltInName::ceil, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpCeil, + true); +constexpr const TFunction kFunction_ceil_2B( + BuiltInId::ceil_Float3, + BuiltInName::ceil, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpCeil, + true); +constexpr const TFunction kFunction_ceil_3B( + BuiltInId::ceil_Float4, + BuiltInName::ceil, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpCeil, + true); +constexpr const TFunction kFunction_fract_0B( + BuiltInId::fract_Float1, + BuiltInName::fract, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFract, + true); +constexpr const TFunction kFunction_fract_1B( + BuiltInId::fract_Float2, + BuiltInName::fract, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFract, + true); +constexpr const TFunction kFunction_fract_2B( + BuiltInId::fract_Float3, + BuiltInName::fract, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFract, + true); +constexpr const TFunction kFunction_fract_3B( + BuiltInId::fract_Float4, + BuiltInName::fract, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFract, + true); +constexpr const TFunction kFunction_mod_0B0B( + BuiltInId::mod_Float1_Float1, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_1B0B( + BuiltInId::mod_Float2_Float1, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p1B0B0B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_2B0B( + BuiltInId::mod_Float3_Float1, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p2B0B0B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_3B0B( + BuiltInId::mod_Float4_Float1, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p3B0B0B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_1B1B( + BuiltInId::mod_Float2_Float2, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_2B2B( + BuiltInId::mod_Float3_Float3, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_mod_3B3B( + BuiltInId::mod_Float4_Float4, + BuiltInName::mod, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpMod, + true); +constexpr const TFunction kFunction_min_0B0B( + BuiltInId::min_Float1_Float1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1B0B( + BuiltInId::min_Float2_Float1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1B0B0B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2B0B( + BuiltInId::min_Float3_Float1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2B0B0B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3B0B( + BuiltInId::min_Float4_Float1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3B0B0B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1B1B( + BuiltInId::min_Float2_Float2, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2B2B( + BuiltInId::min_Float3_Float3, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3B3B( + BuiltInId::min_Float4_Float4, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_0C0C( + BuiltInId::min_Int1_Int1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1C1C( + BuiltInId::min_Int2_Int2, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2C2C( + BuiltInId::min_Int3_Int3, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3C3C( + BuiltInId::min_Int4_Int4, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1C0C( + BuiltInId::min_Int2_Int1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2C0C( + BuiltInId::min_Int3_Int1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3C0C( + BuiltInId::min_Int4_Int1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_0D0D( + BuiltInId::min_UInt1_UInt1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1D1D( + BuiltInId::min_UInt2_UInt2, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2D2D( + BuiltInId::min_UInt3_UInt3, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3D3D( + BuiltInId::min_UInt4_UInt4, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_1D0D( + BuiltInId::min_UInt2_UInt1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p1D0D0D, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_2D0D( + BuiltInId::min_UInt3_UInt1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p2D0D0D, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_min_3D0D( + BuiltInId::min_UInt4_UInt1, + BuiltInName::min, + TExtension::UNDEFINED, + BuiltInParameters::p3D0D0D, + 2, + StaticType::Get(), + EOpMin, + true); +constexpr const TFunction kFunction_max_0B0B( + BuiltInId::max_Float1_Float1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1B0B( + BuiltInId::max_Float2_Float1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1B0B0B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2B0B( + BuiltInId::max_Float3_Float1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2B0B0B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3B0B( + BuiltInId::max_Float4_Float1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3B0B0B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1B1B( + BuiltInId::max_Float2_Float2, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2B2B( + BuiltInId::max_Float3_Float3, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3B3B( + BuiltInId::max_Float4_Float4, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_0C0C( + BuiltInId::max_Int1_Int1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1C1C( + BuiltInId::max_Int2_Int2, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2C2C( + BuiltInId::max_Int3_Int3, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3C3C( + BuiltInId::max_Int4_Int4, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1C0C( + BuiltInId::max_Int2_Int1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2C0C( + BuiltInId::max_Int3_Int1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3C0C( + BuiltInId::max_Int4_Int1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_0D0D( + BuiltInId::max_UInt1_UInt1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1D1D( + BuiltInId::max_UInt2_UInt2, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2D2D( + BuiltInId::max_UInt3_UInt3, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3D3D( + BuiltInId::max_UInt4_UInt4, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_1D0D( + BuiltInId::max_UInt2_UInt1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p1D0D0D, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_2D0D( + BuiltInId::max_UInt3_UInt1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p2D0D0D, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_max_3D0D( + BuiltInId::max_UInt4_UInt1, + BuiltInName::max, + TExtension::UNDEFINED, + BuiltInParameters::p3D0D0D, + 2, + StaticType::Get(), + EOpMax, + true); +constexpr const TFunction kFunction_clamp_0B0B0B( + BuiltInId::clamp_Float1_Float1_Float1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1B0B0B( + BuiltInId::clamp_Float2_Float1_Float1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1B0B0B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2B0B0B( + BuiltInId::clamp_Float3_Float1_Float1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2B0B0B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3B0B0B( + BuiltInId::clamp_Float4_Float1_Float1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3B0B0B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1B1B1B( + BuiltInId::clamp_Float2_Float2_Float2, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B1B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2B2B2B( + BuiltInId::clamp_Float3_Float3_Float3, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B2B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3B3B3B( + BuiltInId::clamp_Float4_Float4_Float4, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_0C0C0C( + BuiltInId::clamp_Int1_Int1_Int1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C0C0C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1C0C0C( + BuiltInId::clamp_Int2_Int1_Int1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1C0C0C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2C0C0C( + BuiltInId::clamp_Int3_Int1_Int1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2C0C0C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3C0C0C( + BuiltInId::clamp_Int4_Int1_Int1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1C1C1C( + BuiltInId::clamp_Int2_Int2_Int2, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C1C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2C2C2C( + BuiltInId::clamp_Int3_Int3_Int3, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C2C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3C3C3C( + BuiltInId::clamp_Int4_Int4_Int4, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C3C, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_0D0D0D( + BuiltInId::clamp_UInt1_UInt1_UInt1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D0D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1D0D0D( + BuiltInId::clamp_UInt2_UInt1_UInt1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1D0D0D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2D0D0D( + BuiltInId::clamp_UInt3_UInt1_UInt1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2D0D0D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3D0D0D( + BuiltInId::clamp_UInt4_UInt1_UInt1, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3D0D0D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_1D1D1D( + BuiltInId::clamp_UInt2_UInt2_UInt2, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D1D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_2D2D2D( + BuiltInId::clamp_UInt3_UInt3_UInt3, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D2D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_clamp_3D3D3D( + BuiltInId::clamp_UInt4_UInt4_UInt4, + BuiltInName::clamp, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D3D, + 3, + StaticType::Get(), + EOpClamp, + true); +constexpr const TFunction kFunction_mix_0B0B0B( + BuiltInId::mix_Float1_Float1_Float1, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_1B1B0B( + BuiltInId::mix_Float2_Float2_Float1, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_2B2B0B( + BuiltInId::mix_Float3_Float3_Float1, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_3B3B0B( + BuiltInId::mix_Float4_Float4_Float1, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B0B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_1B1B1B( + BuiltInId::mix_Float2_Float2_Float2, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B1B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_2B2B2B( + BuiltInId::mix_Float3_Float3_Float3, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B2B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_3B3B3B( + BuiltInId::mix_Float4_Float4_Float4, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_0B0B0E( + BuiltInId::mix_Float1_Float1_Bool1, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0E, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_1B1B1E( + BuiltInId::mix_Float2_Float2_Bool2, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B1E, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_2B2B2E( + BuiltInId::mix_Float3_Float3_Bool3, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B2E, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_mix_3B3B3E( + BuiltInId::mix_Float4_Float4_Bool4, + BuiltInName::mix, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3E, + 3, + StaticType::Get(), + EOpMix, + true); +constexpr const TFunction kFunction_step_0B0B( + BuiltInId::step_Float1_Float1, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_1B1B( + BuiltInId::step_Float2_Float2, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_2B2B( + BuiltInId::step_Float3_Float3, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_3B3B( + BuiltInId::step_Float4_Float4, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_0B1B( + BuiltInId::step_Float1_Float2, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p0B1B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_0B2B( + BuiltInId::step_Float1_Float3, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p0B2B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_step_0B3B( + BuiltInId::step_Float1_Float4, + BuiltInName::step, + TExtension::UNDEFINED, + BuiltInParameters::p0B3B, + 2, + StaticType::Get(), + EOpStep, + true); +constexpr const TFunction kFunction_smoothstep_0B0B0B( + BuiltInId::smoothstep_Float1_Float1_Float1, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_1B1B1B( + BuiltInId::smoothstep_Float2_Float2_Float2, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B1B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_2B2B2B( + BuiltInId::smoothstep_Float3_Float3_Float3, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B2B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_3B3B3B( + BuiltInId::smoothstep_Float4_Float4_Float4, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_0B0B1B( + BuiltInId::smoothstep_Float1_Float1_Float2, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_0B0B2B( + BuiltInId::smoothstep_Float1_Float1_Float3, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B2B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_smoothstep_0B0B3B( + BuiltInId::smoothstep_Float1_Float1_Float4, + BuiltInName::smoothstep, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B3B, + 3, + StaticType::Get(), + EOpSmoothstep, + true); +constexpr const TFunction kFunction_modf_0B0B( + BuiltInId::modf_Float1_Float1, + BuiltInName::modf, + TExtension::UNDEFINED, + BuiltInParameters::p0B_o_0B, + 2, + StaticType::Get(), + EOpModf, + false); +constexpr const TFunction kFunction_modf_1B1B( + BuiltInId::modf_Float2_Float2, + BuiltInName::modf, + TExtension::UNDEFINED, + BuiltInParameters::p1B_o_1B, + 2, + StaticType::Get(), + EOpModf, + false); +constexpr const TFunction kFunction_modf_2B2B( + BuiltInId::modf_Float3_Float3, + BuiltInName::modf, + TExtension::UNDEFINED, + BuiltInParameters::p2B_o_2B, + 2, + StaticType::Get(), + EOpModf, + false); +constexpr const TFunction kFunction_modf_3B3B( + BuiltInId::modf_Float4_Float4, + BuiltInName::modf, + TExtension::UNDEFINED, + BuiltInParameters::p3B_o_3B, + 2, + StaticType::Get(), + EOpModf, + false); +constexpr const TFunction kFunction_isnan_0B( + BuiltInId::isnan_Float1, + BuiltInName::isnan, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpIsnan, + true); +constexpr const TFunction kFunction_isnan_1B( + BuiltInId::isnan_Float2, + BuiltInName::isnan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpIsnan, + true); +constexpr const TFunction kFunction_isnan_2B( + BuiltInId::isnan_Float3, + BuiltInName::isnan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpIsnan, + true); +constexpr const TFunction kFunction_isnan_3B( + BuiltInId::isnan_Float4, + BuiltInName::isnan, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpIsnan, + true); +constexpr const TFunction kFunction_isinf_0B( + BuiltInId::isinf_Float1, + BuiltInName::isinf, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpIsinf, + true); +constexpr const TFunction kFunction_isinf_1B( + BuiltInId::isinf_Float2, + BuiltInName::isinf, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpIsinf, + true); +constexpr const TFunction kFunction_isinf_2B( + BuiltInId::isinf_Float3, + BuiltInName::isinf, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpIsinf, + true); +constexpr const TFunction kFunction_isinf_3B( + BuiltInId::isinf_Float4, + BuiltInName::isinf, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpIsinf, + true); +constexpr const TFunction kFunction_floatBitsToInt_0B( + BuiltInId::floatBitsToInt_Float1, + BuiltInName::floatBitsToInt, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFloatBitsToInt, + true); +constexpr const TFunction kFunction_floatBitsToInt_1B( + BuiltInId::floatBitsToInt_Float2, + BuiltInName::floatBitsToInt, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFloatBitsToInt, + true); +constexpr const TFunction kFunction_floatBitsToInt_2B( + BuiltInId::floatBitsToInt_Float3, + BuiltInName::floatBitsToInt, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFloatBitsToInt, + true); +constexpr const TFunction kFunction_floatBitsToInt_3B( + BuiltInId::floatBitsToInt_Float4, + BuiltInName::floatBitsToInt, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFloatBitsToInt, + true); +constexpr const TFunction kFunction_floatBitsToUint_0B( + BuiltInId::floatBitsToUint_Float1, + BuiltInName::floatBitsToUint, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFloatBitsToUint, + true); +constexpr const TFunction kFunction_floatBitsToUint_1B( + BuiltInId::floatBitsToUint_Float2, + BuiltInName::floatBitsToUint, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFloatBitsToUint, + true); +constexpr const TFunction kFunction_floatBitsToUint_2B( + BuiltInId::floatBitsToUint_Float3, + BuiltInName::floatBitsToUint, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFloatBitsToUint, + true); +constexpr const TFunction kFunction_floatBitsToUint_3B( + BuiltInId::floatBitsToUint_Float4, + BuiltInName::floatBitsToUint, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFloatBitsToUint, + true); +constexpr const TFunction kFunction_intBitsToFloat_0C( + BuiltInId::intBitsToFloat_Int1, + BuiltInName::intBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpIntBitsToFloat, + true); +constexpr const TFunction kFunction_intBitsToFloat_1C( + BuiltInId::intBitsToFloat_Int2, + BuiltInName::intBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpIntBitsToFloat, + true); +constexpr const TFunction kFunction_intBitsToFloat_2C( + BuiltInId::intBitsToFloat_Int3, + BuiltInName::intBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpIntBitsToFloat, + true); +constexpr const TFunction kFunction_intBitsToFloat_3C( + BuiltInId::intBitsToFloat_Int4, + BuiltInName::intBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpIntBitsToFloat, + true); +constexpr const TFunction kFunction_uintBitsToFloat_0D( + BuiltInId::uintBitsToFloat_UInt1, + BuiltInName::uintBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUintBitsToFloat, + true); +constexpr const TFunction kFunction_uintBitsToFloat_1D( + BuiltInId::uintBitsToFloat_UInt2, + BuiltInName::uintBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 1, + StaticType::Get(), + EOpUintBitsToFloat, + true); +constexpr const TFunction kFunction_uintBitsToFloat_2D( + BuiltInId::uintBitsToFloat_UInt3, + BuiltInName::uintBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 1, + StaticType::Get(), + EOpUintBitsToFloat, + true); +constexpr const TFunction kFunction_uintBitsToFloat_3D( + BuiltInId::uintBitsToFloat_UInt4, + BuiltInName::uintBitsToFloat, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 1, + StaticType::Get(), + EOpUintBitsToFloat, + true); +constexpr const TFunction kFunction_frexp_0B0C( + BuiltInId::frexp_Float1_Int1, + BuiltInName::frexp, + TExtension::UNDEFINED, + BuiltInParameters::p0B_o_0C, + 2, + StaticType::Get(), + EOpFrexp, + false); +constexpr const TFunction kFunction_frexp_1B1C( + BuiltInId::frexp_Float2_Int2, + BuiltInName::frexp, + TExtension::UNDEFINED, + BuiltInParameters::p1B_o_1C, + 2, + StaticType::Get(), + EOpFrexp, + false); +constexpr const TFunction kFunction_frexp_2B2C( + BuiltInId::frexp_Float3_Int3, + BuiltInName::frexp, + TExtension::UNDEFINED, + BuiltInParameters::p2B_o_2C, + 2, + StaticType::Get(), + EOpFrexp, + false); +constexpr const TFunction kFunction_frexp_3B3C( + BuiltInId::frexp_Float4_Int4, + BuiltInName::frexp, + TExtension::UNDEFINED, + BuiltInParameters::p3B_o_3C, + 2, + StaticType::Get(), + EOpFrexp, + false); +constexpr const TFunction kFunction_ldexp_0B0C( + BuiltInId::ldexp_Float1_Int1, + BuiltInName::ldexp, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 2, + StaticType::Get(), + EOpLdexp, + true); +constexpr const TFunction kFunction_ldexp_1B1C( + BuiltInId::ldexp_Float2_Int2, + BuiltInName::ldexp, + TExtension::UNDEFINED, + BuiltInParameters::p1B1C, + 2, + StaticType::Get(), + EOpLdexp, + true); +constexpr const TFunction kFunction_ldexp_2B2C( + BuiltInId::ldexp_Float3_Int3, + BuiltInName::ldexp, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 2, + StaticType::Get(), + EOpLdexp, + true); +constexpr const TFunction kFunction_ldexp_3B3C( + BuiltInId::ldexp_Float4_Int4, + BuiltInName::ldexp, + TExtension::UNDEFINED, + BuiltInParameters::p3B3C, + 2, + StaticType::Get(), + EOpLdexp, + true); +constexpr const TFunction kFunction_packSnorm2x16_1B( + BuiltInId::packSnorm2x16_Float2, + BuiltInName::packSnorm2x16, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpPackSnorm2x16, + true); +constexpr const TFunction kFunction_packUnorm2x16_1B( + BuiltInId::packUnorm2x16_Float2, + BuiltInName::packUnorm2x16, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpPackUnorm2x16, + true); +constexpr const TFunction kFunction_packHalf2x16_1B( + BuiltInId::packHalf2x16_Float2, + BuiltInName::packHalf2x16, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpPackHalf2x16, + true); +constexpr const TFunction kFunction_unpackSnorm2x16_0D( + BuiltInId::unpackSnorm2x16_UInt1, + BuiltInName::unpackSnorm2x16, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUnpackSnorm2x16, + true); +constexpr const TFunction kFunction_unpackUnorm2x16_0D( + BuiltInId::unpackUnorm2x16_UInt1, + BuiltInName::unpackUnorm2x16, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUnpackUnorm2x16, + true); +constexpr const TFunction kFunction_unpackHalf2x16_0D( + BuiltInId::unpackHalf2x16_UInt1, + BuiltInName::unpackHalf2x16, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUnpackHalf2x16, + true); +constexpr const TFunction kFunction_packUnorm4x8_3B( + BuiltInId::packUnorm4x8_Float4, + BuiltInName::packUnorm4x8, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpPackUnorm4x8, + true); +constexpr const TFunction kFunction_packSnorm4x8_3B( + BuiltInId::packSnorm4x8_Float4, + BuiltInName::packSnorm4x8, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpPackSnorm4x8, + true); +constexpr const TFunction kFunction_unpackUnorm4x8_0D( + BuiltInId::unpackUnorm4x8_UInt1, + BuiltInName::unpackUnorm4x8, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUnpackUnorm4x8, + true); +constexpr const TFunction kFunction_unpackSnorm4x8_0D( + BuiltInId::unpackSnorm4x8_UInt1, + BuiltInName::unpackSnorm4x8, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpUnpackSnorm4x8, + true); +constexpr const TFunction kFunction_length_0B( + BuiltInId::length_Float1, + BuiltInName::length, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpLength, + true); +constexpr const TFunction kFunction_length_1B( + BuiltInId::length_Float2, + BuiltInName::length, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpLength, + true); +constexpr const TFunction kFunction_length_2B( + BuiltInId::length_Float3, + BuiltInName::length, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpLength, + true); +constexpr const TFunction kFunction_length_3B( + BuiltInId::length_Float4, + BuiltInName::length, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpLength, + true); +constexpr const TFunction kFunction_distance_0B0B( + BuiltInId::distance_Float1_Float1, + BuiltInName::distance, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpDistance, + true); +constexpr const TFunction kFunction_distance_1B1B( + BuiltInId::distance_Float2_Float2, + BuiltInName::distance, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpDistance, + true); +constexpr const TFunction kFunction_distance_2B2B( + BuiltInId::distance_Float3_Float3, + BuiltInName::distance, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpDistance, + true); +constexpr const TFunction kFunction_distance_3B3B( + BuiltInId::distance_Float4_Float4, + BuiltInName::distance, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpDistance, + true); +constexpr const TFunction kFunction_dot_0B0B( + BuiltInId::dot_Float1_Float1, + BuiltInName::dot, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpDot, + true); +constexpr const TFunction kFunction_dot_1B1B( + BuiltInId::dot_Float2_Float2, + BuiltInName::dot, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpDot, + true); +constexpr const TFunction kFunction_dot_2B2B( + BuiltInId::dot_Float3_Float3, + BuiltInName::dot, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpDot, + true); +constexpr const TFunction kFunction_dot_3B3B( + BuiltInId::dot_Float4_Float4, + BuiltInName::dot, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpDot, + true); +constexpr const TFunction kFunction_cross_2B2B( + BuiltInId::cross_Float3_Float3, + BuiltInName::cross, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpCross, + true); +constexpr const TFunction kFunction_normalize_0B( + BuiltInId::normalize_Float1, + BuiltInName::normalize, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpNormalize, + true); +constexpr const TFunction kFunction_normalize_1B( + BuiltInId::normalize_Float2, + BuiltInName::normalize, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpNormalize, + true); +constexpr const TFunction kFunction_normalize_2B( + BuiltInId::normalize_Float3, + BuiltInName::normalize, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpNormalize, + true); +constexpr const TFunction kFunction_normalize_3B( + BuiltInId::normalize_Float4, + BuiltInName::normalize, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpNormalize, + true); +constexpr const TFunction kFunction_faceforward_0B0B0B( + BuiltInId::faceforward_Float1_Float1_Float1, + BuiltInName::faceforward, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0B, + 3, + StaticType::Get(), + EOpFaceforward, + true); +constexpr const TFunction kFunction_faceforward_1B1B1B( + BuiltInId::faceforward_Float2_Float2_Float2, + BuiltInName::faceforward, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B1B, + 3, + StaticType::Get(), + EOpFaceforward, + true); +constexpr const TFunction kFunction_faceforward_2B2B2B( + BuiltInId::faceforward_Float3_Float3_Float3, + BuiltInName::faceforward, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B2B, + 3, + StaticType::Get(), + EOpFaceforward, + true); +constexpr const TFunction kFunction_faceforward_3B3B3B( + BuiltInId::faceforward_Float4_Float4_Float4, + BuiltInName::faceforward, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 3, + StaticType::Get(), + EOpFaceforward, + true); +constexpr const TFunction kFunction_reflect_0B0B( + BuiltInId::reflect_Float1_Float1, + BuiltInName::reflect, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B1B, + 2, + StaticType::Get(), + EOpReflect, + true); +constexpr const TFunction kFunction_reflect_1B1B( + BuiltInId::reflect_Float2_Float2, + BuiltInName::reflect, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpReflect, + true); +constexpr const TFunction kFunction_reflect_2B2B( + BuiltInId::reflect_Float3_Float3, + BuiltInName::reflect, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpReflect, + true); +constexpr const TFunction kFunction_reflect_3B3B( + BuiltInId::reflect_Float4_Float4, + BuiltInName::reflect, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpReflect, + true); +constexpr const TFunction kFunction_refract_0B0B0B( + BuiltInId::refract_Float1_Float1_Float1, + BuiltInName::refract, + TExtension::UNDEFINED, + BuiltInParameters::p0B0B0B, + 3, + StaticType::Get(), + EOpRefract, + true); +constexpr const TFunction kFunction_refract_1B1B0B( + BuiltInId::refract_Float2_Float2_Float1, + BuiltInName::refract, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 3, + StaticType::Get(), + EOpRefract, + true); +constexpr const TFunction kFunction_refract_2B2B0B( + BuiltInId::refract_Float3_Float3_Float1, + BuiltInName::refract, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 3, + StaticType::Get(), + EOpRefract, + true); +constexpr const TFunction kFunction_refract_3B3B0B( + BuiltInId::refract_Float4_Float4_Float1, + BuiltInName::refract, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B0B, + 3, + StaticType::Get(), + EOpRefract, + true); +constexpr const TFunction kFunction_matrixCompMult_5B5B( + BuiltInId::matrixCompMult_Float2x2_Float2x2, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::p5B5B, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_ABAB( + BuiltInId::matrixCompMult_Float3x3_Float3x3, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::pABAB, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_FBFB( + BuiltInId::matrixCompMult_Float4x4_Float4x4, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::pFBFB, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_9B9B( + BuiltInId::matrixCompMult_Float2x3_Float2x3, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::p9B9B, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_6B6B( + BuiltInId::matrixCompMult_Float3x2_Float3x2, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::p6B6B, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_DBDB( + BuiltInId::matrixCompMult_Float2x4_Float2x4, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::pDBDB, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_7B7B( + BuiltInId::matrixCompMult_Float4x2_Float4x2, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::p7B7B, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_EBEB( + BuiltInId::matrixCompMult_Float3x4_Float3x4, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::pEBEB, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_matrixCompMult_BBBB( + BuiltInId::matrixCompMult_Float4x3_Float4x3, + BuiltInName::matrixCompMult, + TExtension::UNDEFINED, + BuiltInParameters::pBBBB, + 2, + StaticType::Get(), + EOpMulMatrixComponentWise, + true); +constexpr const TFunction kFunction_outerProduct_1B1B( + BuiltInId::outerProduct_Float2_Float2, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_2B2B( + BuiltInId::outerProduct_Float3_Float3, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_3B3B( + BuiltInId::outerProduct_Float4_Float4, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_2B1B( + BuiltInId::outerProduct_Float3_Float2, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p2B1B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_1B2B( + BuiltInId::outerProduct_Float2_Float3, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p1B2B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_3B1B( + BuiltInId::outerProduct_Float4_Float2, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_1B3B( + BuiltInId::outerProduct_Float2_Float4, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p1B3B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_3B2B( + BuiltInId::outerProduct_Float4_Float3, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p3B2B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_outerProduct_2B3B( + BuiltInId::outerProduct_Float3_Float4, + BuiltInName::outerProduct, + TExtension::UNDEFINED, + BuiltInParameters::p2B3B, + 2, + StaticType::Get(), + EOpOuterProduct, + true); +constexpr const TFunction kFunction_transpose_5B( + BuiltInId::transpose_Float2x2, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::p5B5B, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_AB( + BuiltInId::transpose_Float3x3, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::pABAB, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_FB( + BuiltInId::transpose_Float4x4, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::pFBFB, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_6B( + BuiltInId::transpose_Float3x2, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::p6B6B, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_9B( + BuiltInId::transpose_Float2x3, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::p9B9B, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_7B( + BuiltInId::transpose_Float4x2, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::p7B7B, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_DB( + BuiltInId::transpose_Float2x4, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::pDBDB, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_BB( + BuiltInId::transpose_Float4x3, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::pBBBB, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_transpose_EB( + BuiltInId::transpose_Float3x4, + BuiltInName::transpose, + TExtension::UNDEFINED, + BuiltInParameters::pEBEB, + 1, + StaticType::Get(), + EOpTranspose, + true); +constexpr const TFunction kFunction_determinant_5B( + BuiltInId::determinant_Float2x2, + BuiltInName::determinant, + TExtension::UNDEFINED, + BuiltInParameters::p5B5B, + 1, + StaticType::Get(), + EOpDeterminant, + true); +constexpr const TFunction kFunction_determinant_AB( + BuiltInId::determinant_Float3x3, + BuiltInName::determinant, + TExtension::UNDEFINED, + BuiltInParameters::pABAB, + 1, + StaticType::Get(), + EOpDeterminant, + true); +constexpr const TFunction kFunction_determinant_FB( + BuiltInId::determinant_Float4x4, + BuiltInName::determinant, + TExtension::UNDEFINED, + BuiltInParameters::pFBFB, + 1, + StaticType::Get(), + EOpDeterminant, + true); +constexpr const TFunction kFunction_inverse_5B( + BuiltInId::inverse_Float2x2, + BuiltInName::inverse, + TExtension::UNDEFINED, + BuiltInParameters::p5B5B, + 1, + StaticType::Get(), + EOpInverse, + true); +constexpr const TFunction kFunction_inverse_AB( + BuiltInId::inverse_Float3x3, + BuiltInName::inverse, + TExtension::UNDEFINED, + BuiltInParameters::pABAB, + 1, + StaticType::Get(), + EOpInverse, + true); +constexpr const TFunction kFunction_inverse_FB( + BuiltInId::inverse_Float4x4, + BuiltInName::inverse, + TExtension::UNDEFINED, + BuiltInParameters::pFBFB, + 1, + StaticType::Get(), + EOpInverse, + true); +constexpr const TFunction kFunction_lessThan_1B1B( + BuiltInId::lessThan_Float2_Float2, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_2B2B( + BuiltInId::lessThan_Float3_Float3, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_3B3B( + BuiltInId::lessThan_Float4_Float4, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_1C1C( + BuiltInId::lessThan_Int2_Int2, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_2C2C( + BuiltInId::lessThan_Int3_Int3, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_3C3C( + BuiltInId::lessThan_Int4_Int4, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_1D1D( + BuiltInId::lessThan_UInt2_UInt2, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_2D2D( + BuiltInId::lessThan_UInt3_UInt3, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThan_3D3D( + BuiltInId::lessThan_UInt4_UInt4, + BuiltInName::lessThan, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpLessThanComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_1B1B( + BuiltInId::lessThanEqual_Float2_Float2, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_2B2B( + BuiltInId::lessThanEqual_Float3_Float3, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_3B3B( + BuiltInId::lessThanEqual_Float4_Float4, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_1C1C( + BuiltInId::lessThanEqual_Int2_Int2, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_2C2C( + BuiltInId::lessThanEqual_Int3_Int3, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_3C3C( + BuiltInId::lessThanEqual_Int4_Int4, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_1D1D( + BuiltInId::lessThanEqual_UInt2_UInt2, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_2D2D( + BuiltInId::lessThanEqual_UInt3_UInt3, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_lessThanEqual_3D3D( + BuiltInId::lessThanEqual_UInt4_UInt4, + BuiltInName::lessThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpLessThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_1B1B( + BuiltInId::greaterThan_Float2_Float2, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_2B2B( + BuiltInId::greaterThan_Float3_Float3, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_3B3B( + BuiltInId::greaterThan_Float4_Float4, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_1C1C( + BuiltInId::greaterThan_Int2_Int2, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_2C2C( + BuiltInId::greaterThan_Int3_Int3, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_3C3C( + BuiltInId::greaterThan_Int4_Int4, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_1D1D( + BuiltInId::greaterThan_UInt2_UInt2, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_2D2D( + BuiltInId::greaterThan_UInt3_UInt3, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThan_3D3D( + BuiltInId::greaterThan_UInt4_UInt4, + BuiltInName::greaterThan, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_1B1B( + BuiltInId::greaterThanEqual_Float2_Float2, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_2B2B( + BuiltInId::greaterThanEqual_Float3_Float3, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_3B3B( + BuiltInId::greaterThanEqual_Float4_Float4, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_1C1C( + BuiltInId::greaterThanEqual_Int2_Int2, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_2C2C( + BuiltInId::greaterThanEqual_Int3_Int3, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_3C3C( + BuiltInId::greaterThanEqual_Int4_Int4, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_1D1D( + BuiltInId::greaterThanEqual_UInt2_UInt2, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_2D2D( + BuiltInId::greaterThanEqual_UInt3_UInt3, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_greaterThanEqual_3D3D( + BuiltInId::greaterThanEqual_UInt4_UInt4, + BuiltInName::greaterThanEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpGreaterThanEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_1B1B( + BuiltInId::equal_Float2_Float2, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_2B2B( + BuiltInId::equal_Float3_Float3, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_3B3B( + BuiltInId::equal_Float4_Float4, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_1C1C( + BuiltInId::equal_Int2_Int2, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_2C2C( + BuiltInId::equal_Int3_Int3, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_3C3C( + BuiltInId::equal_Int4_Int4, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_1D1D( + BuiltInId::equal_UInt2_UInt2, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_2D2D( + BuiltInId::equal_UInt3_UInt3, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_3D3D( + BuiltInId::equal_UInt4_UInt4, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_1E1E( + BuiltInId::equal_Bool2_Bool2, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p1E1E, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_2E2E( + BuiltInId::equal_Bool3_Bool3, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p2E2E, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_equal_3E3E( + BuiltInId::equal_Bool4_Bool4, + BuiltInName::equal, + TExtension::UNDEFINED, + BuiltInParameters::p3E3E, + 2, + StaticType::Get(), + EOpEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_1B1B( + BuiltInId::notEqual_Float2_Float2, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_2B2B( + BuiltInId::notEqual_Float3_Float3, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2B2B0B, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_3B3B( + BuiltInId::notEqual_Float4_Float4, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3B3B3B, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_1C1C( + BuiltInId::notEqual_Int2_Int2, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_2C2C( + BuiltInId::notEqual_Int3_Int3, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_3C3C( + BuiltInId::notEqual_Int4_Int4, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_1D1D( + BuiltInId::notEqual_UInt2_UInt2, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_2D2D( + BuiltInId::notEqual_UInt3_UInt3, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_3D3D( + BuiltInId::notEqual_UInt4_UInt4, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_1E1E( + BuiltInId::notEqual_Bool2_Bool2, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p1E1E, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_2E2E( + BuiltInId::notEqual_Bool3_Bool3, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p2E2E, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_notEqual_3E3E( + BuiltInId::notEqual_Bool4_Bool4, + BuiltInName::notEqual, + TExtension::UNDEFINED, + BuiltInParameters::p3E3E, + 2, + StaticType::Get(), + EOpNotEqualComponentWise, + true); +constexpr const TFunction kFunction_any_1E( + BuiltInId::any_Bool2, + BuiltInName::any, + TExtension::UNDEFINED, + BuiltInParameters::p1E1E, + 1, + StaticType::Get(), + EOpAny, + true); +constexpr const TFunction kFunction_any_2E( + BuiltInId::any_Bool3, + BuiltInName::any, + TExtension::UNDEFINED, + BuiltInParameters::p2E2E, + 1, + StaticType::Get(), + EOpAny, + true); +constexpr const TFunction kFunction_any_3E( + BuiltInId::any_Bool4, + BuiltInName::any, + TExtension::UNDEFINED, + BuiltInParameters::p3E3E, + 1, + StaticType::Get(), + EOpAny, + true); +constexpr const TFunction kFunction_all_1E( + BuiltInId::all_Bool2, + BuiltInName::all, + TExtension::UNDEFINED, + BuiltInParameters::p1E1E, + 1, + StaticType::Get(), + EOpAll, + true); +constexpr const TFunction kFunction_all_2E( + BuiltInId::all_Bool3, + BuiltInName::all, + TExtension::UNDEFINED, + BuiltInParameters::p2E2E, + 1, + StaticType::Get(), + EOpAll, + true); +constexpr const TFunction kFunction_all_3E( + BuiltInId::all_Bool4, + BuiltInName::all, + TExtension::UNDEFINED, + BuiltInParameters::p3E3E, + 1, + StaticType::Get(), + EOpAll, + true); +constexpr const TFunction kFunction_notFunc_1E( + BuiltInId::notFunc_Bool2, + BuiltInName::notFunc, + TExtension::UNDEFINED, + BuiltInParameters::p1E1E, + 1, + StaticType::Get(), + EOpLogicalNotComponentWise, + true); +constexpr const TFunction kFunction_notFunc_2E( + BuiltInId::notFunc_Bool3, + BuiltInName::notFunc, + TExtension::UNDEFINED, + BuiltInParameters::p2E2E, + 1, + StaticType::Get(), + EOpLogicalNotComponentWise, + true); +constexpr const TFunction kFunction_notFunc_3E( + BuiltInId::notFunc_Bool4, + BuiltInName::notFunc, + TExtension::UNDEFINED, + BuiltInParameters::p3E3E, + 1, + StaticType::Get(), + EOpLogicalNotComponentWise, + true); +constexpr const TFunction kFunction_bitfieldExtract_0C0C0C( + BuiltInId::bitfieldExtract_Int1_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_1C0C0C( + BuiltInId::bitfieldExtract_Int2_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p1C0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_2C0C0C( + BuiltInId::bitfieldExtract_Int3_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p2C0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_3C0C0C( + BuiltInId::bitfieldExtract_Int4_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_0D0C0C( + BuiltInId::bitfieldExtract_UInt1_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_1D0C0C( + BuiltInId::bitfieldExtract_UInt2_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_2D0C0C( + BuiltInId::bitfieldExtract_UInt3_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p2D0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldExtract_3D0C0C( + BuiltInId::bitfieldExtract_UInt4_Int1_Int1, + BuiltInName::bitfieldExtract, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 3, + StaticType::Get(), + EOpBitfieldExtract, + true); +constexpr const TFunction kFunction_bitfieldInsert_0C0C0C0C( + BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_1C1C0C0C( + BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_2C2C0C0C( + BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_3C3C0C0C( + BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_0D0D0C0C( + BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_1D1D0C0C( + BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_2D2D0C0C( + BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldInsert_3D3D0C0C( + BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1, + BuiltInName::bitfieldInsert, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D0C0C, + 4, + StaticType::Get(), + EOpBitfieldInsert, + true); +constexpr const TFunction kFunction_bitfieldReverse_0C( + BuiltInId::bitfieldReverse_Int1, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_1C( + BuiltInId::bitfieldReverse_Int2, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_2C( + BuiltInId::bitfieldReverse_Int3, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_3C( + BuiltInId::bitfieldReverse_Int4, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_0D( + BuiltInId::bitfieldReverse_UInt1, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_1D( + BuiltInId::bitfieldReverse_UInt2, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_2D( + BuiltInId::bitfieldReverse_UInt3, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitfieldReverse_3D( + BuiltInId::bitfieldReverse_UInt4, + BuiltInName::bitfieldReverse, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 1, + StaticType::Get(), + EOpBitfieldReverse, + true); +constexpr const TFunction kFunction_bitCount_0C( + BuiltInId::bitCount_Int1, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_1C( + BuiltInId::bitCount_Int2, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_2C( + BuiltInId::bitCount_Int3, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_3C( + BuiltInId::bitCount_Int4, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_0D( + BuiltInId::bitCount_UInt1, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_1D( + BuiltInId::bitCount_UInt2, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_2D( + BuiltInId::bitCount_UInt3, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_bitCount_3D( + BuiltInId::bitCount_UInt4, + BuiltInName::bitCount, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 1, + StaticType::Get(), + EOpBitCount, + true); +constexpr const TFunction kFunction_findLSB_0C( + BuiltInId::findLSB_Int1, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_1C( + BuiltInId::findLSB_Int2, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_2C( + BuiltInId::findLSB_Int3, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_3C( + BuiltInId::findLSB_Int4, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_0D( + BuiltInId::findLSB_UInt1, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_1D( + BuiltInId::findLSB_UInt2, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_2D( + BuiltInId::findLSB_UInt3, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findLSB_3D( + BuiltInId::findLSB_UInt4, + BuiltInName::findLSB, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 1, + StaticType::Get(), + EOpFindLSB, + true); +constexpr const TFunction kFunction_findMSB_0C( + BuiltInId::findMSB_Int1, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_1C( + BuiltInId::findMSB_Int2, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_2C( + BuiltInId::findMSB_Int3, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_3C( + BuiltInId::findMSB_Int4, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p3C0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_0D( + BuiltInId::findMSB_UInt1, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p0D0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_1D( + BuiltInId::findMSB_UInt2, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p1D0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_2D( + BuiltInId::findMSB_UInt3, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_findMSB_3D( + BuiltInId::findMSB_UInt4, + BuiltInName::findMSB, + TExtension::UNDEFINED, + BuiltInParameters::p3D0C0C, + 1, + StaticType::Get(), + EOpFindMSB, + true); +constexpr const TFunction kFunction_uaddCarry_0D0D0D( + BuiltInId::uaddCarry_UInt1_UInt1_UInt1, + BuiltInName::uaddCarry, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D_o_0D_o_0D, + 3, + StaticType::Get(), + EOpUaddCarry, + false); +constexpr const TFunction kFunction_uaddCarry_1D1D1D( + BuiltInId::uaddCarry_UInt2_UInt2_UInt2, + BuiltInName::uaddCarry, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D_o_1D_o_1D, + 3, + StaticType::Get(), + EOpUaddCarry, + false); +constexpr const TFunction kFunction_uaddCarry_2D2D2D( + BuiltInId::uaddCarry_UInt3_UInt3_UInt3, + BuiltInName::uaddCarry, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D_o_2D_o_2D, + 3, + StaticType::Get(), + EOpUaddCarry, + false); +constexpr const TFunction kFunction_uaddCarry_3D3D3D( + BuiltInId::uaddCarry_UInt4_UInt4_UInt4, + BuiltInName::uaddCarry, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D_o_3D_o_3D, + 3, + StaticType::Get(), + EOpUaddCarry, + false); +constexpr const TFunction kFunction_usubBorrow_0D0D0D( + BuiltInId::usubBorrow_UInt1_UInt1_UInt1, + BuiltInName::usubBorrow, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D_o_0D_o_0D, + 3, + StaticType::Get(), + EOpUsubBorrow, + false); +constexpr const TFunction kFunction_usubBorrow_1D1D1D( + BuiltInId::usubBorrow_UInt2_UInt2_UInt2, + BuiltInName::usubBorrow, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D_o_1D_o_1D, + 3, + StaticType::Get(), + EOpUsubBorrow, + false); +constexpr const TFunction kFunction_usubBorrow_2D2D2D( + BuiltInId::usubBorrow_UInt3_UInt3_UInt3, + BuiltInName::usubBorrow, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D_o_2D_o_2D, + 3, + StaticType::Get(), + EOpUsubBorrow, + false); +constexpr const TFunction kFunction_usubBorrow_3D3D3D( + BuiltInId::usubBorrow_UInt4_UInt4_UInt4, + BuiltInName::usubBorrow, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D_o_3D_o_3D, + 3, + StaticType::Get(), + EOpUsubBorrow, + false); +constexpr const TFunction kFunction_umulExtended_0D0D0D0D( + BuiltInId::umulExtended_UInt1_UInt1_UInt1_UInt1, + BuiltInName::umulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p0D0D_o_0D_o_0D, + 4, + StaticType::Get(), + EOpUmulExtended, + false); +constexpr const TFunction kFunction_umulExtended_1D1D1D1D( + BuiltInId::umulExtended_UInt2_UInt2_UInt2_UInt2, + BuiltInName::umulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p1D1D_o_1D_o_1D, + 4, + StaticType::Get(), + EOpUmulExtended, + false); +constexpr const TFunction kFunction_umulExtended_2D2D2D2D( + BuiltInId::umulExtended_UInt3_UInt3_UInt3_UInt3, + BuiltInName::umulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p2D2D_o_2D_o_2D, + 4, + StaticType::Get(), + EOpUmulExtended, + false); +constexpr const TFunction kFunction_umulExtended_3D3D3D3D( + BuiltInId::umulExtended_UInt4_UInt4_UInt4_UInt4, + BuiltInName::umulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p3D3D_o_3D_o_3D, + 4, + StaticType::Get(), + EOpUmulExtended, + false); +constexpr const TFunction kFunction_imulExtended_0C0C0C0C( + BuiltInId::imulExtended_Int1_Int1_Int1_Int1, + BuiltInName::imulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p0C0C_o_0C_o_0C, + 4, + StaticType::Get(), + EOpImulExtended, + false); +constexpr const TFunction kFunction_imulExtended_1C1C1C1C( + BuiltInId::imulExtended_Int2_Int2_Int2_Int2, + BuiltInName::imulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p1C1C_o_1C_o_1C, + 4, + StaticType::Get(), + EOpImulExtended, + false); +constexpr const TFunction kFunction_imulExtended_2C2C2C2C( + BuiltInId::imulExtended_Int3_Int3_Int3_Int3, + BuiltInName::imulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p2C2C_o_2C_o_2C, + 4, + StaticType::Get(), + EOpImulExtended, + false); +constexpr const TFunction kFunction_imulExtended_3C3C3C3C( + BuiltInId::imulExtended_Int4_Int4_Int4_Int4, + BuiltInName::imulExtended, + TExtension::UNDEFINED, + BuiltInParameters::p3C3C_o_3C_o_3C, + 4, + StaticType::Get(), + EOpImulExtended, + false); +constexpr const TFunction kFunction_texture2D_0H1B( + BuiltInId::texture2D_Sampler2D1_Float2, + BuiltInName::texture2D, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0H2B( + BuiltInId::texture2DProj_Sampler2D1_Float3, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0H3B( + BuiltInId::texture2DProj_Sampler2D1_Float4, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureCube_0J2B( + BuiltInId::textureCube_SamplerCube1_Float3, + BuiltInName::textureCube, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2D_0L1B( + BuiltInId::texture2D_SamplerExternalOES1_Float2, + BuiltInName::texture2D, + TExtension::UNDEFINED, + BuiltInParameters::p0L1B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0L2B( + BuiltInId::texture2DProj_SamplerExternalOES1_Float3, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0L2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0L3B( + BuiltInId::texture2DProj_SamplerExternalOES1_Float4, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0L3B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DRect_0N1B( + BuiltInId::texture2DRect_Sampler2DRect1_Float2, + BuiltInName::texture2DRect, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N1B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DRectProj_0N2B( + BuiltInId::texture2DRectProj_Sampler2DRect1_Float3, + BuiltInName::texture2DRectProj, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DRectProj_0N3B( + BuiltInId::texture2DRectProj_Sampler2DRect1_Float4, + BuiltInName::texture2DRectProj, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0N1B( + BuiltInId::texture_Sampler2DRect1_Float2, + BuiltInName::texture, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N1B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0N2B( + BuiltInId::textureProj_Sampler2DRect1_Float3, + BuiltInName::textureProj, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0N3B( + BuiltInId::textureProj_Sampler2DRect1_Float4, + BuiltInName::textureProj, + TExtension::ARB_texture_rectangle, + BuiltInParameters::p0N3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DGradEXT_0H1B1B1B( + BuiltInId::texture2DGradEXT_Sampler2D1_Float2_Float2_Float2, + BuiltInName::texture2DGradEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H1B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjGradEXT_0H2B1B1B( + BuiltInId::texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2, + BuiltInName::texture2DProjGradEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjGradEXT_0H3B1B1B( + BuiltInId::texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2, + BuiltInName::texture2DProjGradEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureCubeGradEXT_0J2B2B2B( + BuiltInId::textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3, + BuiltInName::textureCubeGradEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0J2B2B2B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2D_0H1B0B( + BuiltInId::texture2D_Sampler2D1_Float2_Float1, + BuiltInName::texture2D, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0H2B0B( + BuiltInId::texture2DProj_Sampler2D1_Float3_Float1, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProj_0H3B0B( + BuiltInId::texture2DProj_Sampler2D1_Float4_Float1, + BuiltInName::texture2DProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureCube_0J2B0B( + BuiltInId::textureCube_SamplerCube1_Float3_Float1, + BuiltInName::textureCube, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_dFdxExt_0B( + BuiltInId::dFdxExt_Float1, + BuiltInName::dFdxExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdxExt_1B( + BuiltInId::dFdxExt_Float2, + BuiltInName::dFdxExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdxExt_2B( + BuiltInId::dFdxExt_Float3, + BuiltInName::dFdxExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdxExt_3B( + BuiltInId::dFdxExt_Float4, + BuiltInName::dFdxExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdyExt_0B( + BuiltInId::dFdyExt_Float1, + BuiltInName::dFdyExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdyExt_1B( + BuiltInId::dFdyExt_Float2, + BuiltInName::dFdyExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdyExt_2B( + BuiltInId::dFdyExt_Float3, + BuiltInName::dFdyExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdyExt_3B( + BuiltInId::dFdyExt_Float4, + BuiltInName::dFdyExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_fwidthExt_0B( + BuiltInId::fwidthExt_Float1, + BuiltInName::fwidthExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidthExt_1B( + BuiltInId::fwidthExt_Float2, + BuiltInName::fwidthExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidthExt_2B( + BuiltInId::fwidthExt_Float3, + BuiltInName::fwidthExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidthExt_3B( + BuiltInId::fwidthExt_Float4, + BuiltInName::fwidthExt, + TExtension::OES_standard_derivatives, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_texture2DLodEXT_0H1B0B( + BuiltInId::texture2DLodEXT_Sampler2D1_Float2_Float1, + BuiltInName::texture2DLodEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjLodEXT_0H2B0B( + BuiltInId::texture2DProjLodEXT_Sampler2D1_Float3_Float1, + BuiltInName::texture2DProjLodEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjLodEXT_0H3B0B( + BuiltInId::texture2DProjLodEXT_Sampler2D1_Float4_Float1, + BuiltInName::texture2DProjLodEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0H3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureCubeLodEXT_0J2B0B( + BuiltInId::textureCubeLodEXT_SamplerCube1_Float3_Float1, + BuiltInName::textureCubeLodEXT, + TExtension::EXT_shader_texture_lod, + BuiltInParameters::p0J2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DLod_0H1B0B( + BuiltInId::texture2DLod_Sampler2D1_Float2_Float1, + BuiltInName::texture2DLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjLod_0H2B0B( + BuiltInId::texture2DProjLod_Sampler2D1_Float3_Float1, + BuiltInName::texture2DProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture2DProjLod_0H3B0B( + BuiltInId::texture2DProjLod_Sampler2D1_Float4_Float1, + BuiltInName::texture2DProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureCubeLod_0J2B0B( + BuiltInId::textureCubeLod_SamplerCube1_Float3_Float1, + BuiltInName::textureCubeLod, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0H1B( + BuiltInId::texture_Sampler2D1_Float2, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0P1B( + BuiltInId::texture_ISampler2D1_Float2, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0U1B( + BuiltInId::texture_USampler2D1_Float2, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0I2B( + BuiltInId::texture_Sampler3D1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B0B2C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0Q2B( + BuiltInId::texture_ISampler3D1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B0B2C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0V2B( + BuiltInId::texture_USampler3D1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B2B2B2C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0J2B( + BuiltInId::texture_SamplerCube1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0R2B( + BuiltInId::texture_ISamplerCube1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0W2B( + BuiltInId::texture_USamplerCube1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0K2B( + BuiltInId::texture_Sampler2DArray1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0S2B( + BuiltInId::texture_ISampler2DArray1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0X2B( + BuiltInId::texture_USampler2DArray1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0H2B( + BuiltInId::textureProj_Sampler2D1_Float3, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0P2B( + BuiltInId::textureProj_ISampler2D1_Float3, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0U2B( + BuiltInId::textureProj_USampler2D1_Float3, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0H3B( + BuiltInId::textureProj_Sampler2D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0P3B( + BuiltInId::textureProj_ISampler2D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0U3B( + BuiltInId::textureProj_USampler2D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B1C0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0I3B( + BuiltInId::textureProj_Sampler3D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B2C0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0Q3B( + BuiltInId::textureProj_ISampler3D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B0B2C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0V3B( + BuiltInId::textureProj_USampler3D1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B2B2B2C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0H1B0B( + BuiltInId::textureLod_Sampler2D1_Float2_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0P1B0B( + BuiltInId::textureLod_ISampler2D1_Float2_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0U1B0B( + BuiltInId::textureLod_USampler2D1_Float2_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0I2B0B( + BuiltInId::textureLod_Sampler3D1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0Q2B0B( + BuiltInId::textureLod_ISampler3D1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0V2B0B( + BuiltInId::textureLod_USampler3D1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0J2B0B( + BuiltInId::textureLod_SamplerCube1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0R2B0B( + BuiltInId::textureLod_ISamplerCube1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0W2B0B( + BuiltInId::textureLod_USamplerCube1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0K2B0B( + BuiltInId::textureLod_Sampler2DArray1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0S2B0B( + BuiltInId::textureLod_ISampler2DArray1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0X2B0B( + BuiltInId::textureLod_USampler2DArray1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0Z2B( + BuiltInId::texture_Sampler2DShadow1_Float3, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0a3B( + BuiltInId::texture_SamplerCubeShadow1_Float4, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0a3B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0b3B( + BuiltInId::texture_Sampler2DArrayShadow1_Float4, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0b3B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0Z3B( + BuiltInId::textureProj_Sampler2DShadow1_Float4, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLod_0Z2B0B( + BuiltInId::textureLod_Sampler2DShadow1_Float3_Float1, + BuiltInName::textureLod, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0H0C( + BuiltInId::textureSize_Sampler2D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0H0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0P0C( + BuiltInId::textureSize_ISampler2D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0P0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0U0C( + BuiltInId::textureSize_USampler2D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0U0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0I0C( + BuiltInId::textureSize_Sampler3D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0I0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0Q0C( + BuiltInId::textureSize_ISampler3D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0Q0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0V0C( + BuiltInId::textureSize_USampler3D1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0V0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0J0C( + BuiltInId::textureSize_SamplerCube1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0J0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0R0C( + BuiltInId::textureSize_ISamplerCube1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0R0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0W0C( + BuiltInId::textureSize_USamplerCube1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0W0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0K0C( + BuiltInId::textureSize_Sampler2DArray1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0K0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0S0C( + BuiltInId::textureSize_ISampler2DArray1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0S0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0X0C( + BuiltInId::textureSize_USampler2DArray1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0X0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0Z0C( + BuiltInId::textureSize_Sampler2DShadow1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0Z0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0a0C( + BuiltInId::textureSize_SamplerCubeShadow1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0a0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0b0C( + BuiltInId::textureSize_Sampler2DArrayShadow1_Int1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0b0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0O( + BuiltInId::textureSize_Sampler2DMS1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0O1C0C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0T( + BuiltInId::textureSize_ISampler2DMS1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0T1C0C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0Y( + BuiltInId::textureSize_USampler2DMS1, + BuiltInName::textureSize, + TExtension::UNDEFINED, + BuiltInParameters::p0Y1C0C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0H2B0B( + BuiltInId::textureProjLod_Sampler2D1_Float3_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0P2B0B( + BuiltInId::textureProjLod_ISampler2D1_Float3_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0U2B0B( + BuiltInId::textureProjLod_USampler2D1_Float3_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0H3B0B( + BuiltInId::textureProjLod_Sampler2D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0P3B0B( + BuiltInId::textureProjLod_ISampler2D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0U3B0B( + BuiltInId::textureProjLod_USampler2D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0I3B0B( + BuiltInId::textureProjLod_Sampler3D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0Q3B0B( + BuiltInId::textureProjLod_ISampler3D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0V3B0B( + BuiltInId::textureProjLod_USampler3D1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLod_0Z3B0B( + BuiltInId::textureProjLod_Sampler2DShadow1_Float4_Float1, + BuiltInName::textureProjLod, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0H1C0C( + BuiltInId::texelFetch_Sampler2D1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0H1C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0P1C0C( + BuiltInId::texelFetch_ISampler2D1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0P1C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0U1C0C( + BuiltInId::texelFetch_USampler2D1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0U1C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0I2C0C( + BuiltInId::texelFetch_Sampler3D1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0I2C0C2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0Q2C0C( + BuiltInId::texelFetch_ISampler3D1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2C0C2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0V2C0C( + BuiltInId::texelFetch_USampler3D1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0V2C0C2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0K2C0C( + BuiltInId::texelFetch_Sampler2DArray1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0K2C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0S2C0C( + BuiltInId::texelFetch_ISampler2DArray1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0S2C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0X2C0C( + BuiltInId::texelFetch_USampler2DArray1_Int3_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0X2C0C1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0H1B1B1B( + BuiltInId::textureGrad_Sampler2D1_Float2_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0P1B1B1B( + BuiltInId::textureGrad_ISampler2D1_Float2_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0U1B1B1B( + BuiltInId::textureGrad_USampler2D1_Float2_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0I2B2B2B( + BuiltInId::textureGrad_Sampler3D1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0Q2B2B2B( + BuiltInId::textureGrad_ISampler3D1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0V2B2B2B( + BuiltInId::textureGrad_USampler3D1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0J2B2B2B( + BuiltInId::textureGrad_SamplerCube1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B2B2B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0R2B2B2B( + BuiltInId::textureGrad_ISamplerCube1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B2B2B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0W2B2B2B( + BuiltInId::textureGrad_USamplerCube1_Float3_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B2B2B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0Z2B1B1B( + BuiltInId::textureGrad_Sampler2DShadow1_Float3_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0a3B2B2B( + BuiltInId::textureGrad_SamplerCubeShadow1_Float4_Float3_Float3, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0a3B2B2B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0K2B1B1B( + BuiltInId::textureGrad_Sampler2DArray1_Float3_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0S2B1B1B( + BuiltInId::textureGrad_ISampler2DArray1_Float3_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0X2B1B1B( + BuiltInId::textureGrad_USampler2DArray1_Float3_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGrad_0b3B1B1B( + BuiltInId::textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2, + BuiltInName::textureGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0b3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0H2B1B1B( + BuiltInId::textureProjGrad_Sampler2D1_Float3_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0P2B1B1B( + BuiltInId::textureProjGrad_ISampler2D1_Float3_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0U2B1B1B( + BuiltInId::textureProjGrad_USampler2D1_Float3_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0H3B1B1B( + BuiltInId::textureProjGrad_Sampler2D1_Float4_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0P3B1B1B( + BuiltInId::textureProjGrad_ISampler2D1_Float4_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0U3B1B1B( + BuiltInId::textureProjGrad_USampler2D1_Float4_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0I3B2B2B( + BuiltInId::textureProjGrad_Sampler3D1_Float4_Float3_Float3, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0Q3B2B2B( + BuiltInId::textureProjGrad_ISampler3D1_Float4_Float3_Float3, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0V3B2B2B( + BuiltInId::textureProjGrad_USampler3D1_Float4_Float3_Float3, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B2B2B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGrad_0Z3B1B1B( + BuiltInId::textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2, + BuiltInName::textureProjGrad, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B1B1B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0H1B1C( + BuiltInId::textureOffset_Sampler2D1_Float2_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0P1B1C( + BuiltInId::textureOffset_ISampler2D1_Float2_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0U1B1C( + BuiltInId::textureOffset_USampler2D1_Float2_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0I2B2C( + BuiltInId::textureOffset_Sampler3D1_Float3_Int3, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0Q2B2C( + BuiltInId::textureOffset_ISampler3D1_Float3_Int3, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0V2B2C( + BuiltInId::textureOffset_USampler3D1_Float3_Int3, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0Z2B1C( + BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0K2B1C( + BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0S2B1C( + BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0X2B1C( + BuiltInId::textureOffset_USampler2DArray1_Float3_Int2, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0H2B1C( + BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0P2B1C( + BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0U2B1C( + BuiltInId::textureProjOffset_USampler2D1_Float3_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0H3B1C( + BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0P3B1C( + BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0U3B1C( + BuiltInId::textureProjOffset_USampler2D1_Float4_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0I3B2C( + BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0Q3B2C( + BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0V3B2C( + BuiltInId::textureProjOffset_USampler3D1_Float4_Int3, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B2C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0Z3B1C( + BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0H1B0B1C( + BuiltInId::textureLodOffset_Sampler2D1_Float2_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0P1B0B1C( + BuiltInId::textureLodOffset_ISampler2D1_Float2_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0U1B0B1C( + BuiltInId::textureLodOffset_USampler2D1_Float2_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0I2B0B2C( + BuiltInId::textureLodOffset_Sampler3D1_Float3_Float1_Int3, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0Q2B0B2C( + BuiltInId::textureLodOffset_ISampler3D1_Float3_Float1_Int3, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0V2B0B2C( + BuiltInId::textureLodOffset_USampler3D1_Float3_Float1_Int3, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0Z2B0B1C( + BuiltInId::textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0K2B0B1C( + BuiltInId::textureLodOffset_Sampler2DArray1_Float3_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0S2B0B1C( + BuiltInId::textureLodOffset_ISampler2DArray1_Float3_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureLodOffset_0X2B0B1C( + BuiltInId::textureLodOffset_USampler2DArray1_Float3_Float1_Int2, + BuiltInName::textureLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0H2B0B1C( + BuiltInId::textureProjLodOffset_Sampler2D1_Float3_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0P2B0B1C( + BuiltInId::textureProjLodOffset_ISampler2D1_Float3_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0U2B0B1C( + BuiltInId::textureProjLodOffset_USampler2D1_Float3_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0H3B0B1C( + BuiltInId::textureProjLodOffset_Sampler2D1_Float4_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0P3B0B1C( + BuiltInId::textureProjLodOffset_ISampler2D1_Float4_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0U3B0B1C( + BuiltInId::textureProjLodOffset_USampler2D1_Float4_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0I3B0B2C( + BuiltInId::textureProjLodOffset_Sampler3D1_Float4_Float1_Int3, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0Q3B0B2C( + BuiltInId::textureProjLodOffset_ISampler3D1_Float4_Float1_Int3, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0V3B0B2C( + BuiltInId::textureProjLodOffset_USampler3D1_Float4_Float1_Int3, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B0B2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjLodOffset_0Z3B0B1C( + BuiltInId::textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2, + BuiltInName::textureProjLodOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0H1C0C1C( + BuiltInId::texelFetchOffset_Sampler2D1_Int2_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0P1C0C1C( + BuiltInId::texelFetchOffset_ISampler2D1_Int2_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0U1C0C1C( + BuiltInId::texelFetchOffset_USampler2D1_Int2_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0I2C0C2C( + BuiltInId::texelFetchOffset_Sampler3D1_Int3_Int1_Int3, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I2C0C2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0Q2C0C2C( + BuiltInId::texelFetchOffset_ISampler3D1_Int3_Int1_Int3, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2C0C2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0V2C0C2C( + BuiltInId::texelFetchOffset_USampler3D1_Int3_Int1_Int3, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V2C0C2C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0K2C0C1C( + BuiltInId::texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0S2C0C1C( + BuiltInId::texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetchOffset_0X2C0C1C( + BuiltInId::texelFetchOffset_USampler2DArray1_Int3_Int1_Int2, + BuiltInName::texelFetchOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2C0C1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0H1B1B1B1C( + BuiltInId::textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0P1B1B1B1C( + BuiltInId::textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0U1B1B1B1C( + BuiltInId::textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0I2B2B2B2C( + BuiltInId::textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0Q2B2B2B2C( + BuiltInId::textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0V2B2B2B2C( + BuiltInId::textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0Z2B1B1B1C( + BuiltInId::textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0K2B1B1B1C( + BuiltInId::textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0S2B1B1B1C( + BuiltInId::textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0X2B1B1B1C( + BuiltInId::textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGradOffset_0b3B1B1B1C( + BuiltInId::textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2, + BuiltInName::textureGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0b3B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0H2B1B1B1C( + BuiltInId::textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0P2B1B1B1C( + BuiltInId::textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0U2B1B1B1C( + BuiltInId::textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0H3B1B1B1C( + BuiltInId::textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0P3B1B1B1C( + BuiltInId::textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0U3B1B1B1C( + BuiltInId::textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0I3B2B2B2C( + BuiltInId::textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0Q3B2B2B2C( + BuiltInId::textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0V3B2B2B2C( + BuiltInId::textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B2B2B2C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjGradOffset_0Z3B1B1B1C( + BuiltInId::textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2, + BuiltInName::textureProjGradOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B1B1B1C, + 5, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0H1B1C0B( + BuiltInId::textureOffset_Sampler2D1_Float2_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0P1B1C0B( + BuiltInId::textureOffset_ISampler2D1_Float2_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0U1B1C0B( + BuiltInId::textureOffset_USampler2D1_Float2_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0I2B2C0B( + BuiltInId::textureOffset_Sampler3D1_Float3_Int3_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0Q2B2C0B( + BuiltInId::textureOffset_ISampler3D1_Float3_Int3_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0V2B2C0B( + BuiltInId::textureOffset_USampler3D1_Float3_Int3_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0Z2B1C0B( + BuiltInId::textureOffset_Sampler2DShadow1_Float3_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0K2B1C0B( + BuiltInId::textureOffset_Sampler2DArray1_Float3_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0S2B1C0B( + BuiltInId::textureOffset_ISampler2DArray1_Float3_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureOffset_0X2B1C0B( + BuiltInId::textureOffset_USampler2DArray1_Float3_Int2_Float1, + BuiltInName::textureOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0H2B1C0B( + BuiltInId::textureProjOffset_Sampler2D1_Float3_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0P2B1C0B( + BuiltInId::textureProjOffset_ISampler2D1_Float3_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0U2B1C0B( + BuiltInId::textureProjOffset_USampler2D1_Float3_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0H3B1C0B( + BuiltInId::textureProjOffset_Sampler2D1_Float4_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0P3B1C0B( + BuiltInId::textureProjOffset_ISampler2D1_Float4_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0U3B1C0B( + BuiltInId::textureProjOffset_USampler2D1_Float4_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0I3B2C0B( + BuiltInId::textureProjOffset_Sampler3D1_Float4_Int3_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0Q3B2C0B( + BuiltInId::textureProjOffset_ISampler3D1_Float4_Int3_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0V3B2C0B( + BuiltInId::textureProjOffset_USampler3D1_Float4_Int3_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B2C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProjOffset_0Z3B1C0B( + BuiltInId::textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1, + BuiltInName::textureProjOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B1C0B, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0L1B( + BuiltInId::texture_SamplerExternalOES1_Float2, + BuiltInName::texture, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L1B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0L2B( + BuiltInId::textureProj_SamplerExternalOES1_Float3, + BuiltInName::textureProj, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0L3B( + BuiltInId::textureProj_SamplerExternalOES1_Float4, + BuiltInName::textureProj, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L3B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0L0C( + BuiltInId::textureSize_SamplerExternalOES1_Int1, + BuiltInName::textureSize, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0L1C0C( + BuiltInId::texelFetch_SamplerExternalOES1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0M1B( + BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2, + BuiltInName::texture, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M1B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0M2B( + BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3, + BuiltInName::textureProj, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0M3B( + BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4, + BuiltInName::textureProj, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M3B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_rgb_2_yuv_2B0G( + BuiltInId::rgb_2_yuv_Float3_YuvCscStandardEXT1, + BuiltInName::rgb_2_yuv, + TExtension::EXT_YUV_target, + BuiltInParameters::p2B0G, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_yuv_2_rgb_2B0G( + BuiltInId::yuv_2_rgb_Float3_YuvCscStandardEXT1, + BuiltInName::yuv_2_rgb, + TExtension::EXT_YUV_target, + BuiltInParameters::p2B0G, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureSize_0M0C( + BuiltInId::textureSize_SamplerExternal2DY2YEXT1_Int1, + BuiltInName::textureSize, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0M1C0C( + BuiltInId::texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0H1B0B( + BuiltInId::texture_Sampler2D1_Float2_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0P1B0B( + BuiltInId::texture_ISampler2D1_Float2_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0U1B0B( + BuiltInId::texture_USampler2D1_Float2_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0I2B0B( + BuiltInId::texture_Sampler3D1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0I2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0Q2B0B( + BuiltInId::texture_ISampler3D1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0Q2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0V2B0B( + BuiltInId::texture_USampler3D1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0V2B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0J2B0B( + BuiltInId::texture_SamplerCube1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0R2B0B( + BuiltInId::texture_ISamplerCube1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0W2B0B( + BuiltInId::texture_USamplerCube1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0K2B0B( + BuiltInId::texture_Sampler2DArray1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0S2B0B( + BuiltInId::texture_ISampler2DArray1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0X2B0B( + BuiltInId::texture_USampler2DArray1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0H2B0B( + BuiltInId::textureProj_Sampler2D1_Float3_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0P2B0B( + BuiltInId::textureProj_ISampler2D1_Float3_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0P2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0U2B0B( + BuiltInId::textureProj_USampler2D1_Float3_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0U2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0H3B0B( + BuiltInId::textureProj_Sampler2D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0H3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0P3B0B( + BuiltInId::textureProj_ISampler2D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0P3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0U3B0B( + BuiltInId::textureProj_USampler2D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0U3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0I3B0B( + BuiltInId::textureProj_Sampler3D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0I3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0Q3B0B( + BuiltInId::textureProj_ISampler3D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0Q3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0V3B0B( + BuiltInId::textureProj_USampler3D1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0V3B0B2C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0Z2B0B( + BuiltInId::texture_Sampler2DShadow1_Float3_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0Z2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0a3B0B( + BuiltInId::texture_SamplerCubeShadow1_Float4_Float1, + BuiltInName::texture, + TExtension::UNDEFINED, + BuiltInParameters::p0a3B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0Z3B0B( + BuiltInId::textureProj_Sampler2DShadow1_Float4_Float1, + BuiltInName::textureProj, + TExtension::UNDEFINED, + BuiltInParameters::p0Z3B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0L1B0B( + BuiltInId::texture_SamplerExternalOES1_Float2_Float1, + BuiltInName::texture, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L1B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0L2B0B( + BuiltInId::textureProj_SamplerExternalOES1_Float3_Float1, + BuiltInName::textureProj, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0L3B0B( + BuiltInId::textureProj_SamplerExternalOES1_Float4_Float1, + BuiltInName::textureProj, + TExtension::OES_EGL_image_external_essl3, + BuiltInParameters::p0L3B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texture_0M1B0B( + BuiltInId::texture_SamplerExternal2DY2YEXT1_Float2_Float1, + BuiltInName::texture, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M1B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0M2B0B( + BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float3_Float1, + BuiltInName::textureProj, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureProj_0M3B0B( + BuiltInId::textureProj_SamplerExternal2DY2YEXT1_Float4_Float1, + BuiltInName::textureProj, + TExtension::EXT_YUV_target, + BuiltInParameters::p0M3B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0O1C0C( + BuiltInId::texelFetch_Sampler2DMS1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0O1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0T1C0C( + BuiltInId::texelFetch_ISampler2DMS1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0T1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_texelFetch_0Y1C0C( + BuiltInId::texelFetch_USampler2DMS1_Int2_Int1, + BuiltInName::texelFetch, + TExtension::UNDEFINED, + BuiltInParameters::p0Y1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0H1B( + BuiltInId::textureGather_Sampler2D1_Float2, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1B1B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0P1B( + BuiltInId::textureGather_ISampler2D1_Float2, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0U1B( + BuiltInId::textureGather_USampler2D1_Float2, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0H1B0C( + BuiltInId::textureGather_Sampler2D1_Float2_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0P1B0C( + BuiltInId::textureGather_ISampler2D1_Float2_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0U1B0C( + BuiltInId::textureGather_USampler2D1_Float2_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0K2B( + BuiltInId::textureGather_Sampler2DArray1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0S2B( + BuiltInId::textureGather_ISampler2DArray1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0X2B( + BuiltInId::textureGather_USampler2DArray1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0K2B0C( + BuiltInId::textureGather_Sampler2DArray1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0S2B0C( + BuiltInId::textureGather_ISampler2DArray1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0X2B0C( + BuiltInId::textureGather_USampler2DArray1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0J2B( + BuiltInId::textureGather_SamplerCube1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0R2B( + BuiltInId::textureGather_ISamplerCube1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B2B2B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0W2B( + BuiltInId::textureGather_USamplerCube1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0J2B0C( + BuiltInId::textureGather_SamplerCube1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0J2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0R2B0C( + BuiltInId::textureGather_ISamplerCube1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0R2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0W2B0C( + BuiltInId::textureGather_USamplerCube1_Float3_Int1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0W2B0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0Z1B( + BuiltInId::textureGather_Sampler2DShadow1_Float2, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0Z1B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0Z1B0B( + BuiltInId::textureGather_Sampler2DShadow1_Float2_Float1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0Z1B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0b2B( + BuiltInId::textureGather_Sampler2DArrayShadow1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0b2B0B1C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0b2B0B( + BuiltInId::textureGather_Sampler2DArrayShadow1_Float3_Float1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0b2B0B1C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0a2B( + BuiltInId::textureGather_SamplerCubeShadow1_Float3, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0a2B0B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGather_0a2B0B( + BuiltInId::textureGather_SamplerCubeShadow1_Float3_Float1, + BuiltInName::textureGather, + TExtension::UNDEFINED, + BuiltInParameters::p0a2B0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0H1B1C( + BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0P1B1C( + BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0U1B1C( + BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0H1B1C0C( + BuiltInId::textureGatherOffset_Sampler2D1_Float2_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0H1B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0P1B1C0C( + BuiltInId::textureGatherOffset_ISampler2D1_Float2_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0P1B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0U1B1C0C( + BuiltInId::textureGatherOffset_USampler2D1_Float2_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0U1B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0K2B1C( + BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0S2B1C( + BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1C0B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0X2B1C( + BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0K2B1C0C( + BuiltInId::textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0K2B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0S2B1C0C( + BuiltInId::textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0S2B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0X2B1C0C( + BuiltInId::textureGatherOffset_USampler2DArray1_Float3_Int2_Int1, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0X2B1C0C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0Z1B0B1C( + BuiltInId::textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0Z1B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_textureGatherOffset_0b2B0B1C( + BuiltInId::textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2, + BuiltInName::textureGatherOffset, + TExtension::UNDEFINED, + BuiltInParameters::p0b2B0B1C, + 4, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_dFdx_0B( + BuiltInId::dFdx_Float1, + BuiltInName::dFdx, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdx_1B( + BuiltInId::dFdx_Float2, + BuiltInName::dFdx, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdx_2B( + BuiltInId::dFdx_Float3, + BuiltInName::dFdx, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdx_3B( + BuiltInId::dFdx_Float4, + BuiltInName::dFdx, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpDFdx, + false); +constexpr const TFunction kFunction_dFdy_0B( + BuiltInId::dFdy_Float1, + BuiltInName::dFdy, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdy_1B( + BuiltInId::dFdy_Float2, + BuiltInName::dFdy, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdy_2B( + BuiltInId::dFdy_Float3, + BuiltInName::dFdy, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_dFdy_3B( + BuiltInId::dFdy_Float4, + BuiltInName::dFdy, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpDFdy, + false); +constexpr const TFunction kFunction_fwidth_0B( + BuiltInId::fwidth_Float1, + BuiltInName::fwidth, + TExtension::UNDEFINED, + BuiltInParameters::p0B0C, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidth_1B( + BuiltInId::fwidth_Float2, + BuiltInName::fwidth, + TExtension::UNDEFINED, + BuiltInParameters::p1B1B0B, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidth_2B( + BuiltInId::fwidth_Float3, + BuiltInName::fwidth, + TExtension::UNDEFINED, + BuiltInParameters::p2B2C, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_fwidth_3B( + BuiltInId::fwidth_Float4, + BuiltInName::fwidth, + TExtension::UNDEFINED, + BuiltInParameters::p3B1B, + 1, + StaticType::Get(), + EOpFwidth, + false); +constexpr const TFunction kFunction_atomicCounter_0F( + BuiltInId::atomicCounter_AtomicCounter1, + BuiltInName::atomicCounter, + TExtension::UNDEFINED, + BuiltInParameters::p0F, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicCounterIncrement_0F( + BuiltInId::atomicCounterIncrement_AtomicCounter1, + BuiltInName::atomicCounterIncrement, + TExtension::UNDEFINED, + BuiltInParameters::p0F, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicCounterDecrement_0F( + BuiltInId::atomicCounterDecrement_AtomicCounter1, + BuiltInName::atomicCounterDecrement, + TExtension::UNDEFINED, + BuiltInParameters::p0F, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicAdd_0D0D( + BuiltInId::atomicAdd_UInt1_UInt1, + BuiltInName::atomicAdd, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicAdd_0C0C( + BuiltInId::atomicAdd_Int1_Int1, + BuiltInName::atomicAdd, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicMin_0D0D( + BuiltInId::atomicMin_UInt1_UInt1, + BuiltInName::atomicMin, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicMin_0C0C( + BuiltInId::atomicMin_Int1_Int1, + BuiltInName::atomicMin, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicMax_0D0D( + BuiltInId::atomicMax_UInt1_UInt1, + BuiltInName::atomicMax, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicMax_0C0C( + BuiltInId::atomicMax_Int1_Int1, + BuiltInName::atomicMax, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicAnd_0D0D( + BuiltInId::atomicAnd_UInt1_UInt1, + BuiltInName::atomicAnd, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicAnd_0C0C( + BuiltInId::atomicAnd_Int1_Int1, + BuiltInName::atomicAnd, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicOr_0D0D( + BuiltInId::atomicOr_UInt1_UInt1, + BuiltInName::atomicOr, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicOr_0C0C( + BuiltInId::atomicOr_Int1_Int1, + BuiltInName::atomicOr, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicXor_0D0D( + BuiltInId::atomicXor_UInt1_UInt1, + BuiltInName::atomicXor, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicXor_0C0C( + BuiltInId::atomicXor_Int1_Int1, + BuiltInName::atomicXor, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicExchange_0D0D( + BuiltInId::atomicExchange_UInt1_UInt1, + BuiltInName::atomicExchange, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicExchange_0C0C( + BuiltInId::atomicExchange_Int1_Int1, + BuiltInName::atomicExchange, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicCompSwap_0D0D0D( + BuiltInId::atomicCompSwap_UInt1_UInt1_UInt1, + BuiltInName::atomicCompSwap, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0D0D0D, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_atomicCompSwap_0C0C0C( + BuiltInId::atomicCompSwap_Int1_Int1_Int1, + BuiltInName::atomicCompSwap, + TExtension::UNDEFINED, + BuiltInParameters::p_io_0C0C0C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0c( + BuiltInId::imageSize_Image2D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0c1C3B, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0d( + BuiltInId::imageSize_IImage2D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0d1C3C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0e( + BuiltInId::imageSize_UImage2D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0e1C3D, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0f( + BuiltInId::imageSize_Image3D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0f2C3B, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0g( + BuiltInId::imageSize_IImage3D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0g2C3C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0h( + BuiltInId::imageSize_UImage3D1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0h2C3D, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0i( + BuiltInId::imageSize_Image2DArray1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0i2C3B, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0j( + BuiltInId::imageSize_IImage2DArray1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0j2C3C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0k( + BuiltInId::imageSize_UImage2DArray1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0k2C3D, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0l( + BuiltInId::imageSize_ImageCube1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0l2C3B, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0m( + BuiltInId::imageSize_IImageCube1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0m2C3C, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageSize_0n( + BuiltInId::imageSize_UImageCube1, + BuiltInName::imageSize, + TExtension::UNDEFINED, + BuiltInParameters::p0n2C3D, + 1, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0c1C( + BuiltInId::imageLoad_Image2D1_Int2, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0c1C3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0d1C( + BuiltInId::imageLoad_IImage2D1_Int2, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0d1C3C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0e1C( + BuiltInId::imageLoad_UImage2D1_Int2, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0e1C3D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0f2C( + BuiltInId::imageLoad_Image3D1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0f2C3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0g2C( + BuiltInId::imageLoad_IImage3D1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0g2C3C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0h2C( + BuiltInId::imageLoad_UImage3D1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0h2C3D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0i2C( + BuiltInId::imageLoad_Image2DArray1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0i2C3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0j2C( + BuiltInId::imageLoad_IImage2DArray1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0j2C3C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0k2C( + BuiltInId::imageLoad_UImage2DArray1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0k2C3D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0l2C( + BuiltInId::imageLoad_ImageCube1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0l2C3B, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0m2C( + BuiltInId::imageLoad_IImageCube1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0m2C3C, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageLoad_0n2C( + BuiltInId::imageLoad_UImageCube1_Int3, + BuiltInName::imageLoad, + TExtension::UNDEFINED, + BuiltInParameters::p0n2C3D, + 2, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0c1C3B( + BuiltInId::imageStore_Image2D1_Int2_Float4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0c1C3B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0d1C3C( + BuiltInId::imageStore_IImage2D1_Int2_Int4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0d1C3C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0e1C3D( + BuiltInId::imageStore_UImage2D1_Int2_UInt4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0e1C3D, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0f2C3B( + BuiltInId::imageStore_Image3D1_Int3_Float4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0f2C3B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0g2C3C( + BuiltInId::imageStore_IImage3D1_Int3_Int4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0g2C3C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0h2C3D( + BuiltInId::imageStore_UImage3D1_Int3_UInt4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0h2C3D, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0i2C3B( + BuiltInId::imageStore_Image2DArray1_Int3_Float4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0i2C3B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0j2C3C( + BuiltInId::imageStore_IImage2DArray1_Int3_Int4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0j2C3C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0k2C3D( + BuiltInId::imageStore_UImage2DArray1_Int3_UInt4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0k2C3D, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0l2C3B( + BuiltInId::imageStore_ImageCube1_Int3_Float4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0l2C3B, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0m2C3C( + BuiltInId::imageStore_IImageCube1_Int3_Int4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0m2C3C, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_imageStore_0n2C3D( + BuiltInId::imageStore_UImageCube1_Int3_UInt4, + BuiltInName::imageStore, + TExtension::UNDEFINED, + BuiltInParameters::p0n2C3D, + 3, + StaticType::Get(), + EOpCallBuiltInFunction, + false); +constexpr const TFunction kFunction_memoryBarrier_( + BuiltInId::memoryBarrier, + BuiltInName::memoryBarrier, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpMemoryBarrier, + false); +constexpr const TFunction kFunction_memoryBarrierAtomicCounter_( + BuiltInId::memoryBarrierAtomicCounter, + BuiltInName::memoryBarrierAtomicCounter, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpMemoryBarrierAtomicCounter, + false); +constexpr const TFunction kFunction_memoryBarrierBuffer_( + BuiltInId::memoryBarrierBuffer, + BuiltInName::memoryBarrierBuffer, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpMemoryBarrierBuffer, + false); +constexpr const TFunction kFunction_memoryBarrierImage_( + BuiltInId::memoryBarrierImage, + BuiltInName::memoryBarrierImage, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpMemoryBarrierImage, + false); +constexpr const TFunction kFunction_barrier_( + BuiltInId::barrier, + BuiltInName::barrier, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpBarrier, + false); +constexpr const TFunction kFunction_memoryBarrierShared_( + BuiltInId::memoryBarrierShared, + BuiltInName::memoryBarrierShared, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpMemoryBarrierShared, + false); +constexpr const TFunction kFunction_groupMemoryBarrier_( + BuiltInId::groupMemoryBarrier, + BuiltInName::groupMemoryBarrier, + TExtension::UNDEFINED, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpGroupMemoryBarrier, + false); +constexpr const TFunction kFunction_EmitVertex_( + BuiltInId::EmitVertex, + BuiltInName::EmitVertex, + TExtension::EXT_geometry_shader, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpEmitVertex, + false); +constexpr const TFunction kFunction_EndPrimitive_( + BuiltInId::EndPrimitive, + BuiltInName::EndPrimitive, + TExtension::EXT_geometry_shader, + BuiltInParameters::empty, + 0, + StaticType::Get(), + EOpEndPrimitive, + false); + +} // namespace BuiltInFunction + +void TSymbolTable::initializeBuiltInVariables(sh::GLenum shaderType, + ShShaderSpec spec, + const ShBuiltInResources &resources) +{ + const TSourceLoc zeroSourceLoc = {0, 0, 0, 0}; + TFieldList *fields_gl_DepthRangeParameters = new TFieldList(); + fields_gl_DepthRangeParameters->push_back(new TField( + new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::near, zeroSourceLoc)); + fields_gl_DepthRangeParameters->push_back( + new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::far, zeroSourceLoc)); + fields_gl_DepthRangeParameters->push_back(new TField( + new TType(EbtFloat, EbpHigh, EvqGlobal, 1, 1), BuiltInName::diff, zeroSourceLoc)); + TStructure *gl_DepthRangeParameters = + new TStructure(BuiltInId::gl_DepthRangeParameters, BuiltInName::gl_DepthRangeParameters, + TExtension::UNDEFINED, fields_gl_DepthRangeParameters); + mVar_gl_DepthRangeParameters = gl_DepthRangeParameters; + TType *type_gl_DepthRange = new TType(gl_DepthRangeParameters); + type_gl_DepthRange->setQualifier(EvqUniform); + type_gl_DepthRange->realize(); + mVar_gl_DepthRange = + new TVariable(BuiltInId::gl_DepthRange, BuiltInName::gl_DepthRange, SymbolType::BuiltIn, + TExtension::UNDEFINED, type_gl_DepthRange); + mVar_gl_MaxVertexAttribs = new TVariable( + BuiltInId::gl_MaxVertexAttribs, BuiltInName::gl_MaxVertexAttribs, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexAttribs); + mVar_gl_MaxVertexAttribs->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexUniformVectors = + new TVariable(BuiltInId::gl_MaxVertexUniformVectors, + BuiltInName::gl_MaxVertexUniformVectors, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexUniformVectors); + mVar_gl_MaxVertexUniformVectors->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexTextureImageUnits = + new TVariable(BuiltInId::gl_MaxVertexTextureImageUnits, + BuiltInName::gl_MaxVertexTextureImageUnits, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexTextureImageUnits); + mVar_gl_MaxVertexTextureImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxCombinedTextureImageUnits = + new TVariable(BuiltInId::gl_MaxCombinedTextureImageUnits, + BuiltInName::gl_MaxCombinedTextureImageUnits, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxCombinedTextureImageUnits); + mVar_gl_MaxCombinedTextureImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxTextureImageUnits = + new TVariable(BuiltInId::gl_MaxTextureImageUnits, BuiltInName::gl_MaxTextureImageUnits, + SymbolType::BuiltIn, TExtension::UNDEFINED, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxTextureImageUnits); + mVar_gl_MaxTextureImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxFragmentUniformVectors = + new TVariable(BuiltInId::gl_MaxFragmentUniformVectors, + BuiltInName::gl_MaxFragmentUniformVectors, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxFragmentUniformVectors); + mVar_gl_MaxFragmentUniformVectors->shareConstPointer(unionArray); + } + mVar_gl_MaxVaryingVectors = new TVariable( + BuiltInId::gl_MaxVaryingVectors, BuiltInName::gl_MaxVaryingVectors, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVaryingVectors); + mVar_gl_MaxVaryingVectors->shareConstPointer(unionArray); + } + mVar_gl_MaxDrawBuffers = new TVariable( + BuiltInId::gl_MaxDrawBuffers, BuiltInName::gl_MaxDrawBuffers, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxDrawBuffers); + mVar_gl_MaxDrawBuffers->shareConstPointer(unionArray); + } + mVar_gl_MaxDualSourceDrawBuffersEXT = new TVariable( + BuiltInId::gl_MaxDualSourceDrawBuffersEXT, BuiltInName::gl_MaxDualSourceDrawBuffersEXT, + SymbolType::BuiltIn, TExtension::EXT_blend_func_extended, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxDualSourceDrawBuffers); + mVar_gl_MaxDualSourceDrawBuffersEXT->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexOutputVectors = + new TVariable(BuiltInId::gl_MaxVertexOutputVectors, BuiltInName::gl_MaxVertexOutputVectors, + SymbolType::BuiltIn, TExtension::UNDEFINED, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexOutputVectors); + mVar_gl_MaxVertexOutputVectors->shareConstPointer(unionArray); + } + mVar_gl_MaxFragmentInputVectors = + new TVariable(BuiltInId::gl_MaxFragmentInputVectors, + BuiltInName::gl_MaxFragmentInputVectors, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxFragmentInputVectors); + mVar_gl_MaxFragmentInputVectors->shareConstPointer(unionArray); + } + mVar_gl_MinProgramTexelOffset = + new TVariable(BuiltInId::gl_MinProgramTexelOffset, BuiltInName::gl_MinProgramTexelOffset, + SymbolType::BuiltIn, TExtension::UNDEFINED, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MinProgramTexelOffset); + mVar_gl_MinProgramTexelOffset->shareConstPointer(unionArray); + } + mVar_gl_MaxProgramTexelOffset = + new TVariable(BuiltInId::gl_MaxProgramTexelOffset, BuiltInName::gl_MaxProgramTexelOffset, + SymbolType::BuiltIn, TExtension::UNDEFINED, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxProgramTexelOffset); + mVar_gl_MaxProgramTexelOffset->shareConstPointer(unionArray); + } + mVar_gl_MaxImageUnits = new TVariable( + BuiltInId::gl_MaxImageUnits, BuiltInName::gl_MaxImageUnits, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxImageUnits); + mVar_gl_MaxImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexImageUniforms = + new TVariable(BuiltInId::gl_MaxVertexImageUniforms, BuiltInName::gl_MaxVertexImageUniforms, + SymbolType::BuiltIn, TExtension::UNDEFINED, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexImageUniforms); + mVar_gl_MaxVertexImageUniforms->shareConstPointer(unionArray); + } + mVar_gl_MaxFragmentImageUniforms = + new TVariable(BuiltInId::gl_MaxFragmentImageUniforms, + BuiltInName::gl_MaxFragmentImageUniforms, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxFragmentImageUniforms); + mVar_gl_MaxFragmentImageUniforms->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeImageUniforms = + new TVariable(BuiltInId::gl_MaxComputeImageUniforms, + BuiltInName::gl_MaxComputeImageUniforms, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxComputeImageUniforms); + mVar_gl_MaxComputeImageUniforms->shareConstPointer(unionArray); + } + mVar_gl_MaxCombinedImageUniforms = + new TVariable(BuiltInId::gl_MaxCombinedImageUniforms, + BuiltInName::gl_MaxCombinedImageUniforms, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxCombinedImageUniforms); + mVar_gl_MaxCombinedImageUniforms->shareConstPointer(unionArray); + } + mVar_gl_MaxCombinedShaderOutputResources = + new TVariable(BuiltInId::gl_MaxCombinedShaderOutputResources, + BuiltInName::gl_MaxCombinedShaderOutputResources, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxCombinedShaderOutputResources); + mVar_gl_MaxCombinedShaderOutputResources->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeWorkGroupCount = + new TVariable(BuiltInId::gl_MaxComputeWorkGroupCount, + BuiltInName::gl_MaxComputeWorkGroupCount, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[3]; + for (size_t index = 0u; index < 3; ++index) + { + unionArray[index].setIConst(resources.MaxComputeWorkGroupCount[index]); + } + mVar_gl_MaxComputeWorkGroupCount->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeWorkGroupSize = + new TVariable(BuiltInId::gl_MaxComputeWorkGroupSize, + BuiltInName::gl_MaxComputeWorkGroupSize, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[3]; + for (size_t index = 0u; index < 3; ++index) + { + unionArray[index].setIConst(resources.MaxComputeWorkGroupSize[index]); + } + mVar_gl_MaxComputeWorkGroupSize->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeUniformComponents = + new TVariable(BuiltInId::gl_MaxComputeUniformComponents, + BuiltInName::gl_MaxComputeUniformComponents, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxComputeUniformComponents); + mVar_gl_MaxComputeUniformComponents->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeTextureImageUnits = + new TVariable(BuiltInId::gl_MaxComputeTextureImageUnits, + BuiltInName::gl_MaxComputeTextureImageUnits, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxComputeTextureImageUnits); + mVar_gl_MaxComputeTextureImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeAtomicCounters = + new TVariable(BuiltInId::gl_MaxComputeAtomicCounters, + BuiltInName::gl_MaxComputeAtomicCounters, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxComputeAtomicCounters); + mVar_gl_MaxComputeAtomicCounters->shareConstPointer(unionArray); + } + mVar_gl_MaxComputeAtomicCounterBuffers = + new TVariable(BuiltInId::gl_MaxComputeAtomicCounterBuffers, + BuiltInName::gl_MaxComputeAtomicCounterBuffers, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxComputeAtomicCounterBuffers); + mVar_gl_MaxComputeAtomicCounterBuffers->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexAtomicCounters = + new TVariable(BuiltInId::gl_MaxVertexAtomicCounters, + BuiltInName::gl_MaxVertexAtomicCounters, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexAtomicCounters); + mVar_gl_MaxVertexAtomicCounters->shareConstPointer(unionArray); + } + mVar_gl_MaxFragmentAtomicCounters = + new TVariable(BuiltInId::gl_MaxFragmentAtomicCounters, + BuiltInName::gl_MaxFragmentAtomicCounters, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxFragmentAtomicCounters); + mVar_gl_MaxFragmentAtomicCounters->shareConstPointer(unionArray); + } + mVar_gl_MaxCombinedAtomicCounters = + new TVariable(BuiltInId::gl_MaxCombinedAtomicCounters, + BuiltInName::gl_MaxCombinedAtomicCounters, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxCombinedAtomicCounters); + mVar_gl_MaxCombinedAtomicCounters->shareConstPointer(unionArray); + } + mVar_gl_MaxAtomicCounterBindings = + new TVariable(BuiltInId::gl_MaxAtomicCounterBindings, + BuiltInName::gl_MaxAtomicCounterBindings, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxAtomicCounterBindings); + mVar_gl_MaxAtomicCounterBindings->shareConstPointer(unionArray); + } + mVar_gl_MaxVertexAtomicCounterBuffers = + new TVariable(BuiltInId::gl_MaxVertexAtomicCounterBuffers, + BuiltInName::gl_MaxVertexAtomicCounterBuffers, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxVertexAtomicCounterBuffers); + mVar_gl_MaxVertexAtomicCounterBuffers->shareConstPointer(unionArray); + } + mVar_gl_MaxFragmentAtomicCounterBuffers = + new TVariable(BuiltInId::gl_MaxFragmentAtomicCounterBuffers, + BuiltInName::gl_MaxFragmentAtomicCounterBuffers, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxFragmentAtomicCounterBuffers); + mVar_gl_MaxFragmentAtomicCounterBuffers->shareConstPointer(unionArray); + } + mVar_gl_MaxCombinedAtomicCounterBuffers = + new TVariable(BuiltInId::gl_MaxCombinedAtomicCounterBuffers, + BuiltInName::gl_MaxCombinedAtomicCounterBuffers, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxCombinedAtomicCounterBuffers); + mVar_gl_MaxCombinedAtomicCounterBuffers->shareConstPointer(unionArray); + } + mVar_gl_MaxAtomicCounterBufferSize = + new TVariable(BuiltInId::gl_MaxAtomicCounterBufferSize, + BuiltInName::gl_MaxAtomicCounterBufferSize, SymbolType::BuiltIn, + TExtension::UNDEFINED, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxAtomicCounterBufferSize); + mVar_gl_MaxAtomicCounterBufferSize->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryInputComponents = new TVariable( + BuiltInId::gl_MaxGeometryInputComponents, BuiltInName::gl_MaxGeometryInputComponents, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryInputComponents); + mVar_gl_MaxGeometryInputComponents->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryOutputComponents = new TVariable( + BuiltInId::gl_MaxGeometryOutputComponents, BuiltInName::gl_MaxGeometryOutputComponents, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryOutputComponents); + mVar_gl_MaxGeometryOutputComponents->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryImageUniforms = new TVariable( + BuiltInId::gl_MaxGeometryImageUniforms, BuiltInName::gl_MaxGeometryImageUniforms, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryImageUniforms); + mVar_gl_MaxGeometryImageUniforms->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryTextureImageUnits = new TVariable( + BuiltInId::gl_MaxGeometryTextureImageUnits, BuiltInName::gl_MaxGeometryTextureImageUnits, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryTextureImageUnits); + mVar_gl_MaxGeometryTextureImageUnits->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryOutputVertices = new TVariable( + BuiltInId::gl_MaxGeometryOutputVertices, BuiltInName::gl_MaxGeometryOutputVertices, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryOutputVertices); + mVar_gl_MaxGeometryOutputVertices->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryTotalOutputComponents = new TVariable( + BuiltInId::gl_MaxGeometryTotalOutputComponents, + BuiltInName::gl_MaxGeometryTotalOutputComponents, SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryTotalOutputComponents); + mVar_gl_MaxGeometryTotalOutputComponents->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryUniformComponents = new TVariable( + BuiltInId::gl_MaxGeometryUniformComponents, BuiltInName::gl_MaxGeometryUniformComponents, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryUniformComponents); + mVar_gl_MaxGeometryUniformComponents->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryAtomicCounters = new TVariable( + BuiltInId::gl_MaxGeometryAtomicCounters, BuiltInName::gl_MaxGeometryAtomicCounters, + SymbolType::BuiltIn, TExtension::EXT_geometry_shader, + StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryAtomicCounters); + mVar_gl_MaxGeometryAtomicCounters->shareConstPointer(unionArray); + } + mVar_gl_MaxGeometryAtomicCounterBuffers = new TVariable( + BuiltInId::gl_MaxGeometryAtomicCounterBuffers, + BuiltInName::gl_MaxGeometryAtomicCounterBuffers, SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, StaticType::Get()); + { + TConstantUnion *unionArray = new TConstantUnion[1]; + unionArray[0].setIConst(resources.MaxGeometryAtomicCounterBuffers); + mVar_gl_MaxGeometryAtomicCounterBuffers->shareConstPointer(unionArray); + } + if (shaderType == GL_FRAGMENT_SHADER) + { + TType *type_gl_FragData = new TType(EbtFloat, EbpMedium, EvqFragData, 4); + if (spec != SH_WEBGL2_SPEC && spec != SH_WEBGL3_SPEC) + { + type_gl_FragData->makeArray(resources.MaxDrawBuffers); + } + else + { + type_gl_FragData->makeArray(1u); + } + type_gl_FragData->realize(); + mVar_gl_FragData = + new TVariable(BuiltInId::gl_FragData, BuiltInName::gl_FragData, SymbolType::BuiltIn, + TExtension::UNDEFINED, type_gl_FragData); + } + if ((shaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_blend_func_extended)) + { + TType *type_gl_SecondaryFragDataEXT = + new TType(EbtFloat, EbpMedium, EvqSecondaryFragDataEXT, 4, 1); + type_gl_SecondaryFragDataEXT->makeArray(resources.MaxDualSourceDrawBuffers); + type_gl_SecondaryFragDataEXT->realize(); + mVar_gl_SecondaryFragDataEXT = new TVariable( + BuiltInId::gl_SecondaryFragDataEXT, BuiltInName::gl_SecondaryFragDataEXT, + SymbolType::BuiltIn, TExtension::EXT_blend_func_extended, type_gl_SecondaryFragDataEXT); + } + if ((shaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_frag_depth)) + { + TType *type_gl_FragDepthEXT = new TType( + EbtFloat, resources.FragmentPrecisionHigh ? EbpHigh : EbpMedium, EvqFragDepthEXT, 1); + type_gl_FragDepthEXT->realize(); + mVar_gl_FragDepthEXT = + new TVariable(BuiltInId::gl_FragDepthEXT, BuiltInName::gl_FragDepthEXT, + SymbolType::BuiltIn, TExtension::EXT_frag_depth, type_gl_FragDepthEXT); + } + TType *type_gl_LastFragData = new TType(EbtFloat, EbpMedium, EvqLastFragData, 4, 1); + type_gl_LastFragData->makeArray(resources.MaxDrawBuffers); + type_gl_LastFragData->realize(); + mVar_gl_LastFragData = + new TVariable(BuiltInId::gl_LastFragData, BuiltInName::gl_LastFragData, SymbolType::BuiltIn, + TExtension::EXT_shader_framebuffer_fetch, type_gl_LastFragData); + TType *type_gl_LastFragDataNV = new TType(EbtFloat, EbpMedium, EvqLastFragData, 4, 1); + type_gl_LastFragDataNV->makeArray(resources.MaxDrawBuffers); + type_gl_LastFragDataNV->realize(); + mVar_gl_LastFragDataNV = new TVariable( + BuiltInId::gl_LastFragDataNV, BuiltInName::gl_LastFragData, SymbolType::BuiltIn, + TExtension::NV_shader_framebuffer_fetch, type_gl_LastFragDataNV); + TFieldList *fields_gl_PerVertex = new TFieldList(); + fields_gl_PerVertex->push_back(new TField(new TType(EbtFloat, EbpHigh, EvqPosition, 4, 1), + BuiltInName::gl_Position, zeroSourceLoc)); + TInterfaceBlock *gl_PerVertex = + new TInterfaceBlock(BuiltInId::gl_PerVertex, BuiltInName::gl_PerVertex, + TExtension::EXT_geometry_shader, fields_gl_PerVertex); + mVar_gl_PerVertex = gl_PerVertex; + if (shaderType == GL_GEOMETRY_SHADER_EXT) + { + TType *type_gl_in = new TType(gl_PerVertex, EvqPerVertexIn, TLayoutQualifier::Create()); + type_gl_in->makeArray(0u); + type_gl_in->realize(); + mVar_gl_in = new TVariable(BuiltInId::gl_in, BuiltInName::gl_in, SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, type_gl_in); + } + TFieldList *fields_gl_PerVertexOutBlock = new TFieldList(); + fields_gl_PerVertexOutBlock->push_back(new TField( + new TType(EbtFloat, EbpHigh, EvqPosition, 4, 1), BuiltInName::gl_Position, zeroSourceLoc)); + TInterfaceBlock *gl_PerVertexOutBlock = + new TInterfaceBlock(BuiltInId::gl_PerVertexOutBlock, BuiltInName::gl_PerVertex, + TExtension::EXT_geometry_shader, fields_gl_PerVertexOutBlock); + TType *type_gl_PositionGS = new TType(EbtFloat, EbpHigh, EvqPosition, 4); + type_gl_PositionGS->setInterfaceBlock(gl_PerVertexOutBlock); + type_gl_PositionGS->realize(); + mVar_gl_PositionGS = + new TVariable(BuiltInId::gl_PositionGS, BuiltInName::gl_Position, SymbolType::BuiltIn, + TExtension::EXT_geometry_shader, type_gl_PositionGS); +} + +const TSymbol *TSymbolTable::findBuiltIn(const ImmutableString &name, int shaderVersion) const +{ + if (name.length() > 35) + { + return nullptr; + } + uint32_t nameHash = name.mangledNameHash(); + if ((nameHash >> 31) != 0) + { + // The name contains [ or {. + return nullptr; + } + if (shaderVersion >= 310) + { + switch (nameHash) + { + case 0x0a50832eu: + { + if (name.beginsWith(BuiltInName::ldexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_ldexp_1B1C; + } + break; + } + case 0x0a50a6eeu: + { + if (name.beginsWith(BuiltInName::frexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_frexp_2B2C; + } + break; + } + case 0x0a52bed1u: + { + if (name.beginsWith(BuiltInName::ldexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_ldexp_0B0C; + } + break; + } + case 0x0a53e9c4u: + { + if (name == BuiltInName::frexp_3B3C) + { + return &BuiltInFunction::kFunction_frexp_3B3C; + } + break; + } + case 0x0a54aa52u: + { + if (name.beginsWith(BuiltInName::ldexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_ldexp_2B2C; + } + break; + } + case 0x0a55008fu: + { + if (name.beginsWith(BuiltInName::frexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_frexp_1B1C; + } + break; + } + case 0x0a5799e7u: + { + if (name.beginsWith(BuiltInName::frexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_frexp_0B0C; + } + break; + } + case 0x0a57c201u: + { + if (name.beginsWith(BuiltInName::ldexp)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_ldexp_3B3C; + } + break; + } + case 0x0e500330u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_3C; + } + break; + } + case 0x0e503089u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_3D; + } + break; + } + case 0x0e508070u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_0C; + } + break; + } + case 0x0e508a05u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_0D; + } + break; + } + case 0x0e51917du: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_1C; + } + break; + } + case 0x0e51dc78u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_1D; + } + break; + } + case 0x0e54832eu: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_2C; + } + break; + } + case 0x0e54b667u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_2D; + } + break; + } + case 0x0e550f72u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_1D; + } + break; + } + case 0x0e5514e7u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_1C; + } + break; + } + case 0x0e5607c2u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_0C; + } + break; + } + case 0x0e5650c7u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_0D; + } + break; + } + case 0x0e56a99cu: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_2D; + } + break; + } + case 0x0e56cd55u: + { + if (name.beginsWith(BuiltInName::findMSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findMSB_2C; + } + break; + } + case 0x0e573680u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_3D; + } + break; + } + case 0x0e574a59u: + { + if (name.beginsWith(BuiltInName::findLSB)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_findLSB_3C; + } + break; + } + case 0x10581cccu: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_2D; + } + break; + } + case 0x10584c2du: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_2C; + } + break; + } + case 0x105896f1u: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_1D; + } + break; + } + case 0x1058cbf7u: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_1C; + } + break; + } + case 0x1059a37cu: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_0D; + } + break; + } + case 0x1059dae9u: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_0C; + } + break; + } + case 0x105b1832u: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_3C; + } + break; + } + case 0x105b2810u: + { + if (name.beginsWith(BuiltInName::bitCount)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_bitCount_3D; + } + break; + } + case 0x106a2daeu: + { + if (name.beginsWith(BuiltInName::atomicOr)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_atomicOr_0D0D; + } + break; + } + case 0x106bd5b6u: + { + if (name.beginsWith(BuiltInName::atomicOr)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_atomicOr_0C0C; + } + break; + } + case 0x12659f72u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0c; + } + break; + } + case 0x1265b53eu: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0g; + } + break; + } + case 0x1265c077u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0d; + } + break; + } + case 0x1265c6e0u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0e; + } + break; + } + case 0x1265cbcau: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0k; + } + break; + } + case 0x1265cc8du: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0f; + } + break; + } + case 0x1265e603u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0h; + } + break; + } + case 0x1265f559u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0j; + } + break; + } + case 0x1265fcacu: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0i; + } + break; + } + case 0x12660ccfu: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0l; + } + break; + } + case 0x12661578u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0m; + } + break; + } + case 0x12661be5u: + { + if (name.beginsWith(BuiltInName::imageSize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_imageSize_0n; + } + break; + } + case 0x12701a06u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0g2C; + } + break; + } + case 0x1270829bu: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0h2C; + } + break; + } + case 0x1270b3f8u: + { + if (name.beginsWith(BuiltInName::atomicAdd)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicAdd_0C0C; + } + break; + } + case 0x1270b766u: + { + if (name.beginsWith(BuiltInName::atomicXor)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicXor_0C0C; + } + break; + } + case 0x12712664u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0n2C; + } + break; + } + case 0x12715f47u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0j2C; + } + break; + } + case 0x12717c89u: + { + if (name.beginsWith(BuiltInName::atomicMin)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicMin_0C0C; + } + break; + } + case 0x127258f0u: + { + if (name.beginsWith(BuiltInName::atomicAdd)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicAdd_0D0D; + } + break; + } + case 0x12731984u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0m2C; + } + break; + } + case 0x12737e4du: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0c1C; + } + break; + } + case 0x1273b8c5u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0d1C; + } + break; + } + case 0x1273d1adu: + { + if (name.beginsWith(BuiltInName::atomicMax)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicMax_0D0D; + } + break; + } + case 0x1273e62au: + { + if (name.beginsWith(BuiltInName::atomicMin)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicMin_0D0D; + } + break; + } + case 0x127474cau: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0k2C; + } + break; + } + case 0x127478d9u: + { + if (name.beginsWith(BuiltInName::atomicAnd)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicAnd_0C0C; + } + break; + } + case 0x1274d104u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0f2C; + } + break; + } + case 0x127539b2u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0i2C; + } + break; + } + case 0x12754b32u: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0e1C; + } + break; + } + case 0x127648cau: + { + if (name.beginsWith(BuiltInName::atomicAnd)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicAnd_0D0D; + } + break; + } + case 0x1276656cu: + { + if (name.beginsWith(BuiltInName::imageLoad)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_imageLoad_0l2C; + } + break; + } + case 0x12771119u: + { + if (name.beginsWith(BuiltInName::atomicXor)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicXor_0D0D; + } + break; + } + case 0x1277882au: + { + if (name.beginsWith(BuiltInName::atomicMax)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_atomicMax_0C0C; + } + break; + } + case 0x1283ba95u: + { + if (name.beginsWith(BuiltInName::uaddCarry)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_uaddCarry_0D0D0D; + } + break; + } + case 0x12840dfbu: + { + if (name == BuiltInName::uaddCarry_2D2D2D) + { + return &BuiltInFunction::kFunction_uaddCarry_2D2D2D; + } + break; + } + case 0x12842566u: + { + if (name == BuiltInName::uaddCarry_3D3D3D) + { + return &BuiltInFunction::kFunction_uaddCarry_3D3D3D; + } + break; + } + case 0x12843bc0u: + { + if (name.beginsWith(BuiltInName::uaddCarry)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_uaddCarry_1D1D1D; + } + break; + } + case 0x1488078cu: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0k2C3D; + } + break; + } + case 0x1488ffa7u: + { + if (name == BuiltInName::usubBorrow_3D3D3D) + { + return &BuiltInFunction::kFunction_usubBorrow_3D3D3D; + } + break; + } + case 0x14896692u: + { + if (name.beginsWith(BuiltInName::usubBorrow)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_usubBorrow_2D2D2D; + } + break; + } + case 0x14896e41u: + { + if (name == BuiltInName::texelFetch_0O1C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0O1C0C; + } + break; + } + case 0x148ab5f1u: + { + if (name == BuiltInName::usubBorrow_1D1D1D) + { + return &BuiltInFunction::kFunction_usubBorrow_1D1D1D; + } + break; + } + case 0x148aca44u: + { + if (name == BuiltInName::imageStore_0d1C3C) + { + return &BuiltInFunction::kFunction_imageStore_0d1C3C; + } + break; + } + case 0x148c1ac9u: + { + if (name == BuiltInName::texelFetch_0T1C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0T1C0C; + } + break; + } + case 0x148c5f8bu: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0f2C3B; + } + break; + } + case 0x148d6aebu: + { + if (name == BuiltInName::imageStore_0c1C3B) + { + return &BuiltInFunction::kFunction_imageStore_0c1C3B; + } + break; + } + case 0x148d8868u: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0g2C3C; + } + break; + } + case 0x148dcfd5u: + { + if (name == BuiltInName::imageStore_0l2C3B) + { + return &BuiltInFunction::kFunction_imageStore_0l2C3B; + } + break; + } + case 0x148dd2bdu: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0Y1C0C; + } + break; + } + case 0x148e37b8u: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0m2C3C; + } + break; + } + case 0x148e668au: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0j2C3C; + } + break; + } + case 0x148ed534u: + { + if (name == BuiltInName::imageStore_0n2C3D) + { + return &BuiltInFunction::kFunction_imageStore_0n2C3D; + } + break; + } + case 0x148f334cu: + { + if (name == BuiltInName::imageStore_0e1C3D) + { + return &BuiltInFunction::kFunction_imageStore_0e1C3D; + } + break; + } + case 0x148f6fe1u: + { + if (name == BuiltInName::usubBorrow_0D0D0D) + { + return &BuiltInFunction::kFunction_usubBorrow_0D0D0D; + } + break; + } + case 0x148f864bu: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0h2C3D; + } + break; + } + case 0x148fd5f1u: + { + if (name.beginsWith(BuiltInName::imageStore)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_imageStore_0i2C3B; + } + break; + } + case 0x187b7b7cu: + { + if (name.beginsWith(BuiltInName::packSnorm4x8)) + { + ASSERT(name.length() == 15); + return &BuiltInFunction::kFunction_packSnorm4x8_3B; + } + break; + } + case 0x187c1f3fu: + { + if (name.beginsWith(BuiltInName::packUnorm4x8)) + { + ASSERT(name.length() == 15); + return &BuiltInFunction::kFunction_packUnorm4x8_3B; + } + break; + } + case 0x18a851efu: + { + if (name == BuiltInName::imulExtended_2C2C2C2C) + { + return &BuiltInFunction::kFunction_imulExtended_2C2C2C2C; + } + break; + } + case 0x18a93bdcu: + { + if (name == BuiltInName::umulExtended_0D0D0D0D) + { + return &BuiltInFunction::kFunction_umulExtended_0D0D0D0D; + } + break; + } + case 0x18a94b63u: + { + if (name == BuiltInName::umulExtended_3D3D3D3D) + { + return &BuiltInFunction::kFunction_umulExtended_3D3D3D3D; + } + break; + } + case 0x18aa71ceu: + { + if (name == BuiltInName::umulExtended_2D2D2D2D) + { + return &BuiltInFunction::kFunction_umulExtended_2D2D2D2D; + } + break; + } + case 0x18ab4baeu: + { + if (name == BuiltInName::umulExtended_1D1D1D1D) + { + return &BuiltInFunction::kFunction_umulExtended_1D1D1D1D; + } + break; + } + case 0x18ac1df0u: + { + if (name == BuiltInName::imulExtended_3C3C3C3C) + { + return &BuiltInFunction::kFunction_imulExtended_3C3C3C3C; + } + break; + } + case 0x18ac377fu: + { + if (name == BuiltInName::imulExtended_0C0C0C0C) + { + return &BuiltInFunction::kFunction_imulExtended_0C0C0C0C; + } + break; + } + case 0x18ae7b8cu: + { + if (name == BuiltInName::imulExtended_1C1C1C1C) + { + return &BuiltInFunction::kFunction_imulExtended_1C1C1C1C; + } + break; + } + case 0x1a7538dfu: + { + if (name.beginsWith(BuiltInName::memoryBarrier)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_memoryBarrier_; + } + break; + } + case 0x1a805162u: + { + if (name.beginsWith(BuiltInName::atomicCounter)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_atomicCounter_0F; + } + break; + } + case 0x1a907855u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0P1B; + } + break; + } + case 0x1a90d2c2u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0U1B; + } + break; + } + case 0x1a92a1ceu: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0H1B; + } + break; + } + case 0x1a92e9e5u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0a2B; + } + break; + } + case 0x1a93b6c9u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0X2B; + } + break; + } + case 0x1a93d703u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0W2B; + } + break; + } + case 0x1a9418e8u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0S2B; + } + break; + } + case 0x1a94543du: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0K2B; + } + break; + } + case 0x1a960122u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0Z1B; + } + break; + } + case 0x1a96f0e7u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0b2B; + } + break; + } + case 0x1a973644u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0R2B; + } + break; + } + case 0x1a979ae3u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureGather_0J2B; + } + break; + } + case 0x1aa023e1u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0U1B0C; + } + break; + } + case 0x1aa086cfu: + { + if (name == BuiltInName::textureGather_0P1B0C) + { + return &BuiltInFunction::kFunction_textureGather_0P1B0C; + } + break; + } + case 0x1aa1ab43u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0b2B0B; + } + break; + } + case 0x1aa1bc4cu: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0X2B0C; + } + break; + } + case 0x1aa3ef46u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0S2B0C; + } + break; + } + case 0x1aa4986bu: + { + if (name == BuiltInName::textureGather_0J2B0C) + { + return &BuiltInFunction::kFunction_textureGather_0J2B0C; + } + break; + } + case 0x1aa4c59du: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0H1B0C; + } + break; + } + case 0x1aa573ecu: + { + if (name == BuiltInName::textureGather_0a2B0B) + { + return &BuiltInFunction::kFunction_textureGather_0a2B0B; + } + break; + } + case 0x1aa590bdu: + { + if (name == BuiltInName::textureGather_0R2B0C) + { + return &BuiltInFunction::kFunction_textureGather_0R2B0C; + } + break; + } + case 0x1aa5f0c6u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0Z1B0B; + } + break; + } + case 0x1aa6c806u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0W2B0C; + } + break; + } + case 0x1aa78b86u: + { + if (name.beginsWith(BuiltInName::textureGather)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureGather_0K2B0C; + } + break; + } + case 0x1c894fb3u: + { + if (name.beginsWith(BuiltInName::unpackSnorm4x8)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_unpackSnorm4x8_0D; + } + break; + } + case 0x1c8be3bau: + { + if (name.beginsWith(BuiltInName::unpackUnorm4x8)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_unpackUnorm4x8_0D; + } + break; + } + case 0x1c9986beu: + { + if (name.beginsWith(BuiltInName::atomicExchange)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_atomicExchange_0D0D; + } + break; + } + case 0x1c9b5eecu: + { + if (name.beginsWith(BuiltInName::atomicExchange)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_atomicExchange_0C0C; + } + break; + } + case 0x1ca86085u: + { + if (name.beginsWith(BuiltInName::atomicCompSwap)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_atomicCompSwap_0C0C0C; + } + break; + } + case 0x1caa900cu: + { + if (name == BuiltInName::atomicCompSwap_0D0D0D) + { + return &BuiltInFunction::kFunction_atomicCompSwap_0D0D0D; + } + break; + } + case 0x1cb84b0cu: + { + if (name == BuiltInName::bitfieldInsert_3D3D0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_3D3D0C0C; + } + break; + } + case 0x1cb880bfu: + { + if (name == BuiltInName::bitfieldInsert_3C3C0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_3C3C0C0C; + } + break; + } + case 0x1cb90fd0u: + { + if (name == BuiltInName::bitfieldInsert_1C1C0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_1C1C0C0C; + } + break; + } + case 0x1cb9fb13u: + { + if (name == BuiltInName::bitfieldInsert_1D1D0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_1D1D0C0C; + } + break; + } + case 0x1cbb43f5u: + { + if (name == BuiltInName::bitfieldInsert_0D0D0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_0D0D0C0C; + } + break; + } + case 0x1cbb9db3u: + { + if (name == BuiltInName::bitfieldInsert_2D2D0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_2D2D0C0C; + } + break; + } + case 0x1cbdf898u: + { + if (name == BuiltInName::bitfieldInsert_0C0C0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_0C0C0C0C; + } + break; + } + case 0x1cbfaf73u: + { + if (name == BuiltInName::bitfieldInsert_2C2C0C0C) + { + return &BuiltInFunction::kFunction_bitfieldInsert_2C2C0C0C; + } + break; + } + case 0x1e907f62u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_3D; + } + break; + } + case 0x1e9088f7u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_3C; + } + break; + } + case 0x1e91c654u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_0C; + } + break; + } + case 0x1e91e675u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_0D; + } + break; + } + case 0x1e96ddc2u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_1D; + } + break; + } + case 0x1e970da3u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_1C; + } + break; + } + case 0x1e9744d7u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_2D; + } + break; + } + case 0x1e9797d2u: + { + if (name.beginsWith(BuiltInName::bitfieldReverse)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_bitfieldReverse_2C; + } + break; + } + case 0x1eb0c64fu: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_2C0C0C; + } + break; + } + case 0x1eb0f9fau: + { + if (name == BuiltInName::bitfieldExtract_0D0C0C) + { + return &BuiltInFunction::kFunction_bitfieldExtract_0D0C0C; + } + break; + } + case 0x1eb12f29u: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_3D0C0C; + } + break; + } + case 0x1eb17d11u: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_3C0C0C; + } + break; + } + case 0x1eb17f7du: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_0C0C0C; + } + break; + } + case 0x1eb19a50u: + { + if (name == BuiltInName::bitfieldExtract_1C0C0C) + { + return &BuiltInFunction::kFunction_bitfieldExtract_1C0C0C; + } + break; + } + case 0x1eb28b55u: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_2D0C0C; + } + break; + } + case 0x1eb5f0c8u: + { + if (name.beginsWith(BuiltInName::bitfieldExtract)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_bitfieldExtract_1D0C0C; + } + break; + } + case 0x249e7359u: + { + if (name.beginsWith(BuiltInName::memoryBarrierImage)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_memoryBarrierImage_; + } + break; + } + case 0x26a7e24bu: + { + if (name.beginsWith(BuiltInName::memoryBarrierBuffer)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_memoryBarrierBuffer_; + } + break; + } + case 0x26d1d7a3u: + { + if (name.beginsWith(BuiltInName::textureGatherOffset)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_textureGatherOffset_0P1B1C; + } + break; + } + case 0x26d1f440u: + { + if (name.beginsWith(BuiltInName::textureGatherOffset)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_textureGatherOffset_0K2B1C; + } + break; + } + case 0x26d29f74u: + { + if (name.beginsWith(BuiltInName::textureGatherOffset)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_textureGatherOffset_0S2B1C; + } + break; + } + case 0x26d701d7u: + { + if (name.beginsWith(BuiltInName::textureGatherOffset)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_textureGatherOffset_0X2B1C; + } + break; + } + case 0x26d71952u: + { + if (name.beginsWith(BuiltInName::textureGatherOffset)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_textureGatherOffset_0H1B1C; + } + break; + } + case 0x26d7dce7u: + { + if (name == BuiltInName::textureGatherOffset_0U1B1C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0U1B1C; + } + break; + } + case 0x26e015c9u: + { + if (name == BuiltInName::textureGatherOffset_0S2B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0S2B1C0C; + } + break; + } + case 0x26e1df8cu: + { + if (name == BuiltInName::textureGatherOffset_0X2B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0X2B1C0C; + } + break; + } + case 0x26e2cb51u: + { + if (name == BuiltInName::textureGatherOffset_0U1B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0U1B1C0C; + } + break; + } + case 0x26e459f8u: + { + if (name == BuiltInName::textureGatherOffset_0K2B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0K2B1C0C; + } + break; + } + case 0x26e476d0u: + { + if (name == BuiltInName::textureGatherOffset_0H1B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0H1B1C0C; + } + break; + } + case 0x26e596a4u: + { + if (name == BuiltInName::textureGatherOffset_0Z1B0B1C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0Z1B0B1C; + } + break; + } + case 0x26e5b6bdu: + { + if (name == BuiltInName::textureGatherOffset_0P1B1C0C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0P1B1C0C; + } + break; + } + case 0x26e6991bu: + { + if (name == BuiltInName::textureGatherOffset_0b2B0B1C) + { + return &BuiltInFunction::kFunction_textureGatherOffset_0b2B0B1C; + } + break; + } + case 0x2ccf8f34u: + { + if (name.beginsWith(BuiltInName::atomicCounterIncrement)) + { + ASSERT(name.length() == 25); + return &BuiltInFunction::kFunction_atomicCounterIncrement_0F; + } + break; + } + case 0x2ccfbbbeu: + { + if (name.beginsWith(BuiltInName::atomicCounterDecrement)) + { + ASSERT(name.length() == 25); + return &BuiltInFunction::kFunction_atomicCounterDecrement_0F; + } + break; + } + case 0x34ded18du: + { + if (name.beginsWith(BuiltInName::memoryBarrierAtomicCounter)) + { + ASSERT(name.length() == 27); + return &BuiltInFunction::kFunction_memoryBarrierAtomicCounter_; + } + break; + } + case 0x7e2bef7au: + { + if (name == BuiltInName::gl_in) + { + // Only initialized if shaderType == GL_GEOMETRY_SHADER_EXT + return mVar_gl_in; + } + break; + } + case 0x7e8166efu: + { + if (name == BuiltInName::gl_MaxImageUnits) + { + return mVar_gl_MaxImageUnits; + } + break; + } + case 0x7ecf4a1bu: + { + if (name == BuiltInName::gl_MaxVertexImageUniforms) + { + return mVar_gl_MaxVertexImageUniforms; + } + break; + } + case 0x7ed27574u: + { + if (name == BuiltInName::gl_MaxVertexAtomicCounters) + { + return mVar_gl_MaxVertexAtomicCounters; + } + break; + } + case 0x7ed2bd5cu: + { + if (name == BuiltInName::gl_MaxComputeImageUniforms) + { + return mVar_gl_MaxComputeImageUniforms; + } + break; + } + case 0x7ed77973u: + { + if (name == BuiltInName::gl_MaxComputeWorkGroupSize) + { + return mVar_gl_MaxComputeWorkGroupSize; + } + break; + } + case 0x7ed9ae57u: + { + if (name == BuiltInName::gl_MaxCombinedImageUniforms) + { + return mVar_gl_MaxCombinedImageUniforms; + } + break; + } + case 0x7ed9f437u: + { + if (name == BuiltInName::gl_MaxGeometryImageUniforms) + { + return mVar_gl_MaxGeometryImageUniforms; + } + break; + } + case 0x7edacc17u: + { + if (name == BuiltInName::gl_MaxAtomicCounterBindings) + { + return mVar_gl_MaxAtomicCounterBindings; + } + break; + } + case 0x7ede0db3u: + { + if (name == BuiltInName::gl_MaxComputeAtomicCounters) + { + return mVar_gl_MaxComputeAtomicCounters; + } + break; + } + case 0x7edeadeeu: + { + if (name == BuiltInName::gl_MaxComputeWorkGroupCount) + { + return mVar_gl_MaxComputeWorkGroupCount; + } + break; + } + case 0x7edf534au: + { + if (name == BuiltInName::gl_MaxFragmentImageUniforms) + { + return mVar_gl_MaxFragmentImageUniforms; + } + break; + } + case 0x7ee1b439u: + { + if (name == BuiltInName::gl_MaxGeometryOutputVertices) + { + return mVar_gl_MaxGeometryOutputVertices; + } + break; + } + case 0x7ee23dcau: + { + if (name == BuiltInName::gl_MaxFragmentAtomicCounters) + { + return mVar_gl_MaxFragmentAtomicCounters; + } + break; + } + case 0x7ee400c5u: + { + if (name == BuiltInName::gl_MaxCombinedAtomicCounters) + { + return mVar_gl_MaxCombinedAtomicCounters; + } + break; + } + case 0x7ee6d3cfu: + { + if (name == BuiltInName::gl_MaxGeometryAtomicCounters) + { + return mVar_gl_MaxGeometryAtomicCounters; + } + break; + } + case 0x7eec3ae1u: + { + if (name == BuiltInName::gl_MaxGeometryInputComponents) + { + return mVar_gl_MaxGeometryInputComponents; + } + break; + } + case 0x7eecdfadu: + { + if (name == BuiltInName::gl_MaxAtomicCounterBufferSize) + { + return mVar_gl_MaxAtomicCounterBufferSize; + } + break; + } + case 0x7ef00fc2u: + { + if (name == BuiltInName::gl_MaxComputeTextureImageUnits) + { + return mVar_gl_MaxComputeTextureImageUnits; + } + break; + } + case 0x7ef3740bu: + { + if (name == BuiltInName::gl_MaxComputeUniformComponents) + { + return mVar_gl_MaxComputeUniformComponents; + } + break; + } + case 0x7ef69ab4u: + { + if (name == BuiltInName::gl_MaxGeometryOutputComponents) + { + return mVar_gl_MaxGeometryOutputComponents; + } + break; + } + case 0x7ef9b17du: + { + if (name == BuiltInName::gl_MaxGeometryTextureImageUnits) + { + return mVar_gl_MaxGeometryTextureImageUnits; + } + break; + } + case 0x7efe1865u: + { + if (name == BuiltInName::gl_MaxGeometryUniformComponents) + { + return mVar_gl_MaxGeometryUniformComponents; + } + break; + } + case 0x7f008375u: + { + if (name == BuiltInName::gl_MaxVertexAtomicCounterBuffers) + { + return mVar_gl_MaxVertexAtomicCounterBuffers; + } + break; + } + case 0x7f0d626fu: + { + if (name == BuiltInName::gl_MaxComputeAtomicCounterBuffers) + { + return mVar_gl_MaxComputeAtomicCounterBuffers; + } + break; + } + case 0x7f11e359u: + { + if (name == BuiltInName::gl_MaxCombinedAtomicCounterBuffers) + { + return mVar_gl_MaxCombinedAtomicCounterBuffers; + } + break; + } + case 0x7f170f84u: + { + if (name == BuiltInName::gl_MaxGeometryAtomicCounterBuffers) + { + return mVar_gl_MaxGeometryAtomicCounterBuffers; + } + break; + } + case 0x7f17bd18u: + { + if (name == BuiltInName::gl_MaxFragmentAtomicCounterBuffers) + { + return mVar_gl_MaxFragmentAtomicCounterBuffers; + } + break; + } + case 0x7f1c60f8u: + { + if (name == BuiltInName::gl_MaxCombinedShaderOutputResources) + { + return mVar_gl_MaxCombinedShaderOutputResources; + } + break; + } + case 0x7f1cd073u: + { + if (name == BuiltInName::gl_MaxGeometryTotalOutputComponents) + { + return mVar_gl_MaxGeometryTotalOutputComponents; + } + break; + } + } + if (mShaderType == GL_COMPUTE_SHADER) + { + switch (nameHash) + { + case 0x0e41a660u: + { + if (name.beginsWith(BuiltInName::barrier)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_barrier_; + } + break; + } + case 0x249ee97cu: + { + if (name.beginsWith(BuiltInName::groupMemoryBarrier)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_groupMemoryBarrier_; + } + break; + } + case 0x26a4d8e6u: + { + if (name.beginsWith(BuiltInName::memoryBarrierShared)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_memoryBarrierShared_; + } + break; + } + case 0x7e736b62u: + { + if (name == BuiltInName::gl_WorkGroupID) + { + return &BuiltInVariable::kVar_gl_WorkGroupID; + } + break; + } + case 0x7e808e8fu: + { + if (name == BuiltInName::gl_WorkGroupSize) + { + return &BuiltInVariable::kVar_gl_WorkGroupSize; + } + break; + } + case 0x7e82b146u: + { + if (name == BuiltInName::gl_NumWorkGroups) + { + return &BuiltInVariable::kVar_gl_NumWorkGroups; + } + break; + } + case 0x7ea251edu: + { + if (name == BuiltInName::gl_LocalInvocationID) + { + return &BuiltInVariable::kVar_gl_LocalInvocationID; + } + break; + } + case 0x7ead13a8u: + { + if (name == BuiltInName::gl_GlobalInvocationID) + { + return &BuiltInVariable::kVar_gl_GlobalInvocationID; + } + break; + } + case 0x7ebcd395u: + { + if (name == BuiltInName::gl_LocalInvocationIndex) + { + return &BuiltInVariable::kVar_gl_LocalInvocationIndex; + } + break; + } + } + } + if (mShaderType == GL_GEOMETRY_SHADER_EXT) + { + switch (nameHash) + { + case 0x145d55c9u: + { + if (name.beginsWith(BuiltInName::EmitVertex)) + { + ASSERT(name.length() == 11); + return &BuiltInFunction::kFunction_EmitVertex_; + } + break; + } + case 0x186fcde2u: + { + if (name.beginsWith(BuiltInName::EndPrimitive)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_EndPrimitive_; + } + break; + } + case 0x7e400f84u: + { + if (name == BuiltInName::gl_Layer) + { + return &BuiltInVariable::kVar_gl_LayerGS; + } + break; + } + case 0x7e580bc5u: + { + if (name == BuiltInName::gl_Position) + { + return mVar_gl_PositionGS; + } + break; + } + case 0x7e67167au: + { + if (name == BuiltInName::gl_PerVertex) + { + return mVar_gl_PerVertex; + } + break; + } + case 0x7e742076u: + { + if (name == BuiltInName::gl_PrimitiveID) + { + return &BuiltInVariable::kVar_gl_PrimitiveIDGS; + } + break; + } + case 0x7e7fe684u: + { + if (name == BuiltInName::gl_InvocationID) + { + return &BuiltInVariable::kVar_gl_InvocationID; + } + break; + } + case 0x7e865240u: + { + if (name == BuiltInName::gl_PrimitiveIDIn) + { + return &BuiltInVariable::kVar_gl_PrimitiveIDIn; + } + break; + } + } + } + if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_geometry_shader)) + { + switch (nameHash) + { + case 0x7e400f84u: + { + if (name == BuiltInName::gl_Layer) + { + return &BuiltInVariable::kVar_gl_Layer; + } + break; + } + case 0x7e742076u: + { + if (name == BuiltInName::gl_PrimitiveID) + { + return &BuiltInVariable::kVar_gl_PrimitiveID; + } + break; + } + } + } + } + if (shaderVersion >= 300) + { + switch (nameHash) + { + case 0x06309dbcu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_0C; + } + break; + } + case 0x0631d85fu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_3C; + } + break; + } + case 0x06370c70u: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_2C; + } + break; + } + case 0x06378eb0u: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_1C; + } + break; + } + case 0x06408ba2u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2D0D; + } + break; + } + case 0x0640f128u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1C0C; + } + break; + } + case 0x06420bb0u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_0D0D; + } + break; + } + case 0x064236d1u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2D2D; + } + break; + } + case 0x06425522u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3C0C; + } + break; + } + case 0x06425db3u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2C0C; + } + break; + } + case 0x06429550u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2D2D; + } + break; + } + case 0x06429e9cu: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2C0C; + } + break; + } + case 0x0642c869u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3D3D; + } + break; + } + case 0x0642dbfeu: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3C3C; + } + break; + } + case 0x064305b5u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3D3D; + } + break; + } + case 0x06436c9au: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1D0D; + } + break; + } + case 0x0643ebd5u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3D0D; + } + break; + } + case 0x06441467u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2C2C; + } + break; + } + case 0x0644176eu: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1C1C; + } + break; + } + case 0x06443b94u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2D0D; + } + break; + } + case 0x06448798u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3C3C; + } + break; + } + case 0x0644a6dfu: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1D1D; + } + break; + } + case 0x0644cd73u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2C2C; + } + break; + } + case 0x06450593u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1C0C; + } + break; + } + case 0x06452105u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1D0D; + } + break; + } + case 0x06454045u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_0C0C; + } + break; + } + case 0x0645e25du: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_0C0C; + } + break; + } + case 0x06460349u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1D1D; + } + break; + } + case 0x06472b16u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3D0D; + } + break; + } + case 0x06473146u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_0D0D; + } + break; + } + case 0x06475b89u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3C0C; + } + break; + } + case 0x0647bc75u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1C1C; + } + break; + } + case 0x0654b2f8u: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_2B2B2E; + } + break; + } + case 0x0655a7e2u: + { + if (name == BuiltInName::mix_0B0B0E) + { + return &BuiltInFunction::kFunction_mix_0B0B0E; + } + break; + } + case 0x06567d08u: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_3B3B3E; + } + break; + } + case 0x0657f3adu: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_1B1B1E; + } + break; + } + case 0x0838025eu: + { + if (name.beginsWith(BuiltInName::tanh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_tanh_3B; + } + break; + } + case 0x0838944cu: + { + if (name.beginsWith(BuiltInName::tanh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_tanh_0B; + } + break; + } + case 0x08392747u: + { + if (name.beginsWith(BuiltInName::sinh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sinh_2B; + } + break; + } + case 0x08398f4au: + { + if (name.beginsWith(BuiltInName::sinh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sinh_1B; + } + break; + } + case 0x083991ddu: + { + if (name.beginsWith(BuiltInName::tanh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_tanh_1B; + } + break; + } + case 0x083aa373u: + { + if (name.beginsWith(BuiltInName::sinh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sinh_0B; + } + break; + } + case 0x083acb5eu: + { + if (name.beginsWith(BuiltInName::tanh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_tanh_2B; + } + break; + } + case 0x083acbf5u: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_1C; + } + break; + } + case 0x083b5c45u: + { + if (name.beginsWith(BuiltInName::cosh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_cosh_0B; + } + break; + } + case 0x083bd9f8u: + { + if (name.beginsWith(BuiltInName::sinh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sinh_3B; + } + break; + } + case 0x083c1656u: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_2C; + } + break; + } + case 0x083c57c4u: + { + if (name.beginsWith(BuiltInName::cosh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_cosh_1B; + } + break; + } + case 0x083d503bu: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_3C; + } + break; + } + case 0x083d8227u: + { + if (name.beginsWith(BuiltInName::cosh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_cosh_2B; + } + break; + } + case 0x083dd369u: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_0C; + } + break; + } + case 0x083ed2deu: + { + if (name.beginsWith(BuiltInName::cosh)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_cosh_3B; + } + break; + } + case 0x084807e9u: + { + if (name.beginsWith(BuiltInName::modf)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_modf_3B3B; + } + break; + } + case 0x084a908au: + { + if (name.beginsWith(BuiltInName::modf)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_modf_1B1B; + } + break; + } + case 0x084bf445u: + { + if (name.beginsWith(BuiltInName::modf)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_modf_0B0B; + } + break; + } + case 0x084fa835u: + { + if (name.beginsWith(BuiltInName::modf)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_modf_2B2B; + } + break; + } + case 0x0a400148u: + { + if (name.beginsWith(BuiltInName::asinh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_asinh_2B; + } + break; + } + case 0x0a406460u: + { + if (name.beginsWith(BuiltInName::isnan)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isnan_2B; + } + break; + } + case 0x0a407c52u: + { + if (name.beginsWith(BuiltInName::round)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_round_0B; + } + break; + } + case 0x0a412446u: + { + if (name.beginsWith(BuiltInName::trunc)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_trunc_0B; + } + break; + } + case 0x0a4125d1u: + { + if (name.beginsWith(BuiltInName::asinh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_asinh_3B; + } + break; + } + case 0x0a4189d9u: + { + if (name.beginsWith(BuiltInName::round)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_round_3B; + } + break; + } + case 0x0a41bc4bu: + { + if (name.beginsWith(BuiltInName::trunc)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_trunc_3B; + } + break; + } + case 0x0a4262ceu: + { + if (name.beginsWith(BuiltInName::isinf)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isinf_2B; + } + break; + } + case 0x0a42b872u: + { + if (name.beginsWith(BuiltInName::trunc)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_trunc_2B; + } + break; + } + case 0x0a430643u: + { + if (name.beginsWith(BuiltInName::atanh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_atanh_2B; + } + break; + } + case 0x0a43b397u: + { + if (name.beginsWith(BuiltInName::isinf)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isinf_3B; + } + break; + } + case 0x0a43edf9u: + { + if (name.beginsWith(BuiltInName::trunc)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_trunc_1B; + } + break; + } + case 0x0a4431a8u: + { + if (name.beginsWith(BuiltInName::atanh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_atanh_1B; + } + break; + } + case 0x0a443a26u: + { + if (name.beginsWith(BuiltInName::isinf)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isinf_0B; + } + break; + } + case 0x0a44ad91u: + { + if (name.beginsWith(BuiltInName::acosh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_acosh_1B; + } + break; + } + case 0x0a452617u: + { + if (name.beginsWith(BuiltInName::isinf)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isinf_1B; + } + break; + } + case 0x0a4561b0u: + { + if (name.beginsWith(BuiltInName::isnan)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isnan_3B; + } + break; + } + case 0x0a4582c9u: + { + if (name.beginsWith(BuiltInName::atanh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_atanh_0B; + } + break; + } + case 0x0a45fcfdu: + { + if (name.beginsWith(BuiltInName::atanh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_atanh_3B; + } + break; + } + case 0x0a461d10u: + { + if (name.beginsWith(BuiltInName::acosh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_acosh_0B; + } + break; + } + case 0x0a464ad3u: + { + if (name.beginsWith(BuiltInName::asinh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_asinh_0B; + } + break; + } + case 0x0a46778au: + { + if (name.beginsWith(BuiltInName::acosh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_acosh_3B; + } + break; + } + case 0x0a46ab3bu: + { + if (name.beginsWith(BuiltInName::isnan)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isnan_0B; + } + break; + } + case 0x0a46f2d2u: + { + if (name.beginsWith(BuiltInName::round)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_round_2B; + } + break; + } + case 0x0a4758c8u: + { + if (name.beginsWith(BuiltInName::round)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_round_1B; + } + break; + } + case 0x0a478c93u: + { + if (name.beginsWith(BuiltInName::acosh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_acosh_2B; + } + break; + } + case 0x0a47bb52u: + { + if (name.beginsWith(BuiltInName::asinh)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_asinh_1B; + } + break; + } + case 0x0a47fa7au: + { + if (name.beginsWith(BuiltInName::isnan)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_isnan_1B; + } + break; + } + case 0x0a524bc4u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_2D2D; + } + break; + } + case 0x0a5613e7u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_1D1D; + } + break; + } + case 0x0a56ba24u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_3D3D; + } + break; + } + case 0x0a601dd8u: + { + if (name == BuiltInName::clamp_2C2C2C) + { + return &BuiltInFunction::kFunction_clamp_2C2C2C; + } + break; + } + case 0x0a60570du: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_1D0D0D; + } + break; + } + case 0x0a60d0c5u: + { + if (name == BuiltInName::clamp_1C0C0C) + { + return &BuiltInFunction::kFunction_clamp_1C0C0C; + } + break; + } + case 0x0a621a2bu: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_0C0C0C; + } + break; + } + case 0x0a623042u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_2D0D0D; + } + break; + } + case 0x0a624f01u: + { + if (name == BuiltInName::clamp_3C0C0C) + { + return &BuiltInFunction::kFunction_clamp_3C0C0C; + } + break; + } + case 0x0a62ab50u: + { + if (name == BuiltInName::clamp_1C1C1C) + { + return &BuiltInFunction::kFunction_clamp_1C1C1C; + } + break; + } + case 0x0a631d0bu: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_1D1D1D; + } + break; + } + case 0x0a64f567u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_2D2D2D; + } + break; + } + case 0x0a656274u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_3C3C3C; + } + break; + } + case 0x0a65a625u: + { + if (name == BuiltInName::clamp_3D0D0D) + { + return &BuiltInFunction::kFunction_clamp_3D0D0D; + } + break; + } + case 0x0a660047u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_2C0C0C; + } + break; + } + case 0x0a660f60u: + { + if (name == BuiltInName::clamp_0D0D0D) + { + return &BuiltInFunction::kFunction_clamp_0D0D0D; + } + break; + } + case 0x0a674065u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_3D3D3D; + } + break; + } + case 0x0e503084u: + { + if (name.beginsWith(BuiltInName::inverse)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_inverse_5B; + } + break; + } + case 0x0e507cbdu: + { + if (name.beginsWith(BuiltInName::inverse)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_inverse_AB; + } + break; + } + case 0x0e50cc43u: + { + if (name.beginsWith(BuiltInName::inverse)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_inverse_FB; + } + break; + } + case 0x0e60445cu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0S2B; + } + break; + } + case 0x0e61222eu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0K2B; + } + break; + } + case 0x0e61df23u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0V2B; + } + break; + } + case 0x0e61e49du: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0Z2B; + } + break; + } + case 0x0e625169u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0I2B; + } + break; + } + case 0x0e638fabu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0Q2B; + } + break; + } + case 0x0e63b9efu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0M1B; + } + break; + } + case 0x0e644545u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0b3B; + } + break; + } + case 0x0e646500u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0W2B; + } + break; + } + case 0x0e6470f1u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0J2B; + } + break; + } + case 0x0e64854cu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0X2B; + } + break; + } + case 0x0e65ea73u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0H1B; + } + break; + } + case 0x0e660d38u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0a3B; + } + break; + } + case 0x0e661665u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0L1B; + } + break; + } + case 0x0e663be3u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0N1B; + } + break; + } + case 0x0e66cb64u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0U1B; + } + break; + } + case 0x0e673fffu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0P1B; + } + break; + } + case 0x0e67a979u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_texture_0R2B; + } + break; + } + case 0x106843efu: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_3D3D; + } + break; + } + case 0x10697de8u: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_2D2D; + } + break; + } + case 0x106ad530u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_1D1D; + } + break; + } + case 0x106d7bd6u: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_1D1D; + } + break; + } + case 0x106e2903u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_3D3D; + } + break; + } + case 0x106e7a45u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_2D2D; + } + break; + } + case 0x12601c9du: + { + if (name.beginsWith(BuiltInName::roundEven)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_roundEven_3B; + } + break; + } + case 0x12602fd7u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_AB; + } + break; + } + case 0x12614fd4u: + { + if (name.beginsWith(BuiltInName::roundEven)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_roundEven_2B; + } + break; + } + case 0x1264f5e4u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_EB; + } + break; + } + case 0x12650771u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_6B; + } + break; + } + case 0x12655b22u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_BB; + } + break; + } + case 0x12658f24u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_9B; + } + break; + } + case 0x1265cf4cu: + { + if (name.beginsWith(BuiltInName::roundEven)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_roundEven_1B; + } + break; + } + case 0x12661b07u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_FB; + } + break; + } + case 0x12665430u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_7B; + } + break; + } + case 0x1266c2deu: + { + if (name.beginsWith(BuiltInName::roundEven)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_roundEven_0B; + } + break; + } + case 0x1267db60u: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_5B; + } + break; + } + case 0x1267de6cu: + { + if (name.beginsWith(BuiltInName::transpose)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_transpose_DB; + } + break; + } + case 0x1273f9dbu: + { + if (name.beginsWith(BuiltInName::yuv_2_rgb)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_yuv_2_rgb_2B0G; + } + break; + } + case 0x127589a7u: + { + if (name.beginsWith(BuiltInName::rgb_2_yuv)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_rgb_2_yuv_2B0G; + } + break; + } + case 0x14880e11u: + { + if (name == BuiltInName::texelFetch_0V2C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0V2C0C; + } + break; + } + case 0x14882ba7u: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0X2B0B; + } + break; + } + case 0x14888557u: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0Q2B0B; + } + break; + } + case 0x1488b1e8u: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0Q2C0C; + } + break; + } + case 0x14894128u: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0P1C0C; + } + break; + } + case 0x148999efu: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0V2B0B; + } + break; + } + case 0x148a14a7u: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0M1C0C; + } + break; + } + case 0x148a2382u: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0S2C0C; + } + break; + } + case 0x148a66beu: + { + if (name == BuiltInName::textureLod_0S2B0B) + { + return &BuiltInFunction::kFunction_textureLod_0S2B0B; + } + break; + } + case 0x148b00dbu: + { + if (name == BuiltInName::textureLod_0J2B0B) + { + return &BuiltInFunction::kFunction_textureLod_0J2B0B; + } + break; + } + case 0x148b33b6u: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0H1B0B; + } + break; + } + case 0x148bab65u: + { + if (name == BuiltInName::texelFetch_0I2C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0I2C0C; + } + break; + } + case 0x148cccafu: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0R2B0B; + } + break; + } + case 0x148d0a7bu: + { + if (name == BuiltInName::texelFetch_0K2C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0K2C0C; + } + break; + } + case 0x148d335cu: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0I2B0B; + } + break; + } + case 0x148d3512u: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0W2B0B; + } + break; + } + case 0x148e100eu: + { + if (name == BuiltInName::texelFetch_0X2C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0X2C0C; + } + break; + } + case 0x148ed16fu: + { + if (name.beginsWith(BuiltInName::texelFetch)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_texelFetch_0U1C0C; + } + break; + } + case 0x148ed87fu: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0K2B0B; + } + break; + } + case 0x148eff58u: + { + if (name == BuiltInName::texelFetch_0L1C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0L1C0C; + } + break; + } + case 0x148f7fe8u: + { + if (name.beginsWith(BuiltInName::textureLod)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_textureLod_0U1B0B; + } + break; + } + case 0x148fd5b6u: + { + if (name == BuiltInName::texelFetch_0H1C0C) + { + return &BuiltInFunction::kFunction_texelFetch_0H1C0C; + } + break; + } + case 0x148fde6au: + { + if (name == BuiltInName::textureLod_0P1B0B) + { + return &BuiltInFunction::kFunction_textureLod_0P1B0B; + } + break; + } + case 0x148fe911u: + { + if (name == BuiltInName::textureLod_0Z2B0B) + { + return &BuiltInFunction::kFunction_textureLod_0Z2B0B; + } + break; + } + case 0x1673728cu: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_textureSize_0Y; + } + break; + } + case 0x1673936bu: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_textureSize_0T; + } + break; + } + case 0x1673f496u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_textureSize_0O; + } + break; + } + case 0x1674ed12u: + { + if (name.beginsWith(BuiltInName::determinant)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_determinant_FB; + } + break; + } + case 0x1676ad75u: + { + if (name.beginsWith(BuiltInName::determinant)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_determinant_5B; + } + break; + } + case 0x167719ccu: + { + if (name.beginsWith(BuiltInName::determinant)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_determinant_AB; + } + break; + } + case 0x168021fbu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0U3B; + } + break; + } + case 0x16803d05u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0I0C; + } + break; + } + case 0x168046b0u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0M0C; + } + break; + } + case 0x16807544u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0P3B; + } + break; + } + case 0x1680a979u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0U0C; + } + break; + } + case 0x16812c54u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_3D3D; + } + break; + } + case 0x168174f7u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_1D1D; + } + break; + } + case 0x168178c7u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0H2B; + } + break; + } + case 0x1681a77du: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0P2B; + } + break; + } + case 0x1681d6b4u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_2D2D; + } + break; + } + case 0x1681e38fu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0V3B; + } + break; + } + case 0x1681f153u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0J0C; + } + break; + } + case 0x168245a4u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0S0C; + } + break; + } + case 0x168255e2u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0V0C; + } + break; + } + case 0x16829c77u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0b0C; + } + break; + } + case 0x1682d0c8u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0M2B; + } + break; + } + case 0x16838d15u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0L2B; + } + break; + } + case 0x1683ecb1u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0M3B; + } + break; + } + case 0x16840064u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0H3B; + } + break; + } + case 0x16842f7du: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0Z3B; + } + break; + } + case 0x168434eeu: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0H0C; + } + break; + } + case 0x16845c90u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0L0C; + } + break; + } + case 0x16846c6cu: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0W0C; + } + break; + } + case 0x16849618u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0Z0C; + } + break; + } + case 0x1685b785u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0N3B; + } + break; + } + case 0x1685ca01u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0I3B; + } + break; + } + case 0x16860d28u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0Q3B; + } + break; + } + case 0x16861104u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0K0C; + } + break; + } + case 0x16863c73u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0R0C; + } + break; + } + case 0x16865716u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0L3B; + } + break; + } + case 0x16866f5du: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0P0C; + } + break; + } + case 0x16869d00u: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0Q0C; + } + break; + } + case 0x1686a82au: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0X0C; + } + break; + } + case 0x1686cb94u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0N2B; + } + break; + } + case 0x1686d6ddu: + { + if (name.beginsWith(BuiltInName::textureSize)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureSize_0a0C; + } + break; + } + case 0x168705d2u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureProj_0U2B; + } + break; + } + case 0x16a00e04u: + { + if (name == BuiltInName::textureGrad_0I2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0I2B2B2B; + } + break; + } + case 0x16a11436u: + { + if (name == BuiltInName::textureGrad_0W2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0W2B2B2B; + } + break; + } + case 0x16a149ecu: + { + if (name == BuiltInName::textureGrad_0a3B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0a3B2B2B; + } + break; + } + case 0x16a19158u: + { + if (name == BuiltInName::textureGrad_0Q2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0Q2B2B2B; + } + break; + } + case 0x16a19c8du: + { + if (name == BuiltInName::textureGrad_0H1B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0H1B1B1B; + } + break; + } + case 0x16a1ec87u: + { + if (name == BuiltInName::textureGrad_0J2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0J2B2B2B; + } + break; + } + case 0x16a22779u: + { + if (name == BuiltInName::textureGrad_0X2B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0X2B1B1B; + } + break; + } + case 0x16a34692u: + { + if (name == BuiltInName::textureGrad_0R2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0R2B2B2B; + } + break; + } + case 0x16a47be7u: + { + if (name == BuiltInName::textureGrad_0P1B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0P1B1B1B; + } + break; + } + case 0x16a53465u: + { + if (name == BuiltInName::textureGrad_0b3B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0b3B1B1B; + } + break; + } + case 0x16a57654u: + { + if (name == BuiltInName::textureGrad_0S2B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0S2B1B1B; + } + break; + } + case 0x16a6a742u: + { + if (name == BuiltInName::textureGrad_0Z2B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0Z2B1B1B; + } + break; + } + case 0x16a71104u: + { + if (name == BuiltInName::textureGrad_0K2B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0K2B1B1B; + } + break; + } + case 0x16a735dau: + { + if (name == BuiltInName::textureGrad_0U1B1B1B) + { + return &BuiltInFunction::kFunction_textureGrad_0U1B1B1B; + } + break; + } + case 0x16a7e88eu: + { + if (name == BuiltInName::textureGrad_0V2B2B2B) + { + return &BuiltInFunction::kFunction_textureGrad_0V2B2B2B; + } + break; + } + case 0x187df788u: + { + if (name.beginsWith(BuiltInName::packHalf2x16)) + { + ASSERT(name.length() == 15); + return &BuiltInFunction::kFunction_packHalf2x16_1B; + } + break; + } + case 0x18887331u: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_2B3B; + } + break; + } + case 0x188880cbu: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_1B1B; + } + break; + } + case 0x1888c44du: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_3B2B; + } + break; + } + case 0x188916c3u: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_1B2B; + } + break; + } + case 0x188a12cau: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_1B3B; + } + break; + } + case 0x188db87au: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_2B2B; + } + break; + } + case 0x188e0232u: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_3B3B; + } + break; + } + case 0x188e2270u: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_2B1B; + } + break; + } + case 0x188f8feeu: + { + if (name.beginsWith(BuiltInName::outerProduct)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_outerProduct_3B1B; + } + break; + } + case 0x1a84fa77u: + { + if (name.beginsWith(BuiltInName::packSnorm2x16)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_packSnorm2x16_1B; + } + break; + } + case 0x1a873678u: + { + if (name.beginsWith(BuiltInName::packUnorm2x16)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_packUnorm2x16_1B; + } + break; + } + case 0x1a92589du: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_2D2D; + } + break; + } + case 0x1a95efdcu: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_1D1D; + } + break; + } + case 0x1a96ec62u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_3D3D; + } + break; + } + case 0x1aa08a7au: + { + if (name == BuiltInName::textureOffset_0V2B2C) + { + return &BuiltInFunction::kFunction_textureOffset_0V2B2C; + } + break; + } + case 0x1aa0931au: + { + if (name == BuiltInName::textureOffset_0P1B1C) + { + return &BuiltInFunction::kFunction_textureOffset_0P1B1C; + } + break; + } + case 0x1aa11785u: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0H1B1C; + } + break; + } + case 0x1aa1c620u: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0U1B1C; + } + break; + } + case 0x1aa2cd54u: + { + if (name == BuiltInName::textureOffset_0S2B1C) + { + return &BuiltInFunction::kFunction_textureOffset_0S2B1C; + } + break; + } + case 0x1aa385c2u: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0Z2B1C; + } + break; + } + case 0x1aa39cdeu: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0X2B1C; + } + break; + } + case 0x1aa3c02eu: + { + if (name == BuiltInName::textureOffset_0Q2B2C) + { + return &BuiltInFunction::kFunction_textureOffset_0Q2B2C; + } + break; + } + case 0x1aa41f4au: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0K2B1C; + } + break; + } + case 0x1aa64995u: + { + if (name.beginsWith(BuiltInName::textureOffset)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_textureOffset_0I2B2C; + } + break; + } + case 0x1c887424u: + { + if (name.beginsWith(BuiltInName::intBitsToFloat)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_intBitsToFloat_2C; + } + break; + } + case 0x1c887f5eu: + { + if (name.beginsWith(BuiltInName::floatBitsToInt)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_floatBitsToInt_2B; + } + break; + } + case 0x1c88f18cu: + { + if (name.beginsWith(BuiltInName::intBitsToFloat)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_intBitsToFloat_1C; + } + break; + } + case 0x1c89b11cu: + { + if (name.beginsWith(BuiltInName::floatBitsToInt)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_floatBitsToInt_1B; + } + break; + } + case 0x1c89e261u: + { + if (name.beginsWith(BuiltInName::intBitsToFloat)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_intBitsToFloat_0C; + } + break; + } + case 0x1c8ae0a5u: + { + if (name.beginsWith(BuiltInName::floatBitsToInt)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_floatBitsToInt_0B; + } + break; + } + case 0x1c8b20dau: + { + if (name.beginsWith(BuiltInName::intBitsToFloat)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_intBitsToFloat_3C; + } + break; + } + case 0x1c8dd4e6u: + { + if (name.beginsWith(BuiltInName::unpackHalf2x16)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_unpackHalf2x16_0D; + } + break; + } + case 0x1c8f60afu: + { + if (name.beginsWith(BuiltInName::floatBitsToInt)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_floatBitsToInt_3B; + } + break; + } + case 0x1c9876e4u: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_9B9B; + } + break; + } + case 0x1c99affcu: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_7B7B; + } + break; + } + case 0x1c9c8697u: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_6B6B; + } + break; + } + case 0x1c9ccd5au: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_BBBB; + } + break; + } + case 0x1c9ea241u: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_DBDB; + } + break; + } + case 0x1c9fa571u: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_EBEB; + } + break; + } + case 0x1ca85d55u: + { + if (name == BuiltInName::textureProjLod_0Q3B0B) + { + return &BuiltInFunction::kFunction_textureProjLod_0Q3B0B; + } + break; + } + case 0x1ca8adb6u: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0P2B0B; + } + break; + } + case 0x1ca8c89au: + { + if (name == BuiltInName::textureProjLod_0H3B0B) + { + return &BuiltInFunction::kFunction_textureProjLod_0H3B0B; + } + break; + } + case 0x1caa108bu: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0H2B0B; + } + break; + } + case 0x1cab218fu: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0U3B0B; + } + break; + } + case 0x1cabc05fu: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0U2B0B; + } + break; + } + case 0x1cad9ae9u: + { + if (name == BuiltInName::textureProjLod_0V3B0B) + { + return &BuiltInFunction::kFunction_textureProjLod_0V3B0B; + } + break; + } + case 0x1cadd758u: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0P3B0B; + } + break; + } + case 0x1caef3bcu: + { + if (name == BuiltInName::textureProjLod_0Z3B0B) + { + return &BuiltInFunction::kFunction_textureProjLod_0Z3B0B; + } + break; + } + case 0x1caf96afu: + { + if (name.beginsWith(BuiltInName::textureProjLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureProjLod_0I3B0B; + } + break; + } + case 0x1e903284u: + { + if (name.beginsWith(BuiltInName::floatBitsToUint)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_floatBitsToUint_0B; + } + break; + } + case 0x1e92e353u: + { + if (name.beginsWith(BuiltInName::uintBitsToFloat)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_uintBitsToFloat_3D; + } + break; + } + case 0x1e93c13fu: + { + if (name.beginsWith(BuiltInName::uintBitsToFloat)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_uintBitsToFloat_0D; + } + break; + } + case 0x1e95201fu: + { + if (name.beginsWith(BuiltInName::floatBitsToUint)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_floatBitsToUint_1B; + } + break; + } + case 0x1e95511bu: + { + if (name.beginsWith(BuiltInName::unpackSnorm2x16)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_unpackSnorm2x16_0D; + } + break; + } + case 0x1e95582au: + { + if (name.beginsWith(BuiltInName::uintBitsToFloat)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_uintBitsToFloat_1D; + } + break; + } + case 0x1e95b0a7u: + { + if (name.beginsWith(BuiltInName::uintBitsToFloat)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_uintBitsToFloat_2D; + } + break; + } + case 0x1e966adcu: + { + if (name.beginsWith(BuiltInName::floatBitsToUint)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_floatBitsToUint_2B; + } + break; + } + case 0x1e9718ffu: + { + if (name.beginsWith(BuiltInName::unpackUnorm2x16)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_unpackUnorm2x16_0D; + } + break; + } + case 0x1e97a505u: + { + if (name.beginsWith(BuiltInName::floatBitsToUint)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_floatBitsToUint_3B; + } + break; + } + case 0x1ec19613u: + { + if (name == BuiltInName::textureProjGrad_0V3B2B2B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0V3B2B2B; + } + break; + } + case 0x1ec1ecc3u: + { + if (name == BuiltInName::textureProjGrad_0Q3B2B2B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0Q3B2B2B; + } + break; + } + case 0x1ec323fdu: + { + if (name == BuiltInName::textureProjGrad_0H3B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0H3B1B1B; + } + break; + } + case 0x1ec374bcu: + { + if (name == BuiltInName::textureProjGrad_0P2B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0P2B1B1B; + } + break; + } + case 0x1ec3ee61u: + { + if (name == BuiltInName::textureProjGrad_0I3B2B2B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0I3B2B2B; + } + break; + } + case 0x1ec4aa1fu: + { + if (name == BuiltInName::textureProjGrad_0U3B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0U3B1B1B; + } + break; + } + case 0x1ec50275u: + { + if (name == BuiltInName::textureProjGrad_0P3B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0P3B1B1B; + } + break; + } + case 0x1ec5ab9du: + { + if (name == BuiltInName::textureProjGrad_0H2B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0H2B1B1B; + } + break; + } + case 0x1ec64714u: + { + if (name == BuiltInName::textureProjGrad_0Z3B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0Z3B1B1B; + } + break; + } + case 0x1ec71f74u: + { + if (name == BuiltInName::textureProjGrad_0U2B1B1B) + { + return &BuiltInFunction::kFunction_textureProjGrad_0U2B1B1B; + } + break; + } + case 0x20a92dc6u: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_2D2D; + } + break; + } + case 0x20ae96edu: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_3D3D; + } + break; + } + case 0x20aedbacu: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_1D1D; + } + break; + } + case 0x20c863e3u: + { + if (name == BuiltInName::texelFetchOffset_0X2C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0X2C0C1C; + } + break; + } + case 0x20c8fa96u: + { + if (name == BuiltInName::texelFetchOffset_0I2C0C2C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0I2C0C2C; + } + break; + } + case 0x20c91b7du: + { + if (name == BuiltInName::texelFetchOffset_0S2C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0S2C0C1C; + } + break; + } + case 0x20c97fcau: + { + if (name == BuiltInName::textureLodOffset_0X2B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0X2B0B1C; + } + break; + } + case 0x20c9c544u: + { + if (name == BuiltInName::texelFetchOffset_0P1C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0P1C0C1C; + } + break; + } + case 0x20ca4914u: + { + if (name == BuiltInName::textureLodOffset_0Z2B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0Z2B0B1C; + } + break; + } + case 0x20ca735fu: + { + if (name == BuiltInName::textureLodOffset_0V2B0B2C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0V2B0B2C; + } + break; + } + case 0x20cac068u: + { + if (name == BuiltInName::texelFetchOffset_0K2C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0K2C0C1C; + } + break; + } + case 0x20caddbdu: + { + if (name == BuiltInName::textureLodOffset_0S2B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0S2B0B1C; + } + break; + } + case 0x20cb3102u: + { + if (name == BuiltInName::texelFetchOffset_0H1C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0H1C0C1C; + } + break; + } + case 0x20cbd512u: + { + if (name == BuiltInName::textureLodOffset_0P1B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0P1B0B1C; + } + break; + } + case 0x20cc7638u: + { + if (name == BuiltInName::texelFetchOffset_0U1C0C1C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0U1C0C1C; + } + break; + } + case 0x20cc8384u: + { + if (name == BuiltInName::textureLodOffset_0Q2B0B2C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0Q2B0B2C; + } + break; + } + case 0x20cc9477u: + { + if (name == BuiltInName::textureLodOffset_0H1B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0H1B0B1C; + } + break; + } + case 0x20cd0de3u: + { + if (name == BuiltInName::textureLodOffset_0K2B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0K2B0B1C; + } + break; + } + case 0x20cd911au: + { + if (name == BuiltInName::texelFetchOffset_0Q2C0C2C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0Q2C0C2C; + } + break; + } + case 0x20cde748u: + { + if (name == BuiltInName::textureLodOffset_0I2B0B2C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0I2B0B2C; + } + break; + } + case 0x20ce3ec5u: + { + if (name == BuiltInName::texelFetchOffset_0V2C0C2C) + { + return &BuiltInFunction::kFunction_texelFetchOffset_0V2C0C2C; + } + break; + } + case 0x20cfb2d5u: + { + if (name == BuiltInName::textureLodOffset_0U1B0B1C) + { + return &BuiltInFunction::kFunction_textureLodOffset_0U1B0B1C; + } + break; + } + case 0x22c0015bu: + { + if (name.beginsWith(BuiltInName::textureProjOffset)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureProjOffset_0U3B1C; + } + break; + } + case 0x22c02df1u: + { + if (name == BuiltInName::textureProjOffset_0U2B1C) + { + return &BuiltInFunction::kFunction_textureProjOffset_0U2B1C; + } + break; + } + case 0x22c0a359u: + { + if (name == BuiltInName::textureProjOffset_0H2B1C) + { + return &BuiltInFunction::kFunction_textureProjOffset_0H2B1C; + } + break; + } + case 0x22c2da46u: + { + if (name == BuiltInName::textureProjOffset_0H3B1C) + { + return &BuiltInFunction::kFunction_textureProjOffset_0H3B1C; + } + break; + } + case 0x22c2db53u: + { + if (name == BuiltInName::textureProjOffset_0Q3B2C) + { + return &BuiltInFunction::kFunction_textureProjOffset_0Q3B2C; + } + break; + } + case 0x22c458dcu: + { + if (name.beginsWith(BuiltInName::textureProjOffset)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureProjOffset_0I3B2C; + } + break; + } + case 0x22c4cdaau: + { + if (name.beginsWith(BuiltInName::textureProjOffset)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureProjOffset_0P2B1C; + } + break; + } + case 0x22c528fau: + { + if (name == BuiltInName::textureProjOffset_0V3B2C) + { + return &BuiltInFunction::kFunction_textureProjOffset_0V3B2C; + } + break; + } + case 0x22c5ec11u: + { + if (name.beginsWith(BuiltInName::textureProjOffset)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureProjOffset_0Z3B1C; + } + break; + } + case 0x22c6f82eu: + { + if (name.beginsWith(BuiltInName::textureProjOffset)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureProjOffset_0P3B1C; + } + break; + } + case 0x22e059fdu: + { + if (name == BuiltInName::textureGradOffset_0U1B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0U1B1B1B1C; + } + break; + } + case 0x22e165b8u: + { + if (name == BuiltInName::textureGradOffset_0K2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0K2B1B1B1C; + } + break; + } + case 0x22e23b04u: + { + if (name == BuiltInName::textureGradOffset_0X2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0X2B1B1B1C; + } + break; + } + case 0x22e2defdu: + { + if (name == BuiltInName::textureGradOffset_0b3B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0b3B1B1B1C; + } + break; + } + case 0x22e3e9eau: + { + if (name == BuiltInName::textureGradOffset_0I2B2B2B2C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0I2B2B2B2C; + } + break; + } + case 0x22e54911u: + { + if (name == BuiltInName::textureGradOffset_0S2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0S2B1B1B1C; + } + break; + } + case 0x22e57332u: + { + if (name == BuiltInName::textureGradOffset_0Q2B2B2B2C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0Q2B2B2B2C; + } + break; + } + case 0x22e62421u: + { + if (name == BuiltInName::textureGradOffset_0V2B2B2B2C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0V2B2B2B2C; + } + break; + } + case 0x22e68293u: + { + if (name == BuiltInName::textureGradOffset_0Z2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0Z2B1B1B1C; + } + break; + } + case 0x22e71012u: + { + if (name == BuiltInName::textureGradOffset_0H1B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0H1B1B1B1C; + } + break; + } + case 0x22e735f5u: + { + if (name == BuiltInName::textureGradOffset_0P1B1B1B1C) + { + return &BuiltInFunction::kFunction_textureGradOffset_0P1B1B1B1C; + } + break; + } + case 0x28e8c0c1u: + { + if (name == BuiltInName::textureProjLodOffset_0Z3B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0Z3B0B1C; + } + break; + } + case 0x28eab462u: + { + if (name == BuiltInName::textureProjLodOffset_0H2B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0H2B0B1C; + } + break; + } + case 0x28eaec64u: + { + if (name == BuiltInName::textureProjLodOffset_0Q3B0B2C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0Q3B0B2C; + } + break; + } + case 0x28eb831cu: + { + if (name == BuiltInName::textureProjLodOffset_0V3B0B2C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0V3B0B2C; + } + break; + } + case 0x28eb8605u: + { + if (name == BuiltInName::textureProjLodOffset_0I3B0B2C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0I3B0B2C; + } + break; + } + case 0x28ebf99eu: + { + if (name == BuiltInName::textureProjLodOffset_0H3B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0H3B0B1C; + } + break; + } + case 0x28ed5e33u: + { + if (name == BuiltInName::textureProjLodOffset_0P3B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0P3B0B1C; + } + break; + } + case 0x28eeff16u: + { + if (name == BuiltInName::textureProjLodOffset_0P2B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0P2B0B1C; + } + break; + } + case 0x28ef67d8u: + { + if (name == BuiltInName::textureProjLodOffset_0U2B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0U2B0B1C; + } + break; + } + case 0x28efc97eu: + { + if (name == BuiltInName::textureProjLodOffset_0U3B0B1C) + { + return &BuiltInFunction::kFunction_textureProjLodOffset_0U3B0B1C; + } + break; + } + case 0x2b00a086u: + { + if (name == BuiltInName::textureProjGradOffset_0U3B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0U3B1B1B1C; + } + break; + } + case 0x2b00d555u: + { + if (name == BuiltInName::textureProjGradOffset_0V3B2B2B2C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0V3B2B2B2C; + } + break; + } + case 0x2b022418u: + { + if (name == BuiltInName::textureProjGradOffset_0H3B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0H3B1B1B1C; + } + break; + } + case 0x2b02308fu: + { + if (name == BuiltInName::textureProjGradOffset_0P2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0P2B1B1B1C; + } + break; + } + case 0x2b02af8fu: + { + if (name == BuiltInName::textureProjGradOffset_0I3B2B2B2C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0I3B2B2B2C; + } + break; + } + case 0x2b045d17u: + { + if (name == BuiltInName::textureProjGradOffset_0Q3B2B2B2C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0Q3B2B2B2C; + } + break; + } + case 0x2b0472aau: + { + if (name == BuiltInName::textureProjGradOffset_0Z3B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0Z3B1B1B1C; + } + break; + } + case 0x2b04ab94u: + { + if (name == BuiltInName::textureProjGradOffset_0U2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0U2B1B1B1C; + } + break; + } + case 0x2b06523eu: + { + if (name == BuiltInName::textureProjGradOffset_0P3B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0P3B1B1B1C; + } + break; + } + case 0x2b077535u: + { + if (name == BuiltInName::textureProjGradOffset_0H2B1B1B1C) + { + return &BuiltInFunction::kFunction_textureProjGradOffset_0H2B1B1B1C; + } + break; + } + case 0x7ec10648u: + { + if (name == BuiltInName::gl_MaxProgramTexelOffset) + { + return mVar_gl_MaxProgramTexelOffset; + } + break; + } + case 0x7ec3c4d1u: + { + if (name == BuiltInName::gl_MinProgramTexelOffset) + { + return mVar_gl_MinProgramTexelOffset; + } + break; + } + case 0x7ec8d677u: + { + if (name == BuiltInName::gl_MaxVertexOutputVectors) + { + return mVar_gl_MaxVertexOutputVectors; + } + break; + } + case 0x7ed1aaebu: + { + if (name == BuiltInName::gl_MaxFragmentInputVectors) + { + return mVar_gl_MaxFragmentInputVectors; + } + break; + } + } + if (mShaderType == GL_FRAGMENT_SHADER) + { + switch (nameHash) + { + case 0x08394c88u: + { + if (name.beginsWith(BuiltInName::dFdy)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdy_0B; + } + break; + } + case 0x08398819u: + { + if (name.beginsWith(BuiltInName::dFdx)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdx_0B; + } + break; + } + case 0x083a7081u: + { + if (name.beginsWith(BuiltInName::dFdy)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdy_1B; + } + break; + } + case 0x083abe52u: + { + if (name.beginsWith(BuiltInName::dFdx)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdx_3B; + } + break; + } + case 0x083b9d7au: + { + if (name.beginsWith(BuiltInName::dFdy)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdy_2B; + } + break; + } + case 0x083c0d13u: + { + if (name.beginsWith(BuiltInName::dFdx)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdx_2B; + } + break; + } + case 0x083c6796u: + { + if (name.beginsWith(BuiltInName::dFdx)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdx_1B; + } + break; + } + case 0x083ced8bu: + { + if (name.beginsWith(BuiltInName::dFdy)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdy_3B; + } + break; + } + case 0x0c483e39u: + { + if (name.beginsWith(BuiltInName::fwidth)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidth_1B; + } + break; + } + case 0x0c4d354eu: + { + if (name.beginsWith(BuiltInName::fwidth)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidth_0B; + } + break; + } + case 0x0c4e7b0cu: + { + if (name.beginsWith(BuiltInName::fwidth)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidth_3B; + } + break; + } + case 0x0c4fa8b5u: + { + if (name.beginsWith(BuiltInName::fwidth)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidth_2B; + } + break; + } + case 0x0e70395au: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0U1B0B; + } + break; + } + case 0x0e70eff9u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0X2B0B; + } + break; + } + case 0x0e71856cu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0M1B0B; + } + break; + } + case 0x0e71dca8u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0P1B0B; + } + break; + } + case 0x0e720b77u: + { + if (name == BuiltInName::texture_0V2B0B) + { + return &BuiltInFunction::kFunction_texture_0V2B0B; + } + break; + } + case 0x0e723219u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0L1B0B; + } + break; + } + case 0x0e734ff8u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0Z2B0B; + } + break; + } + case 0x0e737f67u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0Q2B0B; + } + break; + } + case 0x0e73f4c3u: + { + if (name == BuiltInName::texture_0W2B0B) + { + return &BuiltInFunction::kFunction_texture_0W2B0B; + } + break; + } + case 0x0e742a66u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0K2B0B; + } + break; + } + case 0x0e75399eu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0S2B0B; + } + break; + } + case 0x0e75d15fu: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0J2B0B; + } + break; + } + case 0x0e76e7c1u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0H1B0B; + } + break; + } + case 0x0e7720c0u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0R2B0B; + } + break; + } + case 0x0e77a0f1u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0a3B0B; + } + break; + } + case 0x0e77d1c8u: + { + if (name.beginsWith(BuiltInName::texture)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture_0I2B0B; + } + break; + } + case 0x16900558u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0L3B0B; + } + break; + } + case 0x1690ae9fu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0M3B0B; + } + break; + } + case 0x16910ba7u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0Z3B0B; + } + break; + } + case 0x16911478u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0P3B0B; + } + break; + } + case 0x1691c2edu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0M2B0B; + } + break; + } + case 0x1691d656u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0U2B0B; + } + break; + } + case 0x16925badu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0Q3B0B; + } + break; + } + case 0x169292f8u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0U3B0B; + } + break; + } + case 0x169350d8u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0I3B0B; + } + break; + } + case 0x1695499au: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0V3B0B; + } + break; + } + case 0x16955fbdu: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0P2B0B; + } + break; + } + case 0x16965fd9u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0H3B0B; + } + break; + } + case 0x1696f029u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0H2B0B; + } + break; + } + case 0x1697e9b9u: + { + if (name.beginsWith(BuiltInName::textureProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureProj_0L2B0B; + } + break; + } + case 0x1ab09555u: + { + if (name == BuiltInName::textureOffset_0Q2B2C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0Q2B2C0B; + } + break; + } + case 0x1ab0d39du: + { + if (name == BuiltInName::textureOffset_0V2B2C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0V2B2C0B; + } + break; + } + case 0x1ab1990bu: + { + if (name == BuiltInName::textureOffset_0X2B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0X2B1C0B; + } + break; + } + case 0x1ab29724u: + { + if (name == BuiltInName::textureOffset_0Z2B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0Z2B1C0B; + } + break; + } + case 0x1ab2a609u: + { + if (name == BuiltInName::textureOffset_0U1B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0U1B1C0B; + } + break; + } + case 0x1ab57bbcu: + { + if (name == BuiltInName::textureOffset_0H1B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0H1B1C0B; + } + break; + } + case 0x1ab59b6cu: + { + if (name == BuiltInName::textureOffset_0I2B2C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0I2B2C0B; + } + break; + } + case 0x1ab63ddau: + { + if (name == BuiltInName::textureOffset_0K2B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0K2B1C0B; + } + break; + } + case 0x1ab6ec2cu: + { + if (name == BuiltInName::textureOffset_0P1B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0P1B1C0B; + } + break; + } + case 0x1ab6f64bu: + { + if (name == BuiltInName::textureOffset_0S2B1C0B) + { + return &BuiltInFunction::kFunction_textureOffset_0S2B1C0B; + } + break; + } + case 0x22d09aefu: + { + if (name == BuiltInName::textureProjOffset_0V3B2C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0V3B2C0B; + } + break; + } + case 0x22d2de73u: + { + if (name == BuiltInName::textureProjOffset_0U3B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0U3B1C0B; + } + break; + } + case 0x22d3c514u: + { + if (name == BuiltInName::textureProjOffset_0P3B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0P3B1C0B; + } + break; + } + case 0x22d3ece3u: + { + if (name == BuiltInName::textureProjOffset_0Q3B2C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0Q3B2C0B; + } + break; + } + case 0x22d59e0cu: + { + if (name == BuiltInName::textureProjOffset_0Z3B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0Z3B1C0B; + } + break; + } + case 0x22d62e81u: + { + if (name == BuiltInName::textureProjOffset_0H3B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0H3B1C0B; + } + break; + } + case 0x22d65c37u: + { + if (name == BuiltInName::textureProjOffset_0U2B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0U2B1C0B; + } + break; + } + case 0x22d6b2e8u: + { + if (name == BuiltInName::textureProjOffset_0I3B2C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0I3B2C0B; + } + break; + } + case 0x22d6ee53u: + { + if (name == BuiltInName::textureProjOffset_0H2B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0H2B1C0B; + } + break; + } + case 0x22d76183u: + { + if (name == BuiltInName::textureProjOffset_0P2B1C0B) + { + return &BuiltInFunction::kFunction_textureProjOffset_0P2B1C0B; + } + break; + } + case 0x7e645c89u: + { + if (name == BuiltInName::gl_FragDepth) + { + return &BuiltInVariable::kVar_gl_FragDepth; + } + break; + } + } + } + if (mShaderType == GL_VERTEX_SHADER) + { + switch (nameHash) + { + case 0x7e5f8987u: + { + if (name == BuiltInName::gl_VertexID) + { + return &BuiltInVariable::kVar_gl_VertexID; + } + break; + } + case 0x7e6be47fu: + { + if (name == BuiltInName::gl_InstanceID) + { + return &BuiltInVariable::kVar_gl_InstanceID; + } + break; + } + } + } + if (mResources.OVR_multiview && mShaderType != GL_COMPUTE_SHADER) + { + switch (nameHash) + { + case 0x7e6f6de9u: + { + if (name == BuiltInName::gl_ViewID_OVR) + { + return &BuiltInVariable::kVar_gl_ViewID_OVR; + } + break; + } + } + } + } + if (shaderVersion == 100) + { + switch (nameHash) + { + case 0x1271689cu: + { + if (name.beginsWith(BuiltInName::texture2D)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture2D_0H1B; + } + break; + } + case 0x127728cau: + { + if (name.beginsWith(BuiltInName::texture2D)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_texture2D_0L1B; + } + break; + } + case 0x1680927du: + { + if (name.beginsWith(BuiltInName::textureCube)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_textureCube_0J2B; + } + break; + } + case 0x1a902408u: + { + if (name.beginsWith(BuiltInName::texture2DRect)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_texture2DRect_0N1B; + } + break; + } + case 0x1a92969du: + { + if (name.beginsWith(BuiltInName::texture2DProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_texture2DProj_0L2B; + } + break; + } + case 0x1a9584eau: + { + if (name.beginsWith(BuiltInName::texture2DProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_texture2DProj_0L3B; + } + break; + } + case 0x1a95bcc7u: + { + if (name.beginsWith(BuiltInName::texture2DProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_texture2DProj_0H3B; + } + break; + } + case 0x1a96b8d6u: + { + if (name.beginsWith(BuiltInName::texture2DProj)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_texture2DProj_0H2B; + } + break; + } + case 0x20cb8d71u: + { + if (name == BuiltInName::texture2DGradEXT_0H1B1B1B) + { + return &BuiltInFunction::kFunction_texture2DGradEXT_0H1B1B1B; + } + break; + } + case 0x22b53a05u: + { + if (name.beginsWith(BuiltInName::texture2DRectProj)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_texture2DRectProj_0N3B; + } + break; + } + case 0x22b65e05u: + { + if (name.beginsWith(BuiltInName::texture2DRectProj)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_texture2DRectProj_0N2B; + } + break; + } + case 0x24dbd51eu: + { + if (name == BuiltInName::textureCubeGradEXT_0J2B2B2B) + { + return &BuiltInFunction::kFunction_textureCubeGradEXT_0J2B2B2B; + } + break; + } + case 0x28e995cbu: + { + if (name == BuiltInName::texture2DProjGradEXT_0H3B1B1B) + { + return &BuiltInFunction::kFunction_texture2DProjGradEXT_0H3B1B1B; + } + break; + } + case 0x28ed5178u: + { + if (name == BuiltInName::texture2DProjGradEXT_0H2B1B1B) + { + return &BuiltInFunction::kFunction_texture2DProjGradEXT_0H2B1B1B; + } + break; + } + case 0x7e5a0c08u: + { + if (name == BuiltInName::gl_FragData) + { + // Only initialized if shaderType == GL_FRAGMENT_SHADER + return mVar_gl_FragData; + } + break; + } + case 0x7e7c38efu: + { + if (name == BuiltInName::gl_FragDepthEXT) + { + // Only initialized if (shaderType == GL_FRAGMENT_SHADER) && + // (mResources.EXT_frag_depth) + return mVar_gl_FragDepthEXT; + } + break; + } + case 0x7ea6cdf6u: + { + if (name == BuiltInName::gl_MaxVaryingVectors) + { + return mVar_gl_MaxVaryingVectors; + } + break; + } + case 0x7ebce486u: + { + if (name == BuiltInName::gl_SecondaryFragDataEXT) + { + // Only initialized if (shaderType == GL_FRAGMENT_SHADER) && + // (mResources.EXT_blend_func_extended) + return mVar_gl_SecondaryFragDataEXT; + } + break; + } + } + if (mShaderType == GL_FRAGMENT_SHADER) + { + switch (nameHash) + { + case 0x08394c88u: + { + if (name.beginsWith(BuiltInName::dFdyExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdyExt_0B; + } + break; + } + case 0x08398819u: + { + if (name.beginsWith(BuiltInName::dFdxExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdxExt_0B; + } + break; + } + case 0x083a7081u: + { + if (name.beginsWith(BuiltInName::dFdyExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdyExt_1B; + } + break; + } + case 0x083abe52u: + { + if (name.beginsWith(BuiltInName::dFdxExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdxExt_3B; + } + break; + } + case 0x083b9d7au: + { + if (name.beginsWith(BuiltInName::dFdyExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdyExt_2B; + } + break; + } + case 0x083c0d13u: + { + if (name.beginsWith(BuiltInName::dFdxExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdxExt_2B; + } + break; + } + case 0x083c6796u: + { + if (name.beginsWith(BuiltInName::dFdxExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdxExt_1B; + } + break; + } + case 0x083ced8bu: + { + if (name.beginsWith(BuiltInName::dFdyExt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_dFdyExt_3B; + } + break; + } + case 0x0c483e39u: + { + if (name.beginsWith(BuiltInName::fwidthExt)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidthExt_1B; + } + break; + } + case 0x0c4d354eu: + { + if (name.beginsWith(BuiltInName::fwidthExt)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidthExt_0B; + } + break; + } + case 0x0c4e7b0cu: + { + if (name.beginsWith(BuiltInName::fwidthExt)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidthExt_3B; + } + break; + } + case 0x0c4fa8b5u: + { + if (name.beginsWith(BuiltInName::fwidthExt)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_fwidthExt_2B; + } + break; + } + case 0x12846ba6u: + { + if (name.beginsWith(BuiltInName::texture2D)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_texture2D_0H1B0B; + } + break; + } + case 0x1696a314u: + { + if (name.beginsWith(BuiltInName::textureCube)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_textureCube_0J2B0B; + } + break; + } + case 0x1aa197a7u: + { + if (name.beginsWith(BuiltInName::texture2DProj)) + { + ASSERT(name.length() == 20); + return &BuiltInFunction::kFunction_texture2DProj_0H3B0B; + } + break; + } + case 0x1aa44389u: + { + if (name == BuiltInName::texture2DProj_0H2B0B) + { + return &BuiltInFunction::kFunction_texture2DProj_0H2B0B; + } + break; + } + case 0x1eb43b6cu: + { + if (name.beginsWith(BuiltInName::texture2DLodEXT)) + { + ASSERT(name.length() == 22); + return &BuiltInFunction::kFunction_texture2DLodEXT_0H1B0B; + } + break; + } + case 0x22c206a5u: + { + if (name.beginsWith(BuiltInName::textureCubeLodEXT)) + { + ASSERT(name.length() == 24); + return &BuiltInFunction::kFunction_textureCubeLodEXT_0J2B0B; + } + break; + } + case 0x26d1d3beu: + { + if (name.beginsWith(BuiltInName::texture2DProjLodEXT)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_texture2DProjLodEXT_0H3B0B; + } + break; + } + case 0x26d60d82u: + { + if (name.beginsWith(BuiltInName::texture2DProjLodEXT)) + { + ASSERT(name.length() == 26); + return &BuiltInFunction::kFunction_texture2DProjLodEXT_0H2B0B; + } + break; + } + case 0x7e60c438u: + { + if (name == BuiltInName::gl_FragColor) + { + return &BuiltInVariable::kVar_gl_FragColor; + } + break; + } + } + } + if (mShaderType == GL_VERTEX_SHADER) + { + switch (nameHash) + { + case 0x18986fc2u: + { + if (name.beginsWith(BuiltInName::texture2DLod)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_texture2DLod_0H1B0B; + } + break; + } + case 0x1cac1f4du: + { + if (name.beginsWith(BuiltInName::textureCubeLod)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_textureCubeLod_0J2B0B; + } + break; + } + case 0x20b8a0c3u: + { + if (name.beginsWith(BuiltInName::texture2DProjLod)) + { + ASSERT(name.length() == 23); + return &BuiltInFunction::kFunction_texture2DProjLod_0H3B0B; + } + break; + } + case 0x20bc6337u: + { + if (name == BuiltInName::texture2DProjLod_0H2B0B) + { + return &BuiltInFunction::kFunction_texture2DProjLod_0H2B0B; + } + break; + } + } + } + if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_blend_func_extended)) + { + switch (nameHash) + { + case 0x7ec56cbeu: + { + if (name == BuiltInName::gl_SecondaryFragColorEXT) + { + return &BuiltInVariable::kVar_gl_SecondaryFragColorEXT; + } + break; + } + } + } + if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.EXT_shader_framebuffer_fetch)) + { + switch (nameHash) + { + case 0x7e7970c2u: + { + if (name == BuiltInName::gl_LastFragData) + { + return mVar_gl_LastFragData; + } + break; + } + } + } + if ((mShaderType == GL_FRAGMENT_SHADER) && (mResources.NV_shader_framebuffer_fetch)) + { + switch (nameHash) + { + case 0x7e7970c2u: + { + if (name == BuiltInName::gl_LastFragData) + { + return mVar_gl_LastFragDataNV; + } + break; + } + case 0x7e802016u: + { + if (name == BuiltInName::gl_LastFragColor) + { + return &BuiltInVariable::kVar_gl_LastFragColor; + } + break; + } + } + } + if ((mShaderType == GL_FRAGMENT_SHADER) && + (!mResources.EXT_shader_framebuffer_fetch && !mResources.NV_shader_framebuffer_fetch && + mResources.ARM_shader_framebuffer_fetch)) + { + switch (nameHash) + { + case 0x7e9f0a88u: + { + if (name == BuiltInName::gl_LastFragColorARM) + { + return &BuiltInVariable::kVar_gl_LastFragColorARM; + } + break; + } + } + } + if (mResources.OVR_multiview && mShaderType != GL_COMPUTE_SHADER) + { + switch (nameHash) + { + case 0x7e6f6de9u: + { + if (name == BuiltInName::gl_ViewID_OVR) + { + return &BuiltInVariable::kVar_gl_ViewID_OVRESSL1; + } + break; + } + } + } + } + switch (nameHash) + { + case 0x063055e6u: + { + if (name.beginsWith(BuiltInName::log)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_log_0B; + } + break; + } + case 0x06307fbcu: + { + if (name.beginsWith(BuiltInName::all)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_all_1E; + } + break; + } + case 0x0630826fu: + { + if (name.beginsWith(BuiltInName::notFunc)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_notFunc_3E; + } + break; + } + case 0x0630942fu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_0B; + } + break; + } + case 0x06309ccau: + { + if (name.beginsWith(BuiltInName::tan)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_tan_1B; + } + break; + } + case 0x0630bc6au: + { + if (name.beginsWith(BuiltInName::cos)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_cos_2B; + } + break; + } + case 0x0630dce3u: + { + if (name.beginsWith(BuiltInName::log)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_log_3B; + } + break; + } + case 0x063194bfu: + { + if (name.beginsWith(BuiltInName::any)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_any_1E; + } + break; + } + case 0x0631a1ccu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_3B; + } + break; + } + case 0x0631d12au: + { + if (name.beginsWith(BuiltInName::log)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_log_2B; + } + break; + } + case 0x06320b8bu: + { + if (name.beginsWith(BuiltInName::cos)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_cos_3B; + } + break; + } + case 0x0632fcb3u: + { + if (name.beginsWith(BuiltInName::any)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_any_3E; + } + break; + } + case 0x06330b41u: + { + if (name.beginsWith(BuiltInName::log)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_log_1B; + } + break; + } + case 0x063314b1u: + { + if (name.beginsWith(BuiltInName::sin)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_sin_1B; + } + break; + } + case 0x063415e2u: + { + if (name.beginsWith(BuiltInName::any)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_any_2E; + } + break; + } + case 0x06344570u: + { + if (name.beginsWith(BuiltInName::sin)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_sin_0B; + } + break; + } + case 0x0634cf9au: + { + if (name.beginsWith(BuiltInName::sin)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_sin_3B; + } + break; + } + case 0x06352335u: + { + if (name.beginsWith(BuiltInName::exp)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_exp_3B; + } + break; + } + case 0x063595b9u: + { + if (name.beginsWith(BuiltInName::exp)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_exp_0B; + } + break; + } + case 0x0635a80fu: + { + if (name.beginsWith(BuiltInName::tan)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_tan_2B; + } + break; + } + case 0x0635d3b3u: + { + if (name.beginsWith(BuiltInName::sin)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_sin_2B; + } + break; + } + case 0x0635eb79u: + { + if (name.beginsWith(BuiltInName::all)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_all_2E; + } + break; + } + case 0x06366a98u: + { + if (name.beginsWith(BuiltInName::cos)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_cos_0B; + } + break; + } + case 0x0636b1f1u: + { + if (name.beginsWith(BuiltInName::exp)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_exp_1B; + } + break; + } + case 0x0636dda0u: + { + if (name.beginsWith(BuiltInName::all)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_all_3E; + } + break; + } + case 0x0636e0efu: + { + if (name.beginsWith(BuiltInName::notFunc)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_notFunc_1E; + } + break; + } + case 0x063719d6u: + { + if (name.beginsWith(BuiltInName::tan)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_tan_3B; + } + break; + } + case 0x06371aefu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_2B; + } + break; + } + case 0x06376a86u: + { + if (name.beginsWith(BuiltInName::notFunc)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_notFunc_2E; + } + break; + } + case 0x063770d0u: + { + if (name.beginsWith(BuiltInName::tan)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_tan_0B; + } + break; + } + case 0x063770dfu: + { + if (name.beginsWith(BuiltInName::abs)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_abs_1B; + } + break; + } + case 0x063786f1u: + { + if (name.beginsWith(BuiltInName::cos)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_cos_1B; + } + break; + } + case 0x0637ca4au: + { + if (name.beginsWith(BuiltInName::exp)) + { + ASSERT(name.length() == 6); + return &BuiltInFunction::kFunction_exp_2B; + } + break; + } + case 0x06400261u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2B2B; + } + break; + } + case 0x06403847u: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_2B0B; + } + break; + } + case 0x064082ceu: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_1B0B; + } + break; + } + case 0x0640a98au: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2B2B; + } + break; + } + case 0x064107b7u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1B0B; + } + break; + } + case 0x06415ae6u: + { + if (name.beginsWith(BuiltInName::dot)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_dot_3B3B; + } + break; + } + case 0x06418e42u: + { + if (name.beginsWith(BuiltInName::pow)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_pow_3B3B; + } + break; + } + case 0x0641ceeeu: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_0B0B; + } + break; + } + case 0x0641f1d7u: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_1B1B; + } + break; + } + case 0x06421555u: + { + if (name.beginsWith(BuiltInName::dot)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_dot_1B1B; + } + break; + } + case 0x064225ceu: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3B3B; + } + break; + } + case 0x064274eeu: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_1B1B; + } + break; + } + case 0x0642b54du: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_2B2B; + } + break; + } + case 0x064318fcu: + { + if (name.beginsWith(BuiltInName::pow)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_pow_2B2B; + } + break; + } + case 0x0643486cu: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_3B0B; + } + break; + } + case 0x06439435u: + { + if (name.beginsWith(BuiltInName::pow)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_pow_1B1B; + } + break; + } + case 0x06450933u: + { + if (name.beginsWith(BuiltInName::dot)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_dot_0B0B; + } + break; + } + case 0x0645114fu: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1B0B; + } + break; + } + case 0x06457883u: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_3B3B; + } + break; + } + case 0x0645f03eu: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_3B0B; + } + break; + } + case 0x0645fd82u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3B3B; + } + break; + } + case 0x0646155eu: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_1B1B; + } + break; + } + case 0x06462cf0u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_2B0B; + } + break; + } + case 0x06463219u: + { + if (name.beginsWith(BuiltInName::dot)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_dot_2B2B; + } + break; + } + case 0x06467507u: + { + if (name.beginsWith(BuiltInName::min)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_min_3B0B; + } + break; + } + case 0x06468fb1u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_2B0B; + } + break; + } + case 0x0646b392u: + { + if (name.beginsWith(BuiltInName::pow)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_pow_0B0B; + } + break; + } + case 0x06472996u: + { + if (name.beginsWith(BuiltInName::max)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_max_0B0B; + } + break; + } + case 0x064778feu: + { + if (name.beginsWith(BuiltInName::mod)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_mod_0B0B; + } + break; + } + case 0x0650f1c9u: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_1B1B0B; + } + break; + } + case 0x0653049du: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_2B2B0B; + } + break; + } + case 0x06549219u: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_2B2B2B; + } + break; + } + case 0x0655be57u: + { + if (name.beginsWith(BuiltInName::mix)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_mix_0B0B0B; + } + break; + } + case 0x06561bdcu: + { + if (name == BuiltInName::mix_3B3B0B) + { + return &BuiltInFunction::kFunction_mix_3B3B0B; + } + break; + } + case 0x06568deeu: + { + if (name == BuiltInName::mix_3B3B3B) + { + return &BuiltInFunction::kFunction_mix_3B3B3B; + } + break; + } + case 0x0657a0a8u: + { + if (name == BuiltInName::mix_1B1B1B) + { + return &BuiltInFunction::kFunction_mix_1B1B1B; + } + break; + } + case 0x08383aacu: + { + if (name.beginsWith(BuiltInName::acos)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_acos_3B; + } + break; + } + case 0x0838a17eu: + { + if (name.beginsWith(BuiltInName::ceil)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_ceil_2B; + } + break; + } + case 0x0838ac89u: + { + if (name.beginsWith(BuiltInName::exp2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_exp2_3B; + } + break; + } + case 0x0838dc31u: + { + if (name.beginsWith(BuiltInName::sqrt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sqrt_0B; + } + break; + } + case 0x08396a55u: + { + if (name.beginsWith(BuiltInName::acos)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_acos_2B; + } + break; + } + case 0x0839daf2u: + { + if (name.beginsWith(BuiltInName::exp2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_exp2_0B; + } + break; + } + case 0x0839e751u: + { + if (name.beginsWith(BuiltInName::acos)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_acos_1B; + } + break; + } + case 0x0839f1a7u: + { + if (name.beginsWith(BuiltInName::ceil)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_ceil_3B; + } + break; + } + case 0x083a07bau: + { + if (name.beginsWith(BuiltInName::sqrt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sqrt_3B; + } + break; + } + case 0x083a7922u: + { + if (name.beginsWith(BuiltInName::ceil)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_ceil_0B; + } + break; + } + case 0x083aea5fu: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_atan_2B; + } + break; + } + case 0x083af266u: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_1B; + } + break; + } + case 0x083afbc8u: + { + if (name.beginsWith(BuiltInName::acos)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_acos_0B; + } + break; + } + case 0x083b2b93u: + { + if (name.beginsWith(BuiltInName::exp2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_exp2_1B; + } + break; + } + case 0x083b577bu: + { + if (name.beginsWith(BuiltInName::sqrt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sqrt_2B; + } + break; + } + case 0x083b7e52u: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_atan_1B; + } + break; + } + case 0x083bcf76u: + { + if (name.beginsWith(BuiltInName::sqrt)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sqrt_1B; + } + break; + } + case 0x083c1fc5u: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_2B; + } + break; + } + case 0x083c624bu: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_atan_0B; + } + break; + } + case 0x083ca453u: + { + if (name.beginsWith(BuiltInName::asin)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_asin_0B; + } + break; + } + case 0x083cc6e1u: + { + if (name.beginsWith(BuiltInName::log2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_log2_2B; + } + break; + } + case 0x083d6eacu: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_3B; + } + break; + } + case 0x083dac10u: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_atan_3B; + } + break; + } + case 0x083dd4deu: + { + if (name.beginsWith(BuiltInName::sign)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_sign_0B; + } + break; + } + case 0x083df752u: + { + if (name.beginsWith(BuiltInName::asin)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_asin_1B; + } + break; + } + case 0x083e1b7au: + { + if (name.beginsWith(BuiltInName::log2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_log2_1B; + } + break; + } + case 0x083e6948u: + { + if (name.beginsWith(BuiltInName::asin)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_asin_2B; + } + break; + } + case 0x083f4babu: + { + if (name.beginsWith(BuiltInName::log2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_log2_0B; + } + break; + } + case 0x083f6552u: + { + if (name.beginsWith(BuiltInName::asin)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_asin_3B; + } + break; + } + case 0x083f6afdu: + { + if (name.beginsWith(BuiltInName::ceil)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_ceil_1B; + } + break; + } + case 0x083f8b90u: + { + if (name.beginsWith(BuiltInName::exp2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_exp2_2B; + } + break; + } + case 0x083fd32eu: + { + if (name.beginsWith(BuiltInName::log2)) + { + ASSERT(name.length() == 7); + return &BuiltInFunction::kFunction_log2_3B; + } + break; + } + case 0x08482806u: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_atan_3B3B; + } + break; + } + case 0x08491304u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_0B1B; + } + break; + } + case 0x0849bcfdu: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_2B2B; + } + break; + } + case 0x084aa6bfu: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_atan_1B1B; + } + break; + } + case 0x084c10fau: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_atan_0B0B; + } + break; + } + case 0x084c9765u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_1B1B; + } + break; + } + case 0x084e7af1u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_3B3B; + } + break; + } + case 0x084e7be4u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_0B0B; + } + break; + } + case 0x084ec1e6u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_0B3B; + } + break; + } + case 0x084ee899u: + { + if (name.beginsWith(BuiltInName::atan)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_atan_2B2B; + } + break; + } + case 0x084feda7u: + { + if (name.beginsWith(BuiltInName::step)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_step_0B2B; + } + break; + } + case 0x0a402a9cu: + { + if (name.beginsWith(BuiltInName::fract)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_fract_0B; + } + break; + } + case 0x0a41745fu: + { + if (name.beginsWith(BuiltInName::fract)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_fract_3B; + } + break; + } + case 0x0a42a596u: + { + if (name.beginsWith(BuiltInName::fract)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_fract_2B; + } + break; + } + case 0x0a43465eu: + { + if (name.beginsWith(BuiltInName::floor)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_floor_0B; + } + break; + } + case 0x0a43be63u: + { + if (name.beginsWith(BuiltInName::floor)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_floor_3B; + } + break; + } + case 0x0a44da6bu: + { + if (name.beginsWith(BuiltInName::floor)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_floor_2B; + } + break; + } + case 0x0a45ecc0u: + { + if (name.beginsWith(BuiltInName::floor)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_floor_1B; + } + break; + } + case 0x0a4726f2u: + { + if (name.beginsWith(BuiltInName::fract)) + { + ASSERT(name.length() == 8); + return &BuiltInFunction::kFunction_fract_1B; + } + break; + } + case 0x0a513a26u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_3E3E; + } + break; + } + case 0x0a51bddcu: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_3B3B; + } + break; + } + case 0x0a527d10u: + { + if (name.beginsWith(BuiltInName::cross)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_cross_2B2B; + } + break; + } + case 0x0a542036u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_2C2C; + } + break; + } + case 0x0a54c30cu: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_2B2B; + } + break; + } + case 0x0a554046u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_1C1C; + } + break; + } + case 0x0a56874bu: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_3C3C; + } + break; + } + case 0x0a56fc88u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_2E2E; + } + break; + } + case 0x0a5744dcu: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_1E1E; + } + break; + } + case 0x0a57a8f5u: + { + if (name.beginsWith(BuiltInName::equal)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_equal_1B1B; + } + break; + } + case 0x0a619e65u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_3B3B3B; + } + break; + } + case 0x0a62e0c3u: + { + if (name == BuiltInName::clamp_1B0B0B) + { + return &BuiltInFunction::kFunction_clamp_1B0B0B; + } + break; + } + case 0x0a635d1au: + { + if (name == BuiltInName::clamp_1B1B1B) + { + return &BuiltInFunction::kFunction_clamp_1B1B1B; + } + break; + } + case 0x0a658fc9u: + { + if (name == BuiltInName::clamp_3B0B0B) + { + return &BuiltInFunction::kFunction_clamp_3B0B0B; + } + break; + } + case 0x0a65f6b4u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_0B0B0B; + } + break; + } + case 0x0a6670deu: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_2B0B0B; + } + break; + } + case 0x0a679af4u: + { + if (name.beginsWith(BuiltInName::clamp)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_clamp_2B2B2B; + } + break; + } + case 0x0c48bffau: + { + if (name.beginsWith(BuiltInName::length)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_length_0B; + } + break; + } + case 0x0c4924f7u: + { + if (name.beginsWith(BuiltInName::length)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_length_3B; + } + break; + } + case 0x0c4a38b6u: + { + if (name.beginsWith(BuiltInName::length)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_length_2B; + } + break; + } + case 0x0c4f6cbbu: + { + if (name.beginsWith(BuiltInName::length)) + { + ASSERT(name.length() == 9); + return &BuiltInFunction::kFunction_length_1B; + } + break; + } + case 0x0e507f22u: + { + if (name.beginsWith(BuiltInName::degrees)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_degrees_2B; + } + break; + } + case 0x0e519bd4u: + { + if (name.beginsWith(BuiltInName::degrees)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_degrees_3B; + } + break; + } + case 0x0e52b187u: + { + if (name.beginsWith(BuiltInName::degrees)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_degrees_0B; + } + break; + } + case 0x0e52e500u: + { + if (name.beginsWith(BuiltInName::radians)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_radians_0B; + } + break; + } + case 0x0e537b7au: + { + if (name.beginsWith(BuiltInName::radians)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_radians_3B; + } + break; + } + case 0x0e541edeu: + { + if (name.beginsWith(BuiltInName::degrees)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_degrees_1B; + } + break; + } + case 0x0e547683u: + { + if (name.beginsWith(BuiltInName::radians)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_radians_2B; + } + break; + } + case 0x0e55ac28u: + { + if (name.beginsWith(BuiltInName::radians)) + { + ASSERT(name.length() == 10); + return &BuiltInFunction::kFunction_radians_1B; + } + break; + } + case 0x0e620f44u: + { + if (name.beginsWith(BuiltInName::reflect)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_reflect_2B2B; + } + break; + } + case 0x0e631c50u: + { + if (name.beginsWith(BuiltInName::reflect)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_reflect_3B3B; + } + break; + } + case 0x0e63358eu: + { + if (name.beginsWith(BuiltInName::reflect)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_reflect_0B0B; + } + break; + } + case 0x0e665b7bu: + { + if (name.beginsWith(BuiltInName::reflect)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_reflect_1B1B; + } + break; + } + case 0x0e706684u: + { + if (name.beginsWith(BuiltInName::refract)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_refract_1B1B0B; + } + break; + } + case 0x0e71a4fcu: + { + if (name.beginsWith(BuiltInName::refract)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_refract_2B2B0B; + } + break; + } + case 0x0e71b28du: + { + if (name == BuiltInName::refract_3B3B0B) + { + return &BuiltInFunction::kFunction_refract_3B3B0B; + } + break; + } + case 0x0e73b594u: + { + if (name.beginsWith(BuiltInName::refract)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_refract_0B0B0B; + } + break; + } + case 0x1068425fu: + { + if (name.beginsWith(BuiltInName::distance)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_distance_3B3B; + } + break; + } + case 0x1068c0bfu: + { + if (name.beginsWith(BuiltInName::distance)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_distance_2B2B; + } + break; + } + case 0x1068f060u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_1E1E; + } + break; + } + case 0x10695fe7u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_2E2E; + } + break; + } + case 0x1069b2c0u: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_1B1B; + } + break; + } + case 0x106a110cu: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_3C3C; + } + break; + } + case 0x106a63f2u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_2C2C; + } + break; + } + case 0x106a713eu: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_2B2B; + } + break; + } + case 0x106ade94u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_1B1B; + } + break; + } + case 0x106b25c9u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_1C1C; + } + break; + } + case 0x106b4468u: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_1C1C; + } + break; + } + case 0x106b8219u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_3B3B; + } + break; + } + case 0x106bc4fcu: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_3E3E; + } + break; + } + case 0x106caf4fu: + { + if (name.beginsWith(BuiltInName::distance)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_distance_0B0B; + } + break; + } + case 0x106d2c39u: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_3B3B; + } + break; + } + case 0x106dabccu: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_2B2B; + } + break; + } + case 0x106eaf65u: + { + if (name.beginsWith(BuiltInName::notEqual)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_notEqual_3C3C; + } + break; + } + case 0x106faaeau: + { + if (name.beginsWith(BuiltInName::lessThan)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_lessThan_2C2C; + } + break; + } + case 0x106ff564u: + { + if (name.beginsWith(BuiltInName::distance)) + { + ASSERT(name.length() == 13); + return &BuiltInFunction::kFunction_distance_1B1B; + } + break; + } + case 0x126235c4u: + { + if (name.beginsWith(BuiltInName::normalize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_normalize_1B; + } + break; + } + case 0x12635a67u: + { + if (name.beginsWith(BuiltInName::normalize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_normalize_2B; + } + break; + } + case 0x1264aa3eu: + { + if (name.beginsWith(BuiltInName::normalize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_normalize_3B; + } + break; + } + case 0x12650243u: + { + if (name.beginsWith(BuiltInName::normalize)) + { + ASSERT(name.length() == 12); + return &BuiltInFunction::kFunction_normalize_0B; + } + break; + } + case 0x14888e72u: + { + if (name.beginsWith(BuiltInName::smoothstep)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_smoothstep_0B0B1B; + } + break; + } + case 0x1489436du: + { + if (name == BuiltInName::smoothstep_1B1B1B) + { + return &BuiltInFunction::kFunction_smoothstep_1B1B1B; + } + break; + } + case 0x1489bfb6u: + { + if (name == BuiltInName::smoothstep_3B3B3B) + { + return &BuiltInFunction::kFunction_smoothstep_3B3B3B; + } + break; + } + case 0x148a33b9u: + { + if (name.beginsWith(BuiltInName::smoothstep)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_smoothstep_2B2B2B; + } + break; + } + case 0x148de9b5u: + { + if (name.beginsWith(BuiltInName::smoothstep)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_smoothstep_0B0B0B; + } + break; + } + case 0x148e5c11u: + { + if (name.beginsWith(BuiltInName::smoothstep)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_smoothstep_0B0B3B; + } + break; + } + case 0x148f7bf9u: + { + if (name.beginsWith(BuiltInName::smoothstep)) + { + ASSERT(name.length() == 17); + return &BuiltInFunction::kFunction_smoothstep_0B0B2B; + } + break; + } + case 0x1670b92du: + { + if (name.beginsWith(BuiltInName::inversesqrt)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_inversesqrt_2B; + } + break; + } + case 0x1671d38eu: + { + if (name.beginsWith(BuiltInName::inversesqrt)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_inversesqrt_1B; + } + break; + } + case 0x16772b69u: + { + if (name.beginsWith(BuiltInName::inversesqrt)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_inversesqrt_0B; + } + break; + } + case 0x1677857cu: + { + if (name.beginsWith(BuiltInName::inversesqrt)) + { + ASSERT(name.length() == 14); + return &BuiltInFunction::kFunction_inversesqrt_3B; + } + break; + } + case 0x16817df9u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_1B1B; + } + break; + } + case 0x1681b963u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_3C3C; + } + break; + } + case 0x16829d5du: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_3B3B; + } + break; + } + case 0x16853112u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_2B2B; + } + break; + } + case 0x1685d025u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_2C2C; + } + break; + } + case 0x1685db46u: + { + if (name.beginsWith(BuiltInName::greaterThan)) + { + ASSERT(name.length() == 16); + return &BuiltInFunction::kFunction_greaterThan_1C1C; + } + break; + } + case 0x1690b84du: + { + if (name == BuiltInName::faceforward_3B3B3B) + { + return &BuiltInFunction::kFunction_faceforward_3B3B3B; + } + break; + } + case 0x1691c40bu: + { + if (name == BuiltInName::faceforward_1B1B1B) + { + return &BuiltInFunction::kFunction_faceforward_1B1B1B; + } + break; + } + case 0x1696babeu: + { + if (name == BuiltInName::faceforward_2B2B2B) + { + return &BuiltInFunction::kFunction_faceforward_2B2B2B; + } + break; + } + case 0x1697cde8u: + { + if (name.beginsWith(BuiltInName::faceforward)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_faceforward_0B0B0B; + } + break; + } + case 0x1a9481a8u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_2C2C; + } + break; + } + case 0x1a94a164u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_3C3C; + } + break; + } + case 0x1a95c72au: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_1B1B; + } + break; + } + case 0x1a9642f7u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_3B3B; + } + break; + } + case 0x1a977782u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_1C1C; + } + break; + } + case 0x1a97d055u: + { + if (name.beginsWith(BuiltInName::lessThanEqual)) + { + ASSERT(name.length() == 18); + return &BuiltInFunction::kFunction_lessThanEqual_2B2B; + } + break; + } + case 0x1c993bdfu: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_5B5B; + } + break; + } + case 0x1c9b357cu: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_FBFB; + } + break; + } + case 0x1c9e72dbu: + { + if (name.beginsWith(BuiltInName::matrixCompMult)) + { + ASSERT(name.length() == 19); + return &BuiltInFunction::kFunction_matrixCompMult_ABAB; + } + break; + } + case 0x20ab1dc0u: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_2C2C; + } + break; + } + case 0x20acdd3au: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_1B1B; + } + break; + } + case 0x20ad192cu: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_3C3C; + } + break; + } + case 0x20adfc96u: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_3B3B; + } + break; + } + case 0x20ae6ffbu: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_2B2B; + } + break; + } + case 0x20af1dd4u: + { + if (name.beginsWith(BuiltInName::greaterThanEqual)) + { + ASSERT(name.length() == 21); + return &BuiltInFunction::kFunction_greaterThanEqual_1C1C; + } + break; + } + case 0x7e6af03cu: + { + if (name == BuiltInName::gl_DepthRange) + { + return mVar_gl_DepthRange; + } + break; + } + case 0x7e8ab02eu: + { + if (name == BuiltInName::gl_MaxDrawBuffers) + { + return mVar_gl_MaxDrawBuffers; + } + break; + } + case 0x7e9ad799u: + { + if (name == BuiltInName::gl_MaxVertexAttribs) + { + return mVar_gl_MaxVertexAttribs; + } + break; + } + case 0x7ebaa8e5u: + { + if (name == BuiltInName::gl_MaxTextureImageUnits) + { + return mVar_gl_MaxTextureImageUnits; + } + break; + } + case 0x7ebeff64u: + { + if (name == BuiltInName::gl_DepthRangeParameters) + { + return mVar_gl_DepthRangeParameters; + } + break; + } + case 0x7ed35151u: + { + if (name == BuiltInName::gl_MaxVertexUniformVectors) + { + return mVar_gl_MaxVertexUniformVectors; + } + break; + } + case 0x7ee45ba1u: + { + if (name == BuiltInName::gl_MaxFragmentUniformVectors) + { + return mVar_gl_MaxFragmentUniformVectors; + } + break; + } + case 0x7eea039au: + { + if (name == BuiltInName::gl_MaxVertexTextureImageUnits) + { + return mVar_gl_MaxVertexTextureImageUnits; + } + break; + } + case 0x7ef1e608u: + { + if (name == BuiltInName::gl_MaxDualSourceDrawBuffersEXT) + { + return mVar_gl_MaxDualSourceDrawBuffersEXT; + } + break; + } + case 0x7ef84293u: + { + if (name == BuiltInName::gl_MaxCombinedTextureImageUnits) + { + return mVar_gl_MaxCombinedTextureImageUnits; + } + break; + } + } + if (mShaderType == GL_FRAGMENT_SHADER) + { + switch (nameHash) + { + case 0x7e64c010u: + { + if (name == BuiltInName::gl_FragCoord) + { + return &BuiltInVariable::kVar_gl_FragCoord; + } + break; + } + case 0x7e6c2088u: + { + if (name == BuiltInName::gl_PointCoord) + { + return &BuiltInVariable::kVar_gl_PointCoord; + } + break; + } + case 0x7e73011eu: + { + if (name == BuiltInName::gl_FrontFacing) + { + return &BuiltInVariable::kVar_gl_FrontFacing; + } + break; + } + } + } + if (mShaderType == GL_VERTEX_SHADER) + { + switch (nameHash) + { + case 0x7e580bc5u: + { + if (name == BuiltInName::gl_Position) + { + return &BuiltInVariable::kVar_gl_Position; + } + break; + } + case 0x7e63931cu: + { + if (name == BuiltInName::gl_PointSize) + { + return &BuiltInVariable::kVar_gl_PointSize; + } + break; + } + } + } + return nullptr; +} + +const UnmangledBuiltIn *TSymbolTable::getUnmangledBuiltInForShaderVersion( + const ImmutableString &name, + int shaderVersion) +{ + if (name.length() > 26) + { + return nullptr; + } + uint32_t nameHash = name.mangledNameHash(); + if (shaderVersion >= 310) + { + switch (nameHash) + { + case 0x7e2c727fu: + { + if (name == BuiltInName::ldexp) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2d0692u: + { + if (name == BuiltInName::frexp) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e399596u: + { + if (name == BuiltInName::findLSB) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e3bdf3fu: + { + if (name == BuiltInName::findMSB) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e41283bu: + { + if (name == BuiltInName::bitCount) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4690b3u: + { + if (name == BuiltInName::atomicOr) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4800e3u: + { + if (name == BuiltInName::atomicAdd) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4893a8u: + { + if (name == BuiltInName::atomicMax) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e49061fu: + { + if (name == BuiltInName::atomicMin) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4a45b6u: + { + if (name == BuiltInName::imageLoad) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4b6656u: + { + if (name == BuiltInName::imageSize) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4dea77u: + { + if (name == BuiltInName::atomicXor) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4e5094u: + { + if (name == BuiltInName::uaddCarry) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4f21aeu: + { + if (name == BuiltInName::atomicAnd) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5237e1u: + { + if (name == BuiltInName::texelFetch) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5276efu: + { + if (name == BuiltInName::imageStore) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e55de86u: + { + if (name == BuiltInName::usubBorrow) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6273e5u: + { + if (name == BuiltInName::packSnorm4x8) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e62a9a0u: + { + if (name == BuiltInName::imulExtended) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e657e29u: + { + if (name == BuiltInName::packUnorm4x8) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6746f4u: + { + if (name == BuiltInName::umulExtended) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e69d0dbu: + { + if (name == BuiltInName::memoryBarrier) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6d0f32u: + { + if (name == BuiltInName::textureGather) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6e00a5u: + { + if (name == BuiltInName::atomicCounter) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e71963eu: + { + if (name == BuiltInName::unpackUnorm4x8) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e73f1d1u: + { + if (name == BuiltInName::unpackSnorm4x8) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e75cfb1u: + { + if (name == BuiltInName::atomicExchange) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e778ffcu: + { + if (name == BuiltInName::atomicCompSwap) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e77c121u: + { + if (name == BuiltInName::bitfieldInsert) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7f2cb2u: + { + if (name == BuiltInName::bitfieldReverse) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7fa0c1u: + { + if (name == BuiltInName::bitfieldExtract) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e9269d7u: + { + if (name == BuiltInName::memoryBarrierImage) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e9b7f32u: + { + if (name == BuiltInName::memoryBarrierBuffer) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e9d8ad9u: + { + if (name == BuiltInName::textureGatherOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7eb323ddu: + { + if (name == BuiltInName::atomicCounterIncrement) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7eb6aed0u: + { + if (name == BuiltInName::atomicCounterDecrement) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7ed5b06bu: + { + if (name == BuiltInName::memoryBarrierAtomicCounter) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + if (mShaderType == GL_COMPUTE_SHADER) + { + switch (nameHash) + { + case 0x7e39f4e9u: + { + if (name == BuiltInName::barrier) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e93c6b9u: + { + if (name == BuiltInName::groupMemoryBarrier) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e9f4b19u: + { + if (name == BuiltInName::memoryBarrierShared) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + } + if (mShaderType == GL_GEOMETRY_SHADER_EXT) + { + switch (nameHash) + { + case 0x7e55adc2u: + { + if (name == BuiltInName::EmitVertex) + { + return &UnmangledBuiltIns::EXT_geometry_shader; + } + break; + } + case 0x7e65b2cau: + { + if (name == BuiltInName::EndPrimitive) + { + return &UnmangledBuiltIns::EXT_geometry_shader; + } + break; + } + } + } + } + if (shaderVersion >= 300) + { + switch (nameHash) + { + case 0x7e19507bu: + { + if (name == BuiltInName::abs) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1e492du: + { + if (name == BuiltInName::min) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1ea71bu: + { + if (name == BuiltInName::mix) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1ebe0eu: + { + if (name == BuiltInName::max) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e205c92u: + { + if (name == BuiltInName::tanh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e206e40u: + { + if (name == BuiltInName::sign) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e209eadu: + { + if (name == BuiltInName::sinh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e274509u: + { + if (name == BuiltInName::modf) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e27a4feu: + { + if (name == BuiltInName::cosh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e28294fu: + { + if (name == BuiltInName::atanh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2924b8u: + { + if (name == BuiltInName::isinf) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e297347u: + { + if (name == BuiltInName::equal) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2a7a64u: + { + if (name == BuiltInName::round) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2d5dcbu: + { + if (name == BuiltInName::clamp) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2d8df4u: + { + if (name == BuiltInName::isnan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2dcbc6u: + { + if (name == BuiltInName::asinh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2eab16u: + { + if (name == BuiltInName::trunc) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2f67c3u: + { + if (name == BuiltInName::acosh) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e39ebd7u: + { + if (name == BuiltInName::texture) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e3d828cu: + { + if (name == BuiltInName::inverse) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e403a20u: + { + if (name == BuiltInName::lessThan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e413f93u: + { + if (name == BuiltInName::notEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4d27c2u: + { + if (name == BuiltInName::rgb_2_yuv) + { + return &UnmangledBuiltIns::EXT_YUV_target; + } + break; + } + case 0x7e4d323bu: + { + if (name == BuiltInName::roundEven) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4e024cu: + { + if (name == BuiltInName::transpose) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4e33aeu: + { + if (name == BuiltInName::yuv_2_rgb) + { + return &UnmangledBuiltIns::EXT_YUV_target; + } + break; + } + case 0x7e501e0cu: + { + if (name == BuiltInName::textureLod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5237e1u: + { + if (name == BuiltInName::texelFetch) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e582ffcu: + { + if (name == BuiltInName::greaterThan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e599347u: + { + if (name == BuiltInName::textureGrad) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5ba531u: + { + if (name == BuiltInName::determinant) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5caafbu: + { + if (name == BuiltInName::textureProj) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5e217eu: + { + if (name == BuiltInName::textureSize) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e62daa3u: + { + if (name == BuiltInName::packHalf2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e646b9bu: + { + if (name == BuiltInName::outerProduct) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e683586u: + { + if (name == BuiltInName::lessThanEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6a013du: + { + if (name == BuiltInName::packSnorm2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6b72b8u: + { + if (name == BuiltInName::packUnorm2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e6c5187u: + { + if (name == BuiltInName::textureOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e715db5u: + { + if (name == BuiltInName::unpackHalf2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e759618u: + { + if (name == BuiltInName::floatBitsToInt) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e75ae2fu: + { + if (name == BuiltInName::textureProjLod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e76bea7u: + { + if (name == BuiltInName::matrixCompMult) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e77fc97u: + { + if (name == BuiltInName::intBitsToFloat) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e792d39u: + { + if (name == BuiltInName::unpackUnorm2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7b6a0eu: + { + if (name == BuiltInName::unpackSnorm2x16) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7bc1fdu: + { + if (name == BuiltInName::textureProjGrad) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7e0e81u: + { + if (name == BuiltInName::uintBitsToFloat) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e7e5132u: + { + if (name == BuiltInName::floatBitsToUint) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e80919du: + { + if (name == BuiltInName::texelFetchOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e81c71au: + { + if (name == BuiltInName::textureLodOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e876cccu: + { + if (name == BuiltInName::greaterThanEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e8b5832u: + { + if (name == BuiltInName::textureGradOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e8d2d2du: + { + if (name == BuiltInName::textureProjOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7ea0be08u: + { + if (name == BuiltInName::textureProjLodOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7eac5717u: + { + if (name == BuiltInName::textureProjGradOffset) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + if (mShaderType == GL_FRAGMENT_SHADER) + { + switch (nameHash) + { + case 0x7e2624d4u: + { + if (name == BuiltInName::dFdy) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e265ea7u: + { + if (name == BuiltInName::dFdx) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e324ea1u: + { + if (name == BuiltInName::fwidth) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + } + } + if (shaderVersion == 100) + { + switch (nameHash) + { + case 0x7e48c50cu: + { + if (name == BuiltInName::texture2D) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5ffc48u: + { + if (name == BuiltInName::textureCube) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e69f545u: + { + if (name == BuiltInName::texture2DRect) + { + return &UnmangledBuiltIns::ARB_texture_rectangle; + } + break; + } + case 0x7e6e3735u: + { + if (name == BuiltInName::texture2DProj) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e868a22u: + { + if (name == BuiltInName::texture2DGradEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + case 0x7e8b66e4u: + { + if (name == BuiltInName::texture2DRectProj) + { + return &UnmangledBuiltIns::ARB_texture_rectangle; + } + break; + } + case 0x7e90fa5bu: + { + if (name == BuiltInName::textureCubeGradEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + case 0x7ea20b8fu: + { + if (name == BuiltInName::texture2DProjGradEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + } + if (mShaderType == GL_FRAGMENT_SHADER) + { + switch (nameHash) + { + case 0x7e2624d4u: + { + if (name == BuiltInName::dFdyExt) + { + return &UnmangledBuiltIns::OES_standard_derivatives; + } + break; + } + case 0x7e265ea7u: + { + if (name == BuiltInName::dFdxExt) + { + return &UnmangledBuiltIns::OES_standard_derivatives; + } + break; + } + case 0x7e324ea1u: + { + if (name == BuiltInName::fwidthExt) + { + return &UnmangledBuiltIns::OES_standard_derivatives; + } + break; + } + case 0x7e7b843eu: + { + if (name == BuiltInName::texture2DLodEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + case 0x7e8b81cau: + { + if (name == BuiltInName::textureCubeLodEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + case 0x7e9ddba0u: + { + if (name == BuiltInName::texture2DProjLodEXT) + { + return &UnmangledBuiltIns::EXT_shader_texture_lod; + } + break; + } + } + } + if (mShaderType == GL_VERTEX_SHADER) + { + switch (nameHash) + { + case 0x7e67c7ceu: + { + if (name == BuiltInName::texture2DLod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e758eddu: + { + if (name == BuiltInName::textureCubeLod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e819b90u: + { + if (name == BuiltInName::texture2DProjLod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + } + } + switch (nameHash) + { + case 0x7e1892eeu: + { + if (name == BuiltInName::all) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e19507bu: + { + if (name == BuiltInName::abs) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e195106u: + { + if (name == BuiltInName::notFunc) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e197102u: + { + if (name == BuiltInName::any) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e19ebdbu: + { + if (name == BuiltInName::log) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1acb4eu: + { + if (name == BuiltInName::pow) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1b921cu: + { + if (name == BuiltInName::exp) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1cf321u: + { + if (name == BuiltInName::tan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1e492du: + { + if (name == BuiltInName::min) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1e8464u: + { + if (name == BuiltInName::dot) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1ea71bu: + { + if (name == BuiltInName::mix) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1ebe0eu: + { + if (name == BuiltInName::max) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1eee70u: + { + if (name == BuiltInName::mod) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1f0bccu: + { + if (name == BuiltInName::sin) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e1fdef3u: + { + if (name == BuiltInName::cos) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e203979u: + { + if (name == BuiltInName::atan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e206e40u: + { + if (name == BuiltInName::sign) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e209ec1u: + { + if (name == BuiltInName::log2) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e21ff11u: + { + if (name == BuiltInName::acos) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e23152fu: + { + if (name == BuiltInName::ceil) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e23f4beu: + { + if (name == BuiltInName::sqrt) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e24bcdbu: + { + if (name == BuiltInName::exp2) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e26202fu: + { + if (name == BuiltInName::step) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e27ebd5u: + { + if (name == BuiltInName::asin) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e295733u: + { + if (name == BuiltInName::cross) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e297347u: + { + if (name == BuiltInName::equal) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2d5dcbu: + { + if (name == BuiltInName::clamp) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2dcb25u: + { + if (name == BuiltInName::floor) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e2f6df3u: + { + if (name == BuiltInName::fract) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e340894u: + { + if (name == BuiltInName::length) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e38233fu: + { + if (name == BuiltInName::refract) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e3c3cb3u: + { + if (name == BuiltInName::radians) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e3c8e91u: + { + if (name == BuiltInName::reflect) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e3d784cu: + { + if (name == BuiltInName::degrees) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e403a20u: + { + if (name == BuiltInName::lessThan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e413f93u: + { + if (name == BuiltInName::notEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4161fau: + { + if (name == BuiltInName::distance) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e4e7aa5u: + { + if (name == BuiltInName::normalize) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e54a2cfu: + { + if (name == BuiltInName::smoothstep) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e582ffcu: + { + if (name == BuiltInName::greaterThan) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5ae14bu: + { + if (name == BuiltInName::faceforward) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e5f4d0fu: + { + if (name == BuiltInName::inversesqrt) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e683586u: + { + if (name == BuiltInName::lessThanEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e76bea7u: + { + if (name == BuiltInName::matrixCompMult) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + case 0x7e876cccu: + { + if (name == BuiltInName::greaterThanEqual) + { + return &UnmangledBuiltIns::UNDEFINED; + } + break; + } + } + return nullptr; +} + +} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h new file mode 100644 index 000000000000..bb8a415eb0ca --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/SymbolTable_autogen.h @@ -0,0 +1,78 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_builtin_symbols.py using data from builtin_variables.json and +// builtin_function_declarations.txt. +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// SymbolTable_autogen.h: +// Autogenerated member variables of TSymbolTable. + +#ifndef COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_ +#define COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_ + +namespace sh +{ + +class TSymbolTableBase +{ + protected: + TSymbolTableBase() = default; + TStructure *mVar_gl_DepthRangeParameters = nullptr; + TVariable *mVar_gl_DepthRange = nullptr; + TVariable *mVar_gl_MaxVertexAttribs = nullptr; + TVariable *mVar_gl_MaxVertexUniformVectors = nullptr; + TVariable *mVar_gl_MaxVertexTextureImageUnits = nullptr; + TVariable *mVar_gl_MaxCombinedTextureImageUnits = nullptr; + TVariable *mVar_gl_MaxTextureImageUnits = nullptr; + TVariable *mVar_gl_MaxFragmentUniformVectors = nullptr; + TVariable *mVar_gl_MaxVaryingVectors = nullptr; + TVariable *mVar_gl_MaxDrawBuffers = nullptr; + TVariable *mVar_gl_MaxDualSourceDrawBuffersEXT = nullptr; + TVariable *mVar_gl_MaxVertexOutputVectors = nullptr; + TVariable *mVar_gl_MaxFragmentInputVectors = nullptr; + TVariable *mVar_gl_MinProgramTexelOffset = nullptr; + TVariable *mVar_gl_MaxProgramTexelOffset = nullptr; + TVariable *mVar_gl_MaxImageUnits = nullptr; + TVariable *mVar_gl_MaxVertexImageUniforms = nullptr; + TVariable *mVar_gl_MaxFragmentImageUniforms = nullptr; + TVariable *mVar_gl_MaxComputeImageUniforms = nullptr; + TVariable *mVar_gl_MaxCombinedImageUniforms = nullptr; + TVariable *mVar_gl_MaxCombinedShaderOutputResources = nullptr; + TVariable *mVar_gl_MaxComputeWorkGroupCount = nullptr; + TVariable *mVar_gl_MaxComputeWorkGroupSize = nullptr; + TVariable *mVar_gl_MaxComputeUniformComponents = nullptr; + TVariable *mVar_gl_MaxComputeTextureImageUnits = nullptr; + TVariable *mVar_gl_MaxComputeAtomicCounters = nullptr; + TVariable *mVar_gl_MaxComputeAtomicCounterBuffers = nullptr; + TVariable *mVar_gl_MaxVertexAtomicCounters = nullptr; + TVariable *mVar_gl_MaxFragmentAtomicCounters = nullptr; + TVariable *mVar_gl_MaxCombinedAtomicCounters = nullptr; + TVariable *mVar_gl_MaxAtomicCounterBindings = nullptr; + TVariable *mVar_gl_MaxVertexAtomicCounterBuffers = nullptr; + TVariable *mVar_gl_MaxFragmentAtomicCounterBuffers = nullptr; + TVariable *mVar_gl_MaxCombinedAtomicCounterBuffers = nullptr; + TVariable *mVar_gl_MaxAtomicCounterBufferSize = nullptr; + TVariable *mVar_gl_MaxGeometryInputComponents = nullptr; + TVariable *mVar_gl_MaxGeometryOutputComponents = nullptr; + TVariable *mVar_gl_MaxGeometryImageUniforms = nullptr; + TVariable *mVar_gl_MaxGeometryTextureImageUnits = nullptr; + TVariable *mVar_gl_MaxGeometryOutputVertices = nullptr; + TVariable *mVar_gl_MaxGeometryTotalOutputComponents = nullptr; + TVariable *mVar_gl_MaxGeometryUniformComponents = nullptr; + TVariable *mVar_gl_MaxGeometryAtomicCounters = nullptr; + TVariable *mVar_gl_MaxGeometryAtomicCounterBuffers = nullptr; + TVariable *mVar_gl_FragData = nullptr; + TVariable *mVar_gl_SecondaryFragDataEXT = nullptr; + TVariable *mVar_gl_FragDepthEXT = nullptr; + TVariable *mVar_gl_LastFragData = nullptr; + TVariable *mVar_gl_LastFragDataNV = nullptr; + TInterfaceBlock *mVar_gl_PerVertex = nullptr; + TVariable *mVar_gl_in = nullptr; + TVariable *mVar_gl_PositionGS = nullptr; +}; + +} // namespace sh + +#endif // COMPILER_TRANSLATOR_SYMBOLTABLE_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp index 0812a87f38e3..8ae4d2d09f2d 100644 --- a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp +++ b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.cpp @@ -22,11 +22,6 @@ TSymbolUniqueId::TSymbolUniqueId(const TSymbol &symbol) : mId(symbol.uniqueId(). TSymbolUniqueId &TSymbolUniqueId::operator=(const TSymbolUniqueId &) = default; -int TSymbolUniqueId::get() const -{ - return mId; -} - bool TSymbolUniqueId::operator==(const TSymbolUniqueId &other) const { return mId == other.mId; diff --git a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h index a01f7713c6c8..e85c3be768d7 100644 --- a/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h +++ b/gfx/angle/checkout/src/compiler/translator/SymbolUniqueId.h @@ -20,15 +20,18 @@ class TSymbolUniqueId { public: POOL_ALLOCATOR_NEW_DELETE(); - explicit TSymbolUniqueId(TSymbolTable *symbolTable); explicit TSymbolUniqueId(const TSymbol &symbol); constexpr TSymbolUniqueId(const TSymbolUniqueId &) = default; TSymbolUniqueId &operator=(const TSymbolUniqueId &); bool operator==(const TSymbolUniqueId &) const; - int get() const; + constexpr int get() const { return mId; } private: + friend class TSymbolTable; + explicit TSymbolUniqueId(TSymbolTable *symbolTable); + + friend class BuiltInId; constexpr TSymbolUniqueId(int staticId) : mId(staticId) {} int mId; diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp index ddec86601beb..a5ae3ec786f1 100644 --- a/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/TranslatorESSL.cpp @@ -6,11 +6,11 @@ #include "compiler/translator/TranslatorESSL.h" -#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h" -#include "compiler/translator/EmulatePrecision.h" -#include "compiler/translator/RecordConstantPrecision.h" -#include "compiler/translator/OutputESSL.h" #include "angle_gl.h" +#include "compiler/translator/BuiltInFunctionEmulatorGLSL.h" +#include "compiler/translator/OutputESSL.h" +#include "compiler/translator/tree_ops/EmulatePrecision.h" +#include "compiler/translator/tree_ops/RecordConstantPrecision.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp index 2f450e438cd9..a2535784c781 100644 --- a/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp @@ -8,12 +8,12 @@ #include "angle_gl.h" #include "compiler/translator/BuiltInFunctionEmulatorGLSL.h" -#include "compiler/translator/EmulatePrecision.h" #include "compiler/translator/ExtensionGLSL.h" #include "compiler/translator/OutputGLSL.h" -#include "compiler/translator/RewriteTexelFetchOffset.h" -#include "compiler/translator/RewriteUnaryMinusOperatorFloat.h" #include "compiler/translator/VersionGLSL.h" +#include "compiler/translator/tree_ops/EmulatePrecision.h" +#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h" +#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp index 74e5589b5480..db2af8f0f2c9 100644 --- a/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/TranslatorHLSL.cpp @@ -6,26 +6,26 @@ #include "compiler/translator/TranslatorHLSL.h" -#include "compiler/translator/AddDefaultReturnStatements.h" -#include "compiler/translator/ArrayReturnValueToOutParameter.h" -#include "compiler/translator/BreakVariableAliasingInInnerLoops.h" -#include "compiler/translator/EmulatePrecision.h" -#include "compiler/translator/ExpandIntegerPowExpressions.h" -#include "compiler/translator/IntermNodePatternMatcher.h" #include "compiler/translator/OutputHLSL.h" -#include "compiler/translator/RemoveDynamicIndexing.h" -#include "compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.h" -#include "compiler/translator/RewriteElseBlocks.h" -#include "compiler/translator/RewriteTexelFetchOffset.h" -#include "compiler/translator/RewriteUnaryMinusOperatorInt.h" -#include "compiler/translator/SeparateArrayConstructorStatements.h" -#include "compiler/translator/SeparateArrayInitialization.h" -#include "compiler/translator/SeparateDeclarations.h" -#include "compiler/translator/SeparateExpressionsReturningArrays.h" -#include "compiler/translator/SimplifyLoopConditions.h" -#include "compiler/translator/SplitSequenceOperator.h" -#include "compiler/translator/UnfoldShortCircuitToIf.h" -#include "compiler/translator/WrapSwitchStatementsInBlocks.h" +#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h" +#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h" +#include "compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h" +#include "compiler/translator/tree_ops/EmulatePrecision.h" +#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h" +#include "compiler/translator/tree_ops/PruneEmptyCases.h" +#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h" +#include "compiler/translator/tree_ops/RewriteElseBlocks.h" +#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h" +#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h" +#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h" +#include "compiler/translator/tree_ops/SeparateArrayInitialization.h" +#include "compiler/translator/tree_ops/SeparateDeclarations.h" +#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h" +#include "compiler/translator/tree_ops/SimplifyLoopConditions.h" +#include "compiler/translator/tree_ops/SplitSequenceOperator.h" +#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h" +#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" namespace sh { @@ -93,13 +93,10 @@ void TranslatorHLSL::translate(TIntermBlock *root, sh::BreakVariableAliasingInInnerLoops(root); // WrapSwitchStatementsInBlocks should be called after any AST transformations that might - // introduce variable declarations inside the main scope of any switch statement. - if (WrapSwitchStatementsInBlocks(root)) - { - // The WrapSwitchStatementsInBlocks step might introduce new no-op cases to the end of - // switch statements, so make sure to clean up the AST. - RemoveNoOpCasesFromEndOfSwitchStatements(root, &getSymbolTable()); - } + // introduce variable declarations inside the main scope of any switch statement. It cannot + // result in no-op cases at the end of switch statements, because unreferenced variables + // have already been pruned. + WrapSwitchStatementsInBlocks(root); bool precisionEmulation = getResources().WEBGL_debug_shader_precision && getPragma().debugShaderPrecision; diff --git a/gfx/angle/checkout/src/compiler/translator/Types.cpp b/gfx/angle/checkout/src/compiler/translator/Types.cpp index 929130ee11d9..e217a4ca6b1c 100644 --- a/gfx/angle/checkout/src/compiler/translator/Types.cpp +++ b/gfx/angle/checkout/src/compiler/translator/Types.cpp @@ -479,14 +479,10 @@ bool TType::canReplaceWithConstantUnion() const // const char *TType::buildMangledName() const { - TString mangledName; - if (isMatrix()) - mangledName += 'm'; - else if (isVector()) - mangledName += 'v'; + TString mangledName(1, GetSizeMangledName(primarySize, secondarySize)); - const char *basicMangledName = GetBasicMangledName(type); - if (basicMangledName != nullptr) + char basicMangledName = GetBasicMangledName(type); + if (basicMangledName != '{') { mangledName += basicMangledName; } @@ -496,17 +492,19 @@ const char *TType::buildMangledName() const switch (type) { case EbtStruct: - mangledName += "struct-"; + mangledName += "{s"; if (mStructure->symbolType() != SymbolType::Empty) { mangledName += mStructure->name().data(); } mangledName += mStructure->mangledFieldList(); + mangledName += '}'; break; case EbtInterfaceBlock: - mangledName += "iblock-"; + mangledName += "{i"; mangledName += mInterfaceBlock->name().data(); mangledName += mInterfaceBlock->mangledFieldList(); + mangledName += '}'; break; default: UNREACHABLE(); @@ -514,17 +512,6 @@ const char *TType::buildMangledName() const } } - if (isMatrix()) - { - mangledName += static_cast('0' + getCols()); - mangledName += static_cast('x'); - mangledName += static_cast('0' + getRows()); - } - else - { - mangledName += static_cast('0' + getNominalSize()); - } - if (mArraySizes) { for (unsigned int arraySize : *mArraySizes) @@ -537,8 +524,6 @@ const char *TType::buildMangledName() const } } - mangledName += ';'; - // Copy string contents into a pool-allocated buffer, so we never need to call delete. return AllocatePoolCharArray(mangledName.c_str(), mangledName.size()); } @@ -779,11 +764,6 @@ void TType::realize() getMangledName(); } -bool TType::isRealized() const -{ - return mMangledName != nullptr; -} - void TType::invalidateMangledName() { mMangledName = nullptr; @@ -884,7 +864,6 @@ TString TFieldListCollection::buildMangledFieldList() const TString mangledName; for (const auto *field : *mFields) { - mangledName += '-'; mangledName += field->type()->getMangledName(); } return mangledName; diff --git a/gfx/angle/checkout/src/compiler/translator/Types.h b/gfx/angle/checkout/src/compiler/translator/Types.h index 47f96aaaa849..8a4e1a78e88e 100644 --- a/gfx/angle/checkout/src/compiler/translator/Types.h +++ b/gfx/angle/checkout/src/compiler/translator/Types.h @@ -229,6 +229,15 @@ class TType const TStructure *getStruct() const { return mStructure; } + static constexpr char GetSizeMangledName(unsigned char primarySize, unsigned char secondarySize) + { + unsigned int sizeKey = (secondarySize - 1u) * 4u + primarySize - 1u; + if (sizeKey < 10u) + { + return static_cast('0' + sizeKey); + } + return static_cast('A' + sizeKey - 10); + } const char *getMangledName() const; bool sameNonArrayType(const TType &right) const; @@ -319,8 +328,6 @@ class TType // Initializes all lazily-initialized members. void realize(); - bool isRealized() const; - private: void invalidateMangledName(); const char *buildMangledName() const; diff --git a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp index b177f2e9a01c..573dc6c6e75f 100644 --- a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.cpp @@ -15,6 +15,33 @@ namespace sh { +namespace +{ + +void DisambiguateFunctionNameForParameterType(const TType ¶mType, + TString *disambiguatingStringOut) +{ + // Parameter types are only added to function names if they are ambiguous according to the + // native HLSL compiler. Other parameter types are not added to function names to avoid + // making function names longer. + if (paramType.getObjectSize() == 4 && paramType.getBasicType() == EbtFloat) + { + // Disambiguation is needed for float2x2 and float4 parameters. These are the only + // built-in types that HLSL thinks are identical. float2x3 and float3x2 are different + // types, for example. + *disambiguatingStringOut += "_" + TypeString(paramType); + } + else if (paramType.getBasicType() == EbtStruct) + { + // Disambiguation is needed for struct parameters, since HLSL thinks that structs with + // the same fields but a different name are identical. + ASSERT(paramType.getStruct()->symbolType() != SymbolType::Empty); + *disambiguatingStringOut += "_" + TypeString(paramType); + } +} + +} // anonymous namespace + const char *SamplerString(const TBasicType type) { if (IsShadowSampler(type)) @@ -802,8 +829,10 @@ TString Decorate(const ImmutableString &string) TString DecorateVariableIfNeeded(const TVariable &variable) { - if (variable.symbolType() == SymbolType::AngleInternal) + if (variable.symbolType() == SymbolType::AngleInternal || + variable.symbolType() == SymbolType::Empty) { + // Besides handling internal variables, we generate names for nameless parameters here. const ImmutableString &name = variable.name(); // The name should not have a prefix reserved for user-defined variables or functions. ASSERT(!name.beginsWith("f_")); @@ -1025,29 +1054,26 @@ const char *QualifierString(TQualifier qualifier) return ""; } -TString DisambiguateFunctionName(const TIntermSequence *parameters) +TString DisambiguateFunctionName(const TFunction *func) { TString disambiguatingString; - for (auto parameter : *parameters) + size_t paramCount = func->getParamCount(); + for (size_t i = 0; i < paramCount; ++i) { - const TType ¶mType = parameter->getAsTyped()->getType(); - // Parameter types are only added to function names if they are ambiguous according to the - // native HLSL compiler. Other parameter types are not added to function names to avoid - // making function names longer. - if (paramType.getObjectSize() == 4 && paramType.getBasicType() == EbtFloat) - { - // Disambiguation is needed for float2x2 and float4 parameters. These are the only - // built-in types that HLSL thinks are identical. float2x3 and float3x2 are different - // types, for example. - disambiguatingString += "_" + TypeString(paramType); - } - else if (paramType.getBasicType() == EbtStruct) - { - // Disambiguation is needed for struct parameters, since HLSL thinks that structs with - // the same fields but a different name are identical. - ASSERT(paramType.getStruct()->symbolType() != SymbolType::Empty); - disambiguatingString += "_" + TypeString(paramType); - } + DisambiguateFunctionNameForParameterType(func->getParam(i)->getType(), + &disambiguatingString); + } + return disambiguatingString; +} + +TString DisambiguateFunctionName(const TIntermSequence *args) +{ + TString disambiguatingString; + for (TIntermNode *arg : *args) + { + ASSERT(arg->getAsTyped()); + DisambiguateFunctionNameForParameterType(arg->getAsTyped()->getType(), + &disambiguatingString); } return disambiguatingString; } diff --git a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h index d6cb7f9a070b..846dbcd7f993 100644 --- a/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h +++ b/gfx/angle/checkout/src/compiler/translator/UtilsHLSL.h @@ -19,6 +19,8 @@ namespace sh { +class TFunction; + // HLSL Texture type for GLSL sampler type and readonly image type. enum HLSLTextureGroup { @@ -123,7 +125,8 @@ const char *InterpolationString(TQualifier qualifier); const char *QualifierString(TQualifier qualifier); // Parameters may need to be included in function names to disambiguate between overloaded // functions. -TString DisambiguateFunctionName(const TIntermSequence *parameters); +TString DisambiguateFunctionName(const TFunction *func); +TString DisambiguateFunctionName(const TIntermSequence *args); } #endif // COMPILER_TRANSLATOR_UTILSHLSL_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp index 6c65fa2133ee..4ffb832d99bb 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateGlobalInitializer.cpp @@ -6,7 +6,7 @@ #include "compiler/translator/ValidateGlobalInitializer.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -14,6 +14,8 @@ namespace sh namespace { +const int kMaxAllowedTraversalDepth = 256; + class ValidateGlobalInitializerTraverser : public TIntermTraverser { public: @@ -25,7 +27,7 @@ class ValidateGlobalInitializerTraverser : public TIntermTraverser bool visitBinary(Visit visit, TIntermBinary *node) override; bool visitUnary(Visit visit, TIntermUnary *node) override; - bool isValid() const { return mIsValid; } + bool isValid() const { return mIsValid && mMaxDepth < mMaxAllowedDepth; } bool issueWarning() const { return mIssueWarning; } private: @@ -117,11 +119,12 @@ bool ValidateGlobalInitializerTraverser::visitUnary(Visit visit, TIntermUnary *n } ValidateGlobalInitializerTraverser::ValidateGlobalInitializerTraverser(int shaderVersion) - : TIntermTraverser(true, false, false), + : TIntermTraverser(true, false, false, nullptr), mShaderVersion(shaderVersion), mIsValid(true), mIssueWarning(false) { + setMaxAllowedDepth(kMaxAllowedTraversalDepth); } } // namespace diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp index b9fd73e6deb5..0fb8fe3e88ac 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateLimitations.cpp @@ -8,8 +8,8 @@ #include "angle_gl.h" #include "compiler/translator/Diagnostics.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/ParseContext.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp index 9dccbf413f61..a06babd3bd52 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateMaxParameters.cpp @@ -8,6 +8,7 @@ #include "compiler/translator/ValidateMaxParameters.h" #include "compiler/translator/IntermNode.h" +#include "compiler/translator/Symbol.h" namespace sh { @@ -18,7 +19,7 @@ bool ValidateMaxParameters(TIntermBlock *root, unsigned int maxParameters) { TIntermFunctionDefinition *definition = node->getAsFunctionDefinition(); if (definition != nullptr && - definition->getFunctionPrototype()->getSequence()->size() > maxParameters) + definition->getFunctionPrototype()->getFunction()->getParamCount() > maxParameters) { return false; } diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp index d77a0da0e0ac..6399c6b735c2 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateOutputs.cpp @@ -12,8 +12,8 @@ #include #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/ParseContext.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp index 9f7a264e5822..0dbecc9daa83 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.cpp @@ -7,7 +7,7 @@ #include "compiler/translator/ValidateSwitch.h" #include "compiler/translator/Diagnostics.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -15,11 +15,12 @@ namespace sh namespace { +const int kMaxAllowedTraversalDepth = 256; + class ValidateSwitch : public TIntermTraverser { public: static bool validate(TBasicType switchType, - int shaderVersion, TDiagnostics *diagnostics, TIntermBlock *statementList, const TSourceLoc &loc); @@ -27,7 +28,7 @@ class ValidateSwitch : public TIntermTraverser void visitSymbol(TIntermSymbol *) override; void visitConstantUnion(TIntermConstantUnion *) override; bool visitDeclaration(Visit, TIntermDeclaration *) override; - bool visitBlock(Visit, TIntermBlock *) override; + bool visitBlock(Visit visit, TIntermBlock *) override; bool visitBinary(Visit, TIntermBinary *) override; bool visitUnary(Visit, TIntermUnary *) override; bool visitTernary(Visit, TIntermTernary *) override; @@ -40,12 +41,11 @@ class ValidateSwitch : public TIntermTraverser bool visitBranch(Visit, TIntermBranch *) override; private: - ValidateSwitch(TBasicType switchType, int shaderVersion, TDiagnostics *context); + ValidateSwitch(TBasicType switchType, TDiagnostics *context); bool validateInternal(const TSourceLoc &loc); TBasicType mSwitchType; - int mShaderVersion; TDiagnostics *mDiagnostics; bool mCaseTypeMismatch; bool mFirstCaseFound; @@ -60,21 +60,19 @@ class ValidateSwitch : public TIntermTraverser }; bool ValidateSwitch::validate(TBasicType switchType, - int shaderVersion, TDiagnostics *diagnostics, TIntermBlock *statementList, const TSourceLoc &loc) { - ValidateSwitch validate(switchType, shaderVersion, diagnostics); + ValidateSwitch validate(switchType, diagnostics); ASSERT(statementList); statementList->traverse(&validate); return validate.validateInternal(loc); } -ValidateSwitch::ValidateSwitch(TBasicType switchType, int shaderVersion, TDiagnostics *diagnostics) - : TIntermTraverser(true, false, true), +ValidateSwitch::ValidateSwitch(TBasicType switchType, TDiagnostics *diagnostics) + : TIntermTraverser(true, false, true, nullptr), mSwitchType(switchType), - mShaderVersion(shaderVersion), mDiagnostics(diagnostics), mCaseTypeMismatch(false), mFirstCaseFound(false), @@ -85,6 +83,7 @@ ValidateSwitch::ValidateSwitch(TBasicType switchType, int shaderVersion, TDiagno mDefaultCount(0), mDuplicateCases(false) { + setMaxAllowedDepth(kMaxAllowedTraversalDepth); } void ValidateSwitch::visitSymbol(TIntermSymbol *) @@ -111,13 +110,17 @@ bool ValidateSwitch::visitDeclaration(Visit, TIntermDeclaration *) return true; } -bool ValidateSwitch::visitBlock(Visit, TIntermBlock *) +bool ValidateSwitch::visitBlock(Visit visit, TIntermBlock *) { if (getParentNode() != nullptr) { if (!mFirstCaseFound) mStatementBeforeCase = true; mLastStatementWasCase = false; + if (visit == PreVisit) + ++mControlFlowDepth; + if (visit == PostVisit) + --mControlFlowDepth; } return true; } @@ -281,39 +284,32 @@ bool ValidateSwitch::validateInternal(const TSourceLoc &loc) { mDiagnostics->error(loc, "statement before the first label", "switch"); } - bool lastStatementWasCaseError = false; if (mLastStatementWasCase) { - if (mShaderVersion == 300) - { - lastStatementWasCaseError = true; - // This error has been proposed to be made optional in GLSL ES 3.00, but dEQP tests - // still require it. - mDiagnostics->error( - loc, "no statement between the last label and the end of the switch statement", - "switch"); - } - else - { - // The error has been removed from GLSL ES 3.10. - mDiagnostics->warning( - loc, "no statement between the last label and the end of the switch statement", - "switch"); - } + // There have been some differences between versions of GLSL ES specs on whether this should + // be an error or not, but as of early 2018 the latest discussion is that this is an error + // also on GLSL ES versions newer than 3.00. + mDiagnostics->error( + loc, "no statement between the last label and the end of the switch statement", + "switch"); } - return !mStatementBeforeCase && !lastStatementWasCaseError && !mCaseInsideControlFlow && - !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases; + if (getMaxDepth() >= kMaxAllowedTraversalDepth) + { + mDiagnostics->error(loc, "too complex expressions inside a switch statement", "switch"); + } + return !mStatementBeforeCase && !mLastStatementWasCase && !mCaseInsideControlFlow && + !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases && + getMaxDepth() < kMaxAllowedTraversalDepth; } } // anonymous namespace bool ValidateSwitchStatementList(TBasicType switchType, - int shaderVersion, TDiagnostics *diagnostics, TIntermBlock *statementList, const TSourceLoc &loc) { - return ValidateSwitch::validate(switchType, shaderVersion, diagnostics, statementList, loc); + return ValidateSwitch::validate(switchType, diagnostics, statementList, loc); } } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h index 2d2dd70f7844..757820a164e4 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h +++ b/gfx/angle/checkout/src/compiler/translator/ValidateSwitch.h @@ -18,7 +18,6 @@ class TIntermBlock; // Check for errors and output error messages on the context. // Returns true if there are no errors. bool ValidateSwitchStatementList(TBasicType switchType, - int shaderVersion, TDiagnostics *diagnostics, TIntermBlock *statementList, const TSourceLoc &loc); diff --git a/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp index 728059d69efe..bee43cfe1f99 100644 --- a/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp +++ b/gfx/angle/checkout/src/compiler/translator/ValidateVaryingLocations.cpp @@ -10,8 +10,8 @@ #include "ValidateVaryingLocations.h" #include "compiler/translator/Diagnostics.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include "compiler/translator/util.h" namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp index 7e634a6c8a9b..eb431c3117a5 100644 --- a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp +++ b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.cpp @@ -105,15 +105,16 @@ bool TVersionGLSL::visitInvariantDeclaration(Visit, TIntermInvariantDeclaration return true; } -bool TVersionGLSL::visitFunctionPrototype(Visit, TIntermFunctionPrototype *node) +void TVersionGLSL::visitFunctionPrototype(TIntermFunctionPrototype *node) { - const TIntermSequence ¶ms = *(node->getSequence()); - for (TIntermSequence::const_iterator iter = params.begin(); iter != params.end(); ++iter) + size_t paramCount = node->getFunction()->getParamCount(); + for (size_t i = 0; i < paramCount; ++i) { - const TIntermTyped *param = (*iter)->getAsTyped(); - if (param->isArray()) + const TVariable *param = node->getFunction()->getParam(i); + const TType &type = param->getType(); + if (type.isArray()) { - TQualifier qualifier = param->getQualifier(); + TQualifier qualifier = type.getQualifier(); if ((qualifier == EvqOut) || (qualifier == EvqInOut)) { ensureVersionIsAtLeast(GLSL_VERSION_120); @@ -121,8 +122,6 @@ bool TVersionGLSL::visitFunctionPrototype(Visit, TIntermFunctionPrototype *node) } } } - // Fully processed. No need to visit children. - return false; } bool TVersionGLSL::visitAggregate(Visit, TIntermAggregate *node) diff --git a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h index 8b82eb9615a9..f05da966f45a 100644 --- a/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h +++ b/gfx/angle/checkout/src/compiler/translator/VersionGLSL.h @@ -7,7 +7,7 @@ #ifndef COMPILER_TRANSLATOR_VERSIONGLSL_H_ #define COMPILER_TRANSLATOR_VERSIONGLSL_H_ -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include "compiler/translator/Pragma.h" @@ -62,7 +62,7 @@ class TVersionGLSL : public TIntermTraverser void visitSymbol(TIntermSymbol *node) override; bool visitAggregate(Visit, TIntermAggregate *node) override; bool visitInvariantDeclaration(Visit, TIntermInvariantDeclaration *node) override; - bool visitFunctionPrototype(Visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; bool visitDeclaration(Visit, TIntermDeclaration *node) override; private: diff --git a/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp b/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp index d5d4c8d6f1ff..29abc690bef0 100644 --- a/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp +++ b/gfx/angle/checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp @@ -2,7 +2,7 @@ // Generated by gen_emulated_builtin_function_tables.py using data from // emulated_builtin_function_data_hlsl.json. // -// Copyright 2017 The ANGLE Project Authors. All rights reserved. +// Copyright 2018 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -10,6 +10,7 @@ // HLSL code for emulating GLSL builtin functions not present in HLSL. #include "compiler/translator/BuiltInFunctionEmulator.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" namespace sh { @@ -19,51 +20,52 @@ namespace struct FunctionPair { - constexpr FunctionPair(const MiniFunctionId &idIn, const char *bodyIn) : id(idIn), body(bodyIn) + constexpr FunctionPair(const TSymbolUniqueId &idIn, const char *bodyIn) + : id(idIn.get()), body(bodyIn) { } - MiniFunctionId id; + int id; const char *body; }; constexpr FunctionPair g_hlslFunctions[] = { - {{EOpMod, ParamType::Float1, ParamType::Float1}, + {BuiltInId::mod_Float1_Float1, "float mod_emu(float x, float y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float2, ParamType::Float2}, + {BuiltInId::mod_Float2_Float2, "float2 mod_emu(float2 x, float2 y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float2, ParamType::Float1}, + {BuiltInId::mod_Float2_Float1, "float2 mod_emu(float2 x, float y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float3, ParamType::Float3}, + {BuiltInId::mod_Float3_Float3, "float3 mod_emu(float3 x, float3 y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float3, ParamType::Float1}, + {BuiltInId::mod_Float3_Float1, "float3 mod_emu(float3 x, float y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float4, ParamType::Float4}, + {BuiltInId::mod_Float4_Float4, "float4 mod_emu(float4 x, float4 y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpMod, ParamType::Float4, ParamType::Float1}, + {BuiltInId::mod_Float4_Float1, "float4 mod_emu(float4 x, float y)\n" "{\n" " return x - y * floor(x / y);\n" "}\n"}, - {{EOpFrexp, ParamType::Float1, ParamType::Int1}, + {BuiltInId::frexp_Float1_Int1, "float frexp_emu(float x, out int exp)\n" "{\n" " float fexp;\n" @@ -71,7 +73,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " exp = int(fexp);\n" " return mantissa;\n" "}\n"}, - {{EOpFrexp, ParamType::Float2, ParamType::Int2}, + {BuiltInId::frexp_Float2_Int2, "float2 frexp_emu(float2 x, out int2 exp)\n" "{\n" " float2 fexp;\n" @@ -79,7 +81,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " exp = int2(fexp);\n" " return mantissa;\n" "}\n"}, - {{EOpFrexp, ParamType::Float3, ParamType::Int3}, + {BuiltInId::frexp_Float3_Int3, "float3 frexp_emu(float3 x, out int3 exp)\n" "{\n" " float3 fexp;\n" @@ -87,7 +89,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " exp = int3(fexp);\n" " return mantissa;\n" "}\n"}, - {{EOpFrexp, ParamType::Float4, ParamType::Int4}, + {BuiltInId::frexp_Float4_Int4, "float4 frexp_emu(float4 x, out int4 exp)\n" "{\n" " float4 fexp;\n" @@ -95,27 +97,27 @@ constexpr FunctionPair g_hlslFunctions[] = { " exp = int4(fexp);\n" " return mantissa;\n" "}\n"}, - {{EOpLdexp, ParamType::Float1, ParamType::Int1}, + {BuiltInId::ldexp_Float1_Int1, "float ldexp_emu(float x, int exp)\n" "{\n" " return ldexp(x, float(exp));\n" "}\n"}, - {{EOpLdexp, ParamType::Float2, ParamType::Int2}, + {BuiltInId::ldexp_Float2_Int2, "float2 ldexp_emu(float2 x, int2 exp)\n" "{\n" " return ldexp(x, float2(exp));\n" "}\n"}, - {{EOpLdexp, ParamType::Float3, ParamType::Int3}, + {BuiltInId::ldexp_Float3_Int3, "float3 ldexp_emu(float3 x, int3 exp)\n" "{\n" " return ldexp(x, float3(exp));\n" "}\n"}, - {{EOpLdexp, ParamType::Float4, ParamType::Int4}, + {BuiltInId::ldexp_Float4_Int4, "float4 ldexp_emu(float4 x, int4 exp)\n" "{\n" " return ldexp(x, float4(exp));\n" "}\n"}, - {{EOpFaceforward, ParamType::Float1, ParamType::Float1, ParamType::Float1}, + {BuiltInId::faceforward_Float1_Float1_Float1, "float faceforward_emu(float N, float I, float Nref)\n" "{\n" " if(dot(Nref, I) >= 0)\n" @@ -127,7 +129,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " return N;\n" " }\n" "}\n"}, - {{EOpFaceforward, ParamType::Float2, ParamType::Float2, ParamType::Float2}, + {BuiltInId::faceforward_Float2_Float2_Float2, "float2 faceforward_emu(float2 N, float2 I, float2 Nref)\n" "{\n" " if(dot(Nref, I) >= 0)\n" @@ -139,7 +141,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " return N;\n" " }\n" "}\n"}, - {{EOpFaceforward, ParamType::Float3, ParamType::Float3, ParamType::Float3}, + {BuiltInId::faceforward_Float3_Float3_Float3, "float3 faceforward_emu(float3 N, float3 I, float3 Nref)\n" "{\n" " if(dot(Nref, I) >= 0)\n" @@ -151,7 +153,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " return N;\n" " }\n" "}\n"}, - {{EOpFaceforward, ParamType::Float4, ParamType::Float4, ParamType::Float4}, + {BuiltInId::faceforward_Float4_Float4_Float4, "float4 faceforward_emu(float4 N, float4 I, float4 Nref)\n" "{\n" " if(dot(Nref, I) >= 0)\n" @@ -163,20 +165,20 @@ constexpr FunctionPair g_hlslFunctions[] = { " return N;\n" " }\n" "}\n"}, - {{EOpAtan, ParamType::Float1, ParamType::Float1}, + {BuiltInId::atan_Float1_Float1, "float atan_emu(float y, float x)\n" "{\n" " if(x == 0 && y == 0) x = 1;\n" " return atan2(y, x);\n" "}\n"}, - {{EOpAtan, ParamType::Float2, ParamType::Float2}, + {BuiltInId::atan_Float2_Float2, "float2 atan_emu(float2 y, float2 x)\n" "{\n" " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n" " if(x[1] == 0 && y[1] == 0) x[1] = 1;\n" " return float2(atan2(y[0], x[0]), atan2(y[1], x[1]));\n" "}\n"}, - {{EOpAtan, ParamType::Float3, ParamType::Float3}, + {BuiltInId::atan_Float3_Float3, "float3 atan_emu(float3 y, float3 x)\n" "{\n" " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n" @@ -184,7 +186,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " if(x[2] == 0 && y[2] == 0) x[2] = 1;\n" " return float3(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], x[2]));\n" "}\n"}, - {{EOpAtan, ParamType::Float4, ParamType::Float4}, + {BuiltInId::atan_Float4_Float4, "float4 atan_emu(float4 y, float4 x)\n" "{\n" " if(x[0] == 0 && y[0] == 0) x[0] = 1;\n" @@ -194,72 +196,72 @@ constexpr FunctionPair g_hlslFunctions[] = { " return float4(atan2(y[0], x[0]), atan2(y[1], x[1]), atan2(y[2], \n" " x[2]), atan2(y[3], x[3]));\n" "}\n"}, - {{EOpAsinh, ParamType::Float1}, + {BuiltInId::asinh_Float1, "float asinh_emu(in float x)\n" "{\n" " return log(x + sqrt(pow(x, 2.0) + 1.0));\n" "}\n"}, - {{EOpAsinh, ParamType::Float2}, + {BuiltInId::asinh_Float2, "float2 asinh_emu(in float2 x)\n" "{\n" " return log(x + sqrt(pow(x, 2.0) + 1.0));\n" "}\n"}, - {{EOpAsinh, ParamType::Float3}, + {BuiltInId::asinh_Float3, "float3 asinh_emu(in float3 x)\n" "{\n" " return log(x + sqrt(pow(x, 2.0) + 1.0));\n" "}\n"}, - {{EOpAsinh, ParamType::Float4}, + {BuiltInId::asinh_Float4, "float4 asinh_emu(in float4 x)\n" "{\n" " return log(x + sqrt(pow(x, 2.0) + 1.0));\n" "}\n"}, - {{EOpAcosh, ParamType::Float1}, + {BuiltInId::acosh_Float1, "float acosh_emu(in float x)\n" "{\n" " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n" "}\n"}, - {{EOpAcosh, ParamType::Float2}, + {BuiltInId::acosh_Float2, "float2 acosh_emu(in float2 x)\n" "{\n" " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n" "}\n"}, - {{EOpAcosh, ParamType::Float3}, + {BuiltInId::acosh_Float3, "float3 acosh_emu(in float3 x)\n" "{\n" " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n" "}\n"}, - {{EOpAcosh, ParamType::Float4}, + {BuiltInId::acosh_Float4, "float4 acosh_emu(in float4 x)\n" "{\n" " return log(x + sqrt(x + 1.0) * sqrt(x - 1.0));\n" "}\n"}, - {{EOpAtanh, ParamType::Float1}, + {BuiltInId::atanh_Float1, "float atanh_emu(in float x)\n" "{\n" " return 0.5 * log((1.0 + x) / (1.0 - x));\n" "}\n"}, - {{EOpAtanh, ParamType::Float2}, + {BuiltInId::atanh_Float2, "float2 atanh_emu(in float2 x)\n" "{\n" " return 0.5 * log((1.0 + x) / (1.0 - x));\n" "}\n"}, - {{EOpAtanh, ParamType::Float3}, + {BuiltInId::atanh_Float3, "float3 atanh_emu(in float3 x)\n" "{\n" " return 0.5 * log((1.0 + x) / (1.0 - x));\n" "}\n"}, - {{EOpAtanh, ParamType::Float4}, + {BuiltInId::atanh_Float4, "float4 atanh_emu(in float4 x)\n" "{\n" " return 0.5 * log((1.0 + x) / (1.0 - x));\n" "}\n"}, - {{EOpRoundEven, ParamType::Float1}, + {BuiltInId::roundEven_Float1, "float roundEven_emu(in float x)\n" "{\n" " return (frac(x) == 0.5 && trunc(x) % 2.0 == 0.0) ? trunc(x) : round(x);\n" "}\n"}, - {{EOpRoundEven, ParamType::Float2}, + {BuiltInId::roundEven_Float2, "float2 roundEven_emu(in float2 x)\n" "{\n" " float2 v;\n" @@ -267,7 +269,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " v[1] = (frac(x[1]) == 0.5 && trunc(x[1]) % 2.0 == 0.0) ? trunc(x[1]) : round(x[1]);\n" " return v;\n" "}\n"}, - {{EOpRoundEven, ParamType::Float3}, + {BuiltInId::roundEven_Float3, "float3 roundEven_emu(in float3 x)\n" "{\n" " float3 v;\n" @@ -276,7 +278,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " v[2] = (frac(x[2]) == 0.5 && trunc(x[2]) % 2.0 == 0.0) ? trunc(x[2]) : round(x[2]);\n" " return v;\n" "}\n"}, - {{EOpRoundEven, ParamType::Float4}, + {BuiltInId::roundEven_Float4, "float4 roundEven_emu(in float4 x)\n" "{\n" " float4 v;\n" @@ -286,7 +288,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " v[3] = (frac(x[3]) == 0.5 && trunc(x[3]) % 2.0 == 0.0) ? trunc(x[3]) : round(x[3]);\n" " return v;\n" "}\n"}, - {{EOpPackSnorm2x16, ParamType::Float2}, + {BuiltInId::packSnorm2x16_Float2, "int webgl_toSnorm16(in float x) {\n" " return int(round(clamp(x, -1.0, 1.0) * 32767.0));\n" "}\n" @@ -296,7 +298,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " int y = webgl_toSnorm16(v.y);\n" " return (asuint(y) << 16) | (asuint(x) & 0xffffu);\n" "}\n"}, - {{EOpPackUnorm2x16, ParamType::Float2}, + {BuiltInId::packUnorm2x16_Float2, "uint webgl_toUnorm16(in float x) {\n" " return uint(round(clamp(x, 0.0, 1.0) * 65535.0));\n" "}\n" @@ -306,14 +308,14 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint y = webgl_toUnorm16(v.y);\n" " return (y << 16) | x;\n" "}\n"}, - {{EOpPackHalf2x16, ParamType::Float2}, + {BuiltInId::packHalf2x16_Float2, "uint packHalf2x16_emu(in float2 v)\n" "{\n" " uint x = f32tof16(v.x);\n" " uint y = f32tof16(v.y);\n" " return (y << 16) | x;\n" "}\n"}, - {{EOpUnpackSnorm2x16, ParamType::Uint1}, + {BuiltInId::unpackSnorm2x16_UInt1, "float webgl_fromSnorm16(in uint x) {\n" " int xi = asint(x & 0x7fffu) - asint(x & 0x8000u);\n" " return clamp(float(xi) / 32767.0, -1.0, 1.0);\n" @@ -324,7 +326,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint x = u;\n" " return float2(webgl_fromSnorm16(x), webgl_fromSnorm16(y));\n" "}\n"}, - {{EOpUnpackUnorm2x16, ParamType::Uint1}, + {BuiltInId::unpackUnorm2x16_UInt1, "float webgl_fromUnorm16(in uint x) {\n" " return float(x) / 65535.0;\n" "}\n" @@ -334,14 +336,14 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint x = u & 0xffffu;\n" " return float2(webgl_fromUnorm16(x), webgl_fromUnorm16(y));\n" "}\n"}, - {{EOpUnpackHalf2x16, ParamType::Uint1}, + {BuiltInId::unpackHalf2x16_UInt1, "float2 unpackHalf2x16_emu(in uint u)\n" "{\n" " uint y = (u >> 16);\n" " uint x = u & 0xffffu;\n" " return float2(f16tof32(x), f16tof32(y));\n" "}\n"}, - {{EOpPackSnorm4x8, ParamType::Float4}, + {BuiltInId::packSnorm4x8_Float4, "int webgl_toSnorm8(in float x) {\n" " return int(round(clamp(x, -1.0, 1.0) * 127.0));\n" "}\n" @@ -354,7 +356,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " return ((asuint(w) & 0xffu) << 24) | ((asuint(z) & 0xffu) << 16) \n" " | ((asuint(y) & 0xffu) << 8) | (asuint(x) & 0xffu);\n" "}\n"}, - {{EOpPackUnorm4x8, ParamType::Float4}, + {BuiltInId::packUnorm4x8_Float4, "uint webgl_toUnorm8(in float x) {\n" " return uint(round(clamp(x, 0.0, 1.0) * 255.0));\n" "}\n" @@ -366,7 +368,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint w = webgl_toUnorm8(v.w);\n" " return (w << 24) | (z << 16) | (y << 8) | x;\n" "}\n"}, - {{EOpUnpackSnorm4x8, ParamType::Uint1}, + {BuiltInId::unpackSnorm4x8_UInt1, "float webgl_fromSnorm8(in uint x) {\n" " int xi = asint(x & 0x7fu) - asint(x & 0x80u);\n" " return clamp(float(xi) / 127.0, -1.0, 1.0);\n" @@ -380,7 +382,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " return float4(webgl_fromSnorm8(x), webgl_fromSnorm8(y), \n" " webgl_fromSnorm8(z), webgl_fromSnorm8(w));\n" "}\n"}, - {{EOpUnpackUnorm4x8, ParamType::Uint1}, + {BuiltInId::unpackUnorm4x8_UInt1, "float webgl_fromUnorm8(in uint x) {\n" " return float(x) / 255.0;\n" "}\n" @@ -402,47 +404,47 @@ constexpr FunctionPair g_hlslFunctions[] = { // transpose(r) and transpose(c) are in a sense free, since to get the // transpose of r, we simply can build a column matrix out of the original // vector instead of a row matrix. - {{EOpOuterProduct, ParamType::Float2, ParamType::Float2}, + {BuiltInId::outerProduct_Float2_Float2, "float2x2 outerProduct_emu(in float2 c, in float2 r)\n" "{\n" " return mul(float2x1(r), float1x2(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float3, ParamType::Float3}, + {BuiltInId::outerProduct_Float3_Float3, "float3x3 outerProduct_emu(in float3 c, in float3 r)\n" "{\n" " return mul(float3x1(r), float1x3(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float4, ParamType::Float4}, + {BuiltInId::outerProduct_Float4_Float4, "float4x4 outerProduct_emu(in float4 c, in float4 r)\n" "{\n" " return mul(float4x1(r), float1x4(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float3, ParamType::Float2}, + {BuiltInId::outerProduct_Float3_Float2, "float2x3 outerProduct_emu(in float3 c, in float2 r)\n" "{\n" " return mul(float2x1(r), float1x3(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float2, ParamType::Float3}, + {BuiltInId::outerProduct_Float2_Float3, "float3x2 outerProduct_emu(in float2 c, in float3 r)\n" "{\n" " return mul(float3x1(r), float1x2(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float4, ParamType::Float2}, + {BuiltInId::outerProduct_Float4_Float2, "float2x4 outerProduct_emu(in float4 c, in float2 r)\n" "{\n" " return mul(float2x1(r), float1x4(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float2, ParamType::Float4}, + {BuiltInId::outerProduct_Float2_Float4, "float4x2 outerProduct_emu(in float2 c, in float4 r)\n" "{\n" " return mul(float4x1(r), float1x2(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float4, ParamType::Float3}, + {BuiltInId::outerProduct_Float4_Float3, "float3x4 outerProduct_emu(in float4 c, in float3 r)\n" "{\n" " return mul(float3x1(r), float1x4(c));\n" "}\n"}, - {{EOpOuterProduct, ParamType::Float3, ParamType::Float4}, + {BuiltInId::outerProduct_Float3_Float4, "float4x3 outerProduct_emu(in float3 c, in float4 r)\n" "{\n" " return mul(float4x1(r), float1x3(c));\n" @@ -458,14 +460,14 @@ constexpr FunctionPair g_hlslFunctions[] = { // which happens to be the cofactor matrix. That's stored in 'cof'. // We don't need to care about divide-by-zero since results are undefined // for singular or poorly-conditioned matrices. - {{EOpInverse, ParamType::Mat2}, + {BuiltInId::inverse_Float2x2, "float2x2 inverse_emu(in float2x2 m)\n" "{\n" " float2x2 cof = { m[1][1], -m[0][1], -m[1][0], m[0][0] };\n" " return cof / determinant(transpose(m));\n" "}\n"}, // cofAB is the cofactor for column A and row B. - {{EOpInverse, ParamType::Mat3}, + {BuiltInId::inverse_Float3x3, "float3x3 inverse_emu(in float3x3 m)\n" "{\n" " float cof00 = m[1][1] * m[2][2] - m[2][1] * m[1][2];\n" @@ -480,7 +482,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " float3x3 cof = { cof00, cof10, cof20, cof01, cof11, cof21, cof02, cof12, cof22 };\n" " return cof / determinant(transpose(m));\n" "}\n"}, - {{EOpInverse, ParamType::Mat4}, + {BuiltInId::inverse_Float4x4, "float4x4 inverse_emu(in float4x4 m)\n" "{\n" " float cof00 = m[1][1] * m[2][2] * m[3][3] + m[2][1] * m[3][2] * m[1][3] + m[3][1] * \n" @@ -556,27 +558,27 @@ constexpr FunctionPair g_hlslFunctions[] = { // comes from. For a component of 'a' that is false, the corresponding component of 'x' is // returned. For a component of 'a' that is true, the corresponding component of 'y' is // returned. - {{EOpMix, ParamType::Float1, ParamType::Float1, ParamType::Bool1}, + {BuiltInId::mix_Float1_Float1_Bool1, "float mix_emu(float x, float y, bool a)\n" "{\n" " return a ? y : x;\n" "}\n"}, - {{EOpMix, ParamType::Float2, ParamType::Float2, ParamType::Bool2}, + {BuiltInId::mix_Float2_Float2_Bool2, "float2 mix_emu(float2 x, float2 y, bool2 a)\n" "{\n" " return a ? y : x;\n" "}\n"}, - {{EOpMix, ParamType::Float3, ParamType::Float3, ParamType::Bool3}, + {BuiltInId::mix_Float3_Float3_Bool3, "float3 mix_emu(float3 x, float3 y, bool3 a)\n" "{\n" " return a ? y : x;\n" "}\n"}, - {{EOpMix, ParamType::Float4, ParamType::Float4, ParamType::Bool4}, + {BuiltInId::mix_Float4_Float4_Bool4, "float4 mix_emu(float4 x, float4 y, bool4 a)\n" "{\n" " return a ? y : x;\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Uint1, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_UInt1_Int1_Int1, "uint bitfieldExtract_emu(uint value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -587,7 +589,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n" " return (value & mask) >> offset;\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Uint2, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_UInt2_Int1_Int1, "uint2 bitfieldExtract_emu(uint2 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -598,7 +600,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n" " return (value & mask) >> offset;\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Uint3, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_UInt3_Int1_Int1, "uint3 bitfieldExtract_emu(uint3 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -609,7 +611,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n" " return (value & mask) >> offset;\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Uint4, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_UInt4_Int1_Int1, "uint4 bitfieldExtract_emu(uint4 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -620,7 +622,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint mask = ((maskMsb - 1u) | maskMsb) << offset;\n" " return (value & mask) >> offset;\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Int1, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_Int1_Int1_Int1, "int bitfieldExtract_emu(int value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -637,7 +639,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " }\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Int2, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_Int2_Int1_Int1, "int2 bitfieldExtract_emu(int2 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -654,7 +656,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " }\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Int3, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_Int3_Int1_Int1, "int3 bitfieldExtract_emu(int3 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -671,7 +673,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " }\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldExtract, ParamType::Int4, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldExtract_Int4_Int1_Int1, "int4 bitfieldExtract_emu(int4 value, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -688,7 +690,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " }\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Uint1, ParamType::Uint1, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_UInt1_UInt1_Int1_Int1, "uint bitfieldInsert_emu(uint base, uint insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -700,7 +702,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint baseMask = ~insertMask;\n" " return (base & baseMask) | ((insert << offset) & insertMask);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Uint2, ParamType::Uint2, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_UInt2_UInt2_Int1_Int1, "uint2 bitfieldInsert_emu(uint2 base, uint2 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -712,7 +714,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint baseMask = ~insertMask;\n" " return (base & baseMask) | ((insert << offset) & insertMask);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Uint3, ParamType::Uint3, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_UInt3_UInt3_Int1_Int1, "uint3 bitfieldInsert_emu(uint3 base, uint3 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -724,7 +726,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint baseMask = ~insertMask;\n" " return (base & baseMask) | ((insert << offset) & insertMask);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Uint4, ParamType::Uint4, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_UInt4_UInt4_Int1_Int1, "uint4 bitfieldInsert_emu(uint4 base, uint4 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -736,7 +738,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " uint baseMask = ~insertMask;\n" " return (base & baseMask) | ((insert << offset) & insertMask);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Int1, ParamType::Int1, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_Int1_Int1_Int1_Int1, "int bitfieldInsert_emu(int base, int insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -750,7 +752,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " insertMask);\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Int2, ParamType::Int2, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_Int2_Int2_Int1_Int1, "int2 bitfieldInsert_emu(int2 base, int2 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -764,7 +766,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " insertMask);\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Int3, ParamType::Int3, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_Int3_Int3_Int1_Int1, "int3 bitfieldInsert_emu(int3 base, int3 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -778,7 +780,7 @@ constexpr FunctionPair g_hlslFunctions[] = { " insertMask);\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpBitfieldInsert, ParamType::Int4, ParamType::Int4, ParamType::Int1, ParamType::Int1}, + {BuiltInId::bitfieldInsert_Int4_Int4_Int1_Int1, "int4 bitfieldInsert_emu(int4 base, int4 insert, int offset, int bits)\n" "{\n" " if (offset < 0 || bits <= 0 || offset >= 32 || bits > 32 || offset + bits > 32)\n" @@ -792,71 +794,71 @@ constexpr FunctionPair g_hlslFunctions[] = { " insertMask);\n" " return asint(resultUnsigned);\n" "}\n"}, - {{EOpUaddCarry, ParamType::Uint1, ParamType::Uint1, ParamType::Uint1}, + {BuiltInId::uaddCarry_UInt1_UInt1_UInt1, "uint uaddCarry_emu(uint x, uint y, out uint carry)\n" "{\n" " carry = uint(x > (0xffffffffu - y));\n" " return x + y;\n" "}\n"}, - {{EOpUaddCarry, ParamType::Uint2, ParamType::Uint2, ParamType::Uint2}, + {BuiltInId::uaddCarry_UInt2_UInt2_UInt2, "uint2 uaddCarry_emu(uint2 x, uint2 y, out uint2 carry)\n" "{\n" " carry = uint2(x > (0xffffffffu - y));\n" " return x + y;\n" "}\n"}, - {{EOpUaddCarry, ParamType::Uint3, ParamType::Uint3, ParamType::Uint3}, + {BuiltInId::uaddCarry_UInt3_UInt3_UInt3, "uint3 uaddCarry_emu(uint3 x, uint3 y, out uint3 carry)\n" "{\n" " carry = uint3(x > (0xffffffffu - y));\n" " return x + y;\n" "}\n"}, - {{EOpUaddCarry, ParamType::Uint4, ParamType::Uint4, ParamType::Uint4}, + {BuiltInId::uaddCarry_UInt4_UInt4_UInt4, "uint4 uaddCarry_emu(uint4 x, uint4 y, out uint4 carry)\n" "{\n" " carry = uint4(x > (0xffffffffu - y));\n" " return x + y;\n" "}\n"}, - {{EOpUsubBorrow, ParamType::Uint1, ParamType::Uint1, ParamType::Uint1}, + {BuiltInId::usubBorrow_UInt1_UInt1_UInt1, "uint usubBorrow_emu(uint x, uint y, out uint borrow)\n" "{\n" " borrow = uint(x < y);\n" " return x - y;\n" "}\n"}, - {{EOpUsubBorrow, ParamType::Uint2, ParamType::Uint2, ParamType::Uint2}, + {BuiltInId::usubBorrow_UInt2_UInt2_UInt2, "uint2 usubBorrow_emu(uint2 x, uint2 y, out uint2 borrow)\n" "{\n" " borrow = uint2(x < y);\n" " return x - y;\n" "}\n"}, - {{EOpUsubBorrow, ParamType::Uint3, ParamType::Uint3, ParamType::Uint3}, + {BuiltInId::usubBorrow_UInt3_UInt3_UInt3, "uint3 usubBorrow_emu(uint3 x, uint3 y, out uint3 borrow)\n" "{\n" " borrow = uint3(x < y);\n" " return x - y;\n" "}\n"}, - {{EOpUsubBorrow, ParamType::Uint4, ParamType::Uint4, ParamType::Uint4}, + {BuiltInId::usubBorrow_UInt4_UInt4_UInt4, "uint4 usubBorrow_emu(uint4 x, uint4 y, out uint4 borrow)\n" "{\n" " borrow = uint4(x < y);\n" " return x - y;\n" "}\n"}, // We emulate tanh just to avoid overflow on large arguments. - {{EOpTanh, ParamType::Float1}, + {BuiltInId::tanh_Float1, "float tanh_emu(float x)\n" "{\n" " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n" "}\n"}, - {{EOpTanh, ParamType::Float2}, + {BuiltInId::tanh_Float2, "float2 tanh_emu(float2 x)\n" "{\n" " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n" "}\n"}, - {{EOpTanh, ParamType::Float3}, + {BuiltInId::tanh_Float3, "float3 tanh_emu(float3 x)\n" "{\n" " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n" "}\n"}, - {{EOpTanh, ParamType::Float4}, + {BuiltInId::tanh_Float4, "float4 tanh_emu(float4 x)\n" "{\n" " return (abs(x) > 15.0) ? sign(x) : tanh(x);\n" @@ -864,12 +866,12 @@ constexpr FunctionPair g_hlslFunctions[] = { }; } // anonymous namespace -const char *FindHLSLFunction(const FunctionId &functionID) +const char *FindHLSLFunction(int uniqueId) { for (size_t index = 0; index < ArraySize(g_hlslFunctions); ++index) { const auto &function = g_hlslFunctions[index]; - if (function.id == functionID) + if (function.id == uniqueId) { return function.body; } diff --git a/gfx/angle/checkout/src/compiler/translator/glslang.y b/gfx/angle/checkout/src/compiler/translator/glslang.y index d051444c0e8d..499fda241359 100644 --- a/gfx/angle/checkout/src/compiler/translator/glslang.y +++ b/gfx/angle/checkout/src/compiler/translator/glslang.y @@ -650,7 +650,7 @@ function_header_with_parameters $$ = $1; if ($2.type->getBasicType() != EbtVoid) { - $1->addParameter($2.turnToConst()); + $1->addParameter($2.createVariable(&context->symbolTable)); } } | function_header_with_parameters COMMA parameter_declaration { @@ -664,7 +664,7 @@ function_header_with_parameters } else { - $1->addParameter($3.turnToConst()); + $1->addParameter($3.createVariable(&context->symbolTable)); } } ; @@ -1304,11 +1304,11 @@ compound_statement_no_new_scope statement_list : statement { $$ = new TIntermBlock(); - $$->appendStatement($1); + context->appendStatement($$, $1); } | statement_list statement { $$ = $1; - $$->appendStatement($2); + context->appendStatement($$, $2); } ; diff --git a/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp b/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp index d82ceb5012c9..f974748bf56d 100644 --- a/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp +++ b/gfx/angle/checkout/src/compiler/translator/glslang_tab.cpp @@ -3268,7 +3268,7 @@ yyreduce: (yyval.interm.function) = (yyvsp[-1].interm.function); if ((yyvsp[0].interm.param).type->getBasicType() != EbtVoid) { - (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm.param).turnToConst()); + (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm.param).createVariable(&context->symbolTable)); } } @@ -3287,7 +3287,7 @@ yyreduce: } else { - (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm.param).turnToConst()); + (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm.param).createVariable(&context->symbolTable)); } } @@ -4630,7 +4630,7 @@ yyreduce: { (yyval.interm.intermBlock) = new TIntermBlock(); - (yyval.interm.intermBlock)->appendStatement((yyvsp[0].interm.intermNode)); + context->appendStatement((yyval.interm.intermBlock), (yyvsp[0].interm.intermNode)); } break; @@ -4639,7 +4639,7 @@ yyreduce: { (yyval.interm.intermBlock) = (yyvsp[-1].interm.intermBlock); - (yyval.interm.intermBlock)->appendStatement((yyvsp[0].interm.intermNode)); + context->appendStatement((yyval.interm.intermBlock), (yyvsp[0].interm.intermNode)); } break; diff --git a/gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp similarity index 87% rename from gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp index 27662f18aa06..25a52983a301 100644 --- a/gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp @@ -4,10 +4,10 @@ // found in the LICENSE file. // -#include "compiler/translator/AddAndTrueToLoopCondition.h" +#include "compiler/translator/tree_ops/AddAndTrueToLoopCondition.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h similarity index 65% rename from gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h index 34debe0ed978..3a9efc2133ee 100644 --- a/gfx/angle/checkout/src/compiler/translator/AddAndTrueToLoopCondition.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.h @@ -6,8 +6,8 @@ // Rewrite condition in for and while loops to work around driver bug on Intel Mac. -#ifndef COMPILER_TRANSLATOR_ADDANDTRUETOLOOPCONDITION_H_ -#define COMPILER_TRANSLATOR_ADDANDTRUETOLOOPCONDITION_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_ +#define COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_ class TIntermNode; namespace sh @@ -17,4 +17,4 @@ void AddAndTrueToLoopCondition(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_ADDANDTRUETOLOOPCONDITION_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_ADDANDTRUETOLOOPCONDITION_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp similarity index 92% rename from gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp index 4dfe60c0bcbd..636ce3750674 100644 --- a/gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp @@ -7,10 +7,10 @@ // return. // -#include "compiler/translator/AddDefaultReturnStatements.h" +#include "compiler/translator/tree_ops/AddDefaultReturnStatements.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermNode_util.h" #include "compiler/translator/util.h" namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h similarity index 68% rename from gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h index 40a70ad8c2a1..6d537978f550 100644 --- a/gfx/angle/checkout/src/compiler/translator/AddDefaultReturnStatements.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.h @@ -7,8 +7,8 @@ // return. // -#ifndef COMPILER_TRANSLATOR_ADDDEFAULTRETURNSTATEMENTS_H_ -#define COMPILER_TRANSLATOR_ADDDEFAULTRETURNSTATEMENTS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_ class TIntermBlock; @@ -19,4 +19,4 @@ void AddDefaultReturnStatements(TIntermBlock *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_ADDDEFAULTRETURNSTATEMENTS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_ADDDEFAULTRETURNSTATEMENTS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp similarity index 88% rename from gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp index b981f8b0a651..8dfedc2b7e12 100644 --- a/gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp @@ -6,14 +6,14 @@ // The ArrayReturnValueToOutParameter function changes return values of an array type to out // parameters in function definitions, prototypes, and call sites. -#include "compiler/translator/ArrayReturnValueToOutParameter.h" +#include "compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h" #include -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -23,15 +23,6 @@ namespace constexpr const ImmutableString kReturnValueVariableName("angle_return"); -void CopyAggregateChildren(TIntermAggregateBase *from, TIntermAggregateBase *to) -{ - const TIntermSequence *fromSequence = from->getSequence(); - for (size_t ii = 0; ii < fromSequence->size(); ++ii) - { - to->getSequence()->push_back(fromSequence->at(ii)); - } -} - class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser { public: @@ -40,7 +31,7 @@ class ArrayReturnValueToOutParameterTraverser : private TIntermTraverser private: ArrayReturnValueToOutParameterTraverser(TSymbolTable *symbolTable); - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) override; bool visitAggregate(Visit visit, TIntermAggregate *node) override; bool visitBranch(Visit visit, TIntermBranch *node) override; @@ -110,10 +101,9 @@ bool ArrayReturnValueToOutParameterTraverser::visitFunctionDefinition( return true; } -bool ArrayReturnValueToOutParameterTraverser::visitFunctionPrototype(Visit visit, - TIntermFunctionPrototype *node) +void ArrayReturnValueToOutParameterTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node) { - if (visit == PreVisit && node->isArray()) + if (node->isArray()) { // Replace the whole prototype node with another node that has the out parameter // added. Also set the function to return void. @@ -133,21 +123,16 @@ bool ArrayReturnValueToOutParameterTraverser::visitFunctionPrototype(Visit visit { func->addParameter(node->getFunction()->getParam(i)); } - func->addParameter(TConstParameter( - kReturnValueVariableName, static_cast(returnValueVariableType))); + func->addParameter(changedFunction.returnValueVariable); changedFunction.func = func; mChangedFunctions[functionId.get()] = changedFunction; } TIntermFunctionPrototype *replacement = new TIntermFunctionPrototype(mChangedFunctions[functionId.get()].func); - CopyAggregateChildren(node, replacement); - replacement->getSequence()->push_back( - new TIntermSymbol(mChangedFunctions[functionId.get()].returnValueVariable)); replacement->setLine(node->getLine()); queueReplacement(replacement, OriginalNode::IS_DROPPED); } - return false; } bool ArrayReturnValueToOutParameterTraverser::visitAggregate(Visit visit, TIntermAggregate *node) diff --git a/gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h similarity index 70% rename from gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h index 469c7a3b1492..9ceb02c76a8e 100644 --- a/gfx/angle/checkout/src/compiler/translator/ArrayReturnValueToOutParameter.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.h @@ -6,8 +6,8 @@ // The ArrayReturnValueToOutParameter function changes return values of an array type to out // parameters in function definitions, prototypes and call sites. -#ifndef COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ -#define COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_ +#define COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_ namespace sh { @@ -19,4 +19,4 @@ void ArrayReturnValueToOutParameter(TIntermNode *root, TSymbolTable *symbolTable } // namespace sh -#endif // COMPILER_TRANSLATOR_ARRAYRETURNVALUETOOUTPARAMETER_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_ARRAYRETURNVALUETOOUTPARAMETER_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp index d6a1e025def0..19f53a73834e 100644 --- a/gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp @@ -10,8 +10,8 @@ #include "BreakVariableAliasingInInnerLoops.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" // A HLSL compiler developer gave us more details on the root cause and the workaround needed: // The root problem is that if the HLSL compiler is applying aliasing information even on diff --git a/gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h similarity index 72% rename from gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h index b1d906f91984..cdbdb7aa963b 100644 --- a/gfx/angle/checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.h @@ -8,8 +8,8 @@ // may record a variable as aliasing another. Sometimes the alias information gets garbled // so we work around this issue by breaking the aliasing chain in inner loops. -#ifndef COMPILER_TRANSLATOR_BREAKVARIABLEALIASINGININNERLOOPS_H_ -#define COMPILER_TRANSLATOR_BREAKVARIABLEALIASINGININNERLOOPS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_ class TIntermNode; @@ -20,4 +20,4 @@ void BreakVariableAliasingInInnerLoops(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_BREAKVARIABLEALIASINGININNERLOOPS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_BREAKVARIABLEALIASINGININNERLOOPS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ClampFragDepth.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp similarity index 81% rename from gfx/angle/checkout/src/compiler/translator/ClampFragDepth.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp index 448c9c048620..d721160a325c 100644 --- a/gfx/angle/checkout/src/compiler/translator/ClampFragDepth.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp @@ -8,13 +8,14 @@ // statically accesses gl_FragDepth. // -#include "compiler/translator/ClampFragDepth.h" +#include "compiler/translator/tree_ops/ClampFragDepth.h" -#include "compiler/translator/FindSymbolNode.h" #include "compiler/translator/ImmutableString.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/RunAtTheEndOfShader.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" +#include "compiler/translator/tree_util/FindSymbolNode.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/RunAtTheEndOfShader.h" namespace sh { @@ -27,8 +28,7 @@ void ClampFragDepth(TIntermBlock *root, TSymbolTable *symbolTable) return; } - TIntermSymbol *fragDepthNode = - ReferenceBuiltInVariable(ImmutableString("gl_FragDepth"), *symbolTable, 300); + TIntermSymbol *fragDepthNode = new TIntermSymbol(BuiltInVariable::gl_FragDepth()); TIntermTyped *minFragDepthNode = CreateZeroNode(TType(EbtFloat, EbpHigh, EvqConst)); diff --git a/gfx/angle/checkout/src/compiler/translator/ClampFragDepth.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h similarity index 77% rename from gfx/angle/checkout/src/compiler/translator/ClampFragDepth.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h index aa0ed1a17ef1..70d1f7336ade 100644 --- a/gfx/angle/checkout/src/compiler/translator/ClampFragDepth.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampFragDepth.h @@ -8,8 +8,8 @@ // statically accesses gl_FragDepth. // -#ifndef COMPILER_TRANSLATOR_CLAMPFRAGDEPTH_H_ -#define COMPILER_TRANSLATOR_CLAMPFRAGDEPTH_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_ +#define COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_ namespace sh { @@ -21,4 +21,4 @@ void ClampFragDepth(TIntermBlock *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_CLAMPFRAGDEPTH_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_CLAMPFRAGDEPTH_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ClampPointSize.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/ClampPointSize.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp index e6e9a0ea35b4..3966aabd831e 100644 --- a/gfx/angle/checkout/src/compiler/translator/ClampPointSize.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp @@ -6,12 +6,13 @@ // ClampPointSize.cpp: Limit the value that is written to gl_PointSize. // -#include "compiler/translator/ClampPointSize.h" +#include "compiler/translator/tree_ops/ClampPointSize.h" -#include "compiler/translator/FindSymbolNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/RunAtTheEndOfShader.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" +#include "compiler/translator/tree_util/FindSymbolNode.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/RunAtTheEndOfShader.h" namespace sh { @@ -24,8 +25,7 @@ void ClampPointSize(TIntermBlock *root, float maxPointSize, TSymbolTable *symbol return; } - TIntermSymbol *pointSizeNode = - ReferenceBuiltInVariable(ImmutableString("gl_PointSize"), *symbolTable, 100); + TIntermSymbol *pointSizeNode = new TIntermSymbol(BuiltInVariable::gl_PointSize()); TConstantUnion *maxPointSizeConstant = new TConstantUnion(); maxPointSizeConstant->setFConst(maxPointSize); diff --git a/gfx/angle/checkout/src/compiler/translator/ClampPointSize.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h similarity index 71% rename from gfx/angle/checkout/src/compiler/translator/ClampPointSize.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h index 0c71ae6b0d23..5bc7cd4d4387 100644 --- a/gfx/angle/checkout/src/compiler/translator/ClampPointSize.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ClampPointSize.h @@ -6,8 +6,8 @@ // ClampPointSize.h: Limit the value that is written to gl_PointSize. // -#ifndef COMPILER_TRANSLATOR_CLAMPPOINTSIZE_H_ -#define COMPILER_TRANSLATOR_CLAMPPOINTSIZE_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_ +#define COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_ namespace sh { @@ -19,4 +19,4 @@ void ClampPointSize(TIntermBlock *root, float maxPointSize, TSymbolTable *symbol } // namespace sh -#endif // COMPILER_TRANSLATOR_CLAMPPOINTSIZE_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_CLAMPPOINTSIZE_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp similarity index 84% rename from gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp index 59295779fda2..3011af5d8ad3 100644 --- a/gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp @@ -7,15 +7,16 @@ // Check the header file For more information. // -#include "compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h" +#include "compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h" -#include "compiler/translator/FindMain.h" -#include "compiler/translator/InitializeVariables.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" -#include "compiler/translator/ReplaceVariable.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_ops/InitializeVariables.h" +#include "compiler/translator/tree_util/BuiltIn_autogen.h" +#include "compiler/translator/tree_util/FindMain.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" +#include "compiler/translator/tree_util/ReplaceVariable.h" #include "compiler/translator/util.h" namespace sh @@ -24,20 +25,11 @@ namespace sh namespace { -constexpr const ImmutableString kGlLayerString("gl_Layer"); -constexpr const ImmutableString kGlViewportIndexString("gl_ViewportIndex"); -constexpr const ImmutableString kGlViewIdOVRString("gl_ViewID_OVR"); -constexpr const ImmutableString kGlInstanceIdString("gl_InstanceID"); constexpr const ImmutableString kViewIDVariableName("ViewID_OVR"); constexpr const ImmutableString kInstanceIDVariableName("InstanceID"); constexpr const ImmutableString kMultiviewBaseViewLayerIndexVariableName( "multiviewBaseViewLayerIndex"); -TIntermSymbol *CreateGLInstanceIDSymbol(const TSymbolTable &symbolTable) -{ - return ReferenceBuiltInVariable(kGlInstanceIdString, symbolTable, 300); -} - // Adds the InstanceID and ViewID_OVR initializers to the end of the initializers' sequence. void InitializeViewIDAndInstanceID(const TVariable *viewID, const TVariable *instanceID, @@ -53,7 +45,7 @@ void InitializeViewIDAndInstanceID(const TVariable *viewID, // Create a uint(gl_InstanceID) node. TIntermSequence *glInstanceIDSymbolCastArguments = new TIntermSequence(); - glInstanceIDSymbolCastArguments->push_back(CreateGLInstanceIDSymbol(symbolTable)); + glInstanceIDSymbolCastArguments->push_back(new TIntermSymbol(BuiltInVariable::gl_InstanceID())); TIntermAggregate *glInstanceIDAsUint = TIntermAggregate::CreateConstructor( TType(EbtUInt, EbpHigh, EvqTemporary), glInstanceIDSymbolCastArguments); @@ -105,8 +97,7 @@ void SelectViewIndexInVertexShader(const TVariable *viewID, TType(EbtInt, EbpHigh, EvqTemporary), viewIDSymbolCastArguments); // Create a gl_ViewportIndex node. - TIntermSymbol *viewportIndexSymbol = - ReferenceBuiltInVariable(kGlViewportIndexString, symbolTable, 0); + TIntermSymbol *viewportIndexSymbol = new TIntermSymbol(BuiltInVariable::gl_ViewportIndex()); // Create a { gl_ViewportIndex = int(ViewID_OVR) } node. TIntermBlock *viewportIndexInitializerInBlock = new TIntermBlock(); @@ -114,7 +105,7 @@ void SelectViewIndexInVertexShader(const TVariable *viewID, new TIntermBinary(EOpAssign, viewportIndexSymbol, viewIDAsInt)); // Create a gl_Layer node. - TIntermSymbol *layerSymbol = ReferenceBuiltInVariable(kGlLayerString, symbolTable, 0); + TIntermSymbol *layerSymbol = new TIntermSymbol(BuiltInVariable::gl_LayerVS()); // Create an int(ViewID_OVR) + multiviewBaseViewLayerIndex node TIntermBinary *sumOfViewIDAndBaseViewIndex = new TIntermBinary( @@ -149,29 +140,23 @@ void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, { ASSERT(shaderType == GL_VERTEX_SHADER || shaderType == GL_FRAGMENT_SHADER); - TQualifier viewIDQualifier = (shaderType == GL_VERTEX_SHADER) ? EvqFlatOut : EvqFlatIn; + TQualifier viewIDQualifier = (shaderType == GL_VERTEX_SHADER) ? EvqFlatOut : EvqFlatIn; const TVariable *viewID = new TVariable(symbolTable, kViewIDVariableName, new TType(EbtUInt, EbpHigh, viewIDQualifier), SymbolType::AngleInternal); DeclareGlobalVariable(root, viewID); - ReplaceVariable( - root, - static_cast(symbolTable->findBuiltIn(kGlViewIdOVRString, 300, true)), - viewID); + ReplaceVariable(root, BuiltInVariable::gl_ViewID_OVR(), viewID); if (shaderType == GL_VERTEX_SHADER) { // Replacing gl_InstanceID with InstanceID should happen before adding the initializers of // InstanceID and ViewID. - const TType *instanceIDVariableType = StaticType::Get(); + const TType *instanceIDVariableType = StaticType::Get(); const TVariable *instanceID = new TVariable(symbolTable, kInstanceIDVariableName, instanceIDVariableType, SymbolType::AngleInternal); DeclareGlobalVariable(root, instanceID); - ReplaceVariable(root, - static_cast( - symbolTable->findBuiltIn(kGlInstanceIdString, 300, true)), - instanceID); + ReplaceVariable(root, BuiltInVariable::gl_InstanceID(), instanceID); TIntermSequence *initializers = new TIntermSequence(); InitializeViewIDAndInstanceID(viewID, instanceID, numberOfViews, *symbolTable, @@ -207,4 +192,4 @@ void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, } } -} // namespace sh \ No newline at end of file +} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h similarity index 87% rename from gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h index b4ab05fd0e77..9501ea58b31e 100644 --- a/gfx/angle/checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.h @@ -24,8 +24,8 @@ // uniform. // -#ifndef COMPILER_TRANSLATOR_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ -#define COMPILER_TRANSLATOR_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ +#define COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ #include "GLSLANG/ShaderLang.h" #include "angle_gl.h" @@ -45,4 +45,4 @@ void DeclareAndInitBuiltinsForInstancedMultiview(TIntermBlock *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEOPS_DECLAREANDINITBUILTINSFORINSTANCEDMULTIVIEW_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp similarity index 95% rename from gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp index 0e14054ee546..8f48d3e352ba 100644 --- a/gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp @@ -13,17 +13,17 @@ // It can also initialize all uninitialized globals. // -#include "compiler/translator/DeferGlobalInitializers.h" +#include "compiler/translator/tree_ops/DeferGlobalInitializers.h" #include -#include "compiler/translator/FindMain.h" -#include "compiler/translator/InitializeVariables.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/ReplaceVariable.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_ops/InitializeVariables.h" +#include "compiler/translator/tree_util/FindMain.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/ReplaceVariable.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h similarity index 85% rename from gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h index 0ca2c4d4354b..b0e45478579e 100644 --- a/gfx/angle/checkout/src/compiler/translator/DeferGlobalInitializers.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.h @@ -13,8 +13,8 @@ // It can also initialize all uninitialized globals. // -#ifndef COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ -#define COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_ namespace sh { @@ -30,4 +30,4 @@ void DeferGlobalInitializers(TIntermBlock *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_DEFERGLOBALINITIALIZERS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_DEFERGLOBALINITIALIZERS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp index 7689f0404e4c..a0ed2b2b889c 100644 --- a/gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp @@ -11,12 +11,12 @@ // with gl_FragData[0]. // -#include "compiler/translator/EmulateGLFragColorBroadcast.h" +#include "compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" -#include "compiler/translator/RunAtTheEndOfShader.h" #include "compiler/translator/Symbol.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" +#include "compiler/translator/tree_util/RunAtTheEndOfShader.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h similarity index 82% rename from gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h index e652b7e07e63..f44ae2840569 100644 --- a/gfx/angle/checkout/src/compiler/translator/EmulateGLFragColorBroadcast.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.h @@ -7,8 +7,8 @@ // GL_EXT_draw_buffers is explicitly enabled in a fragment shader. // -#ifndef COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_ -#define COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_ +#define COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_ #include @@ -28,4 +28,4 @@ void EmulateGLFragColorBroadcast(TIntermBlock *root, int shaderVersion); } -#endif // COMPILER_TRANSLATOR_EMULATEGLFRAGCOLORBROADCAST_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_EMULATEGLFRAGCOLORBROADCAST_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/EmulatePrecision.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/EmulatePrecision.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp index 268a4a4677dc..30d6456ed03b 100644 --- a/gfx/angle/checkout/src/compiler/translator/EmulatePrecision.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp @@ -4,7 +4,7 @@ // found in the LICENSE file. // -#include "compiler/translator/EmulatePrecision.h" +#include "compiler/translator/tree_ops/EmulatePrecision.h" #include "compiler/translator/FunctionLookup.h" @@ -42,13 +42,13 @@ class RoundingHelperWriter : angle::NonCopyable const ShShaderOutput mOutputLanguage; private: - virtual std::string getTypeString(const char *glslType) = 0; - virtual void writeFloatRoundingHelpers(TInfoSinkBase &sink) = 0; + virtual std::string getTypeString(const char *glslType) = 0; + virtual void writeFloatRoundingHelpers(TInfoSinkBase &sink) = 0; virtual void writeVectorRoundingHelpers(TInfoSinkBase &sink, const unsigned int size) = 0; virtual void writeMatrixRoundingHelper(TInfoSinkBase &sink, const unsigned int columns, const unsigned int rows, - const char *functionName) = 0; + const char *functionName) = 0; }; class RoundingHelperWriterGLSL : public RoundingHelperWriter @@ -618,11 +618,6 @@ bool EmulatePrecision::visitInvariantDeclaration(Visit visit, TIntermInvariantDe return false; } -bool EmulatePrecision::visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) -{ - return false; -} - bool EmulatePrecision::visitAggregate(Visit visit, TIntermAggregate *node) { if (visit != PreVisit) @@ -709,7 +704,7 @@ bool EmulatePrecision::SupportedInLanguage(const ShShaderOutput outputLanguage) const TFunction *EmulatePrecision::getInternalFunction(const ImmutableString &functionName, const TType &returnType, TIntermSequence *arguments, - const TVector ¶meters, + const TVector ¶meters, bool knownToNotHaveSideEffects) { ImmutableString mangledName = TFunctionLookup::GetMangledName(functionName.data(), *arguments); @@ -735,11 +730,13 @@ TIntermAggregate *EmulatePrecision::createRoundingFunctionCallNode(TIntermTyped TIntermSequence *arguments = new TIntermSequence(); arguments->push_back(roundedChild); - TVector parameters; + TVector parameters; TType *paramType = new TType(roundedChild->getType()); paramType->setPrecision(EbpHigh); paramType->setQualifier(EvqIn); - parameters.push_back(TConstParameter(kParamXName, static_cast(paramType))); + parameters.push_back(new TVariable(mSymbolTable, kParamXName, + static_cast(paramType), + SymbolType::AngleInternal)); return TIntermAggregate::CreateRawFunctionCall( *getInternalFunction(*roundFunctionName, roundedChild->getType(), arguments, parameters, @@ -757,19 +754,23 @@ TIntermAggregate *EmulatePrecision::createCompoundAssignmentFunctionCallNode(TIn else strstr << "angle_compound_" << opNameStr << "_frl"; ImmutableString functionName = ImmutableString(strstr.str()); - TIntermSequence *arguments = new TIntermSequence(); + TIntermSequence *arguments = new TIntermSequence(); arguments->push_back(left); arguments->push_back(right); - TVector parameters; + TVector parameters; TType *leftParamType = new TType(left->getType()); leftParamType->setPrecision(EbpHigh); leftParamType->setQualifier(EvqOut); - parameters.push_back(TConstParameter(kParamXName, static_cast(leftParamType))); + parameters.push_back(new TVariable(mSymbolTable, kParamXName, + static_cast(leftParamType), + SymbolType::AngleInternal)); TType *rightParamType = new TType(right->getType()); rightParamType->setPrecision(EbpHigh); rightParamType->setQualifier(EvqIn); - parameters.push_back(TConstParameter(kParamYName, static_cast(rightParamType))); + parameters.push_back(new TVariable(mSymbolTable, kParamYName, + static_cast(rightParamType), + SymbolType::AngleInternal)); return TIntermAggregate::CreateRawFunctionCall( *getInternalFunction(functionName, left->getType(), arguments, parameters, false), diff --git a/gfx/angle/checkout/src/compiler/translator/EmulatePrecision.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h similarity index 88% rename from gfx/angle/checkout/src/compiler/translator/EmulatePrecision.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h index 50108826900e..10501fa1d0b7 100644 --- a/gfx/angle/checkout/src/compiler/translator/EmulatePrecision.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/EmulatePrecision.h @@ -4,14 +4,14 @@ // found in the LICENSE file. // -#ifndef COMPILER_TRANSLATOR_EMULATE_PRECISION_H_ -#define COMPILER_TRANSLATOR_EMULATE_PRECISION_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_EMULATE_PRECISION_H_ +#define COMPILER_TRANSLATOR_TREEOPS_EMULATE_PRECISION_H_ #include "GLSLANG/ShaderLang.h" #include "common/angleutils.h" #include "compiler/translator/Compiler.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" // This class gathers all compound assignments from the AST and can then write // the functions required for their precision emulation. This way there is no @@ -32,7 +32,6 @@ class EmulatePrecision : public TLValueTrackingTraverser bool visitAggregate(Visit visit, TIntermAggregate *node) override; bool visitInvariantDeclaration(Visit visit, TIntermInvariantDeclaration *node) override; bool visitDeclaration(Visit visit, TIntermDeclaration *node) override; - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; void writeEmulationHelpers(TInfoSinkBase &sink, const int shaderVersion, @@ -62,7 +61,7 @@ class EmulatePrecision : public TLValueTrackingTraverser const TFunction *getInternalFunction(const ImmutableString &functionName, const TType &returnType, TIntermSequence *arguments, - const TVector ¶meters, + const TVector ¶meters, bool knownToNotHaveSideEffects); TIntermAggregate *createRoundingFunctionCallNode(TIntermTyped *roundedChild); TIntermAggregate *createCompoundAssignmentFunctionCallNode(TIntermTyped *left, @@ -83,4 +82,4 @@ class EmulatePrecision : public TLValueTrackingTraverser } // namespace sh -#endif // COMPILER_TRANSLATOR_EMULATE_PRECISION_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_EMULATE_PRECISION_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp similarity index 95% rename from gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp index 5015682a6ca9..6c5c49dd403f 100644 --- a/gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp @@ -6,13 +6,13 @@ // Implementation of the integer pow expressions HLSL bug workaround. // See header for more info. -#include "compiler/translator/ExpandIntegerPowExpressions.h" +#include "compiler/translator/tree_ops/ExpandIntegerPowExpressions.h" #include #include -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h index 0074e5d6635c..7ee5adab3cad 100644 --- a/gfx/angle/checkout/src/compiler/translator/ExpandIntegerPowExpressions.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.h @@ -13,8 +13,8 @@ // The workaround is to replace the pow with a series of multiplies. // See http://anglebug.com/851 -#ifndef COMPILER_TRANSLATOR_EXPANDINTEGERPOWEXPRESSIONS_H_ -#define COMPILER_TRANSLATOR_EXPANDINTEGERPOWEXPRESSIONS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_ namespace sh { @@ -26,4 +26,4 @@ void ExpandIntegerPowExpressions(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_EXPANDINTEGERPOWEXPRESSIONS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_EXPANDINTEGERPOWEXPRESSIONS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/FoldExpressions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/FoldExpressions.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp index 71e04d0eee3a..e17bc9ed75ac 100644 --- a/gfx/angle/checkout/src/compiler/translator/FoldExpressions.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp @@ -10,11 +10,11 @@ // 2. Sequence aka comma ops where the left side has no side effects. // 3. Any expressions containing any of the above. -#include "compiler/translator/FoldExpressions.h" +#include "compiler/translator/tree_ops/FoldExpressions.h" #include "compiler/translator/Diagnostics.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/FoldExpressions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h similarity index 79% rename from gfx/angle/checkout/src/compiler/translator/FoldExpressions.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h index 357547abb560..42d026afb851 100644 --- a/gfx/angle/checkout/src/compiler/translator/FoldExpressions.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/FoldExpressions.h @@ -8,8 +8,8 @@ // parsing and validation of qualifiers is complete. Expressions that are folded: 1. Ternary ops // with a constant condition. -#ifndef COMPILER_TRANSLATOR_FOLDEXPRESSIONS_H_ -#define COMPILER_TRANSLATOR_FOLDEXPRESSIONS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_ namespace sh { @@ -21,4 +21,4 @@ void FoldExpressions(TIntermBlock *root, TDiagnostics *diagnostics); } // namespace sh -#endif // COMPILER_TRANSLATOR_FOLDEXPRESSIONS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_FOLDEXPRESSIONS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/InitializeVariables.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp similarity index 97% rename from gfx/angle/checkout/src/compiler/translator/InitializeVariables.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp index 97cf5a0cc534..8714d377a7b5 100644 --- a/gfx/angle/checkout/src/compiler/translator/InitializeVariables.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp @@ -4,15 +4,15 @@ // found in the LICENSE file. // -#include "compiler/translator/InitializeVariables.h" +#include "compiler/translator/tree_ops/InitializeVariables.h" #include "angle_gl.h" #include "common/debug.h" -#include "compiler/translator/FindMain.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/FindMain.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include "compiler/translator/util.h" namespace sh @@ -114,7 +114,8 @@ void AddArrayZeroInitForLoop(const TIntermTyped *initializedNode, TIntermConstantUnion *arraySizeNode = CreateIndexNode(initializedNode->getOutermostArraySize()); TIntermBinary *indexSmallerThanSize = new TIntermBinary(EOpLessThan, indexSymbolNode->deepCopy(), arraySizeNode); - TIntermUnary *indexIncrement = new TIntermUnary(EOpPreIncrement, indexSymbolNode->deepCopy()); + TIntermUnary *indexIncrement = + new TIntermUnary(EOpPreIncrement, indexSymbolNode->deepCopy(), nullptr); TIntermBlock *forLoopBody = new TIntermBlock(); TIntermSequence *forLoopBodySeq = forLoopBody->getSequence(); diff --git a/gfx/angle/checkout/src/compiler/translator/InitializeVariables.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h similarity index 93% rename from gfx/angle/checkout/src/compiler/translator/InitializeVariables.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h index f9a83f183d60..06695f93c915 100644 --- a/gfx/angle/checkout/src/compiler/translator/InitializeVariables.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/InitializeVariables.h @@ -4,8 +4,8 @@ // found in the LICENSE file. // -#ifndef COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_ -#define COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_ +#define COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_ #include @@ -53,4 +53,4 @@ void InitializeVariables(TIntermBlock *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_INITIALIZEVARIABLES_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_INITIALIZEVARIABLES_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp new file mode 100644 index 000000000000..8249dd8f2538 --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp @@ -0,0 +1,129 @@ +// +// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// PruneEmptyCases.cpp: The PruneEmptyCases function prunes cases that are followed by nothing from +// the AST. + +#include "compiler/translator/tree_ops/PruneEmptyCases.h" + +#include "compiler/translator/Symbol.h" +#include "compiler/translator/tree_util/IntermTraverse.h" + +namespace sh +{ + +namespace +{ + +bool AreEmptyBlocks(TIntermSequence *statements); + +bool IsEmptyBlock(TIntermNode *node) +{ + TIntermBlock *asBlock = node->getAsBlock(); + if (asBlock) + { + return AreEmptyBlocks(asBlock->getSequence()); + } + // Empty declarations should have already been pruned, otherwise they would need to be handled + // here. Note that declarations for struct types do contain a nameless child node. + ASSERT(node->getAsDeclarationNode() == nullptr || + !node->getAsDeclarationNode()->getSequence()->empty()); + // Pure literal statements should also already be pruned. + ASSERT(node->getAsConstantUnion() == nullptr); + return false; +} + +// Return true if all statements in "statements" consist only of empty blocks and no-op statements. +// Returns true also if there are no statements. +bool AreEmptyBlocks(TIntermSequence *statements) +{ + for (size_t i = 0u; i < statements->size(); ++i) + { + if (!IsEmptyBlock(statements->at(i))) + { + return false; + } + } + return true; +} + +class PruneEmptyCasesTraverser : private TIntermTraverser +{ + public: + static void apply(TIntermBlock *root); + + private: + PruneEmptyCasesTraverser(); + bool visitSwitch(Visit visit, TIntermSwitch *node) override; +}; + +void PruneEmptyCasesTraverser::apply(TIntermBlock *root) +{ + PruneEmptyCasesTraverser prune; + root->traverse(&prune); + prune.updateTree(); +} + +PruneEmptyCasesTraverser::PruneEmptyCasesTraverser() : TIntermTraverser(true, false, false) +{ +} + +bool PruneEmptyCasesTraverser::visitSwitch(Visit visit, TIntermSwitch *node) +{ + // This may mutate the statementList, but that's okay, since traversal has not yet reached + // there. + TIntermBlock *statementList = node->getStatementList(); + TIntermSequence *statements = statementList->getSequence(); + + // Iterate block children in reverse order. Cases that are only followed by other cases or empty + // blocks are marked for pruning. + size_t i = statements->size(); + size_t lastNoOpInStatementList = i; + while (i > 0) + { + --i; + TIntermNode *statement = statements->at(i); + if (statement->getAsCaseNode() || IsEmptyBlock(statement)) + { + lastNoOpInStatementList = i; + } + else + { + break; + } + } + if (lastNoOpInStatementList == 0) + { + // Remove the entire switch statement, extracting the init expression if needed. + TIntermTyped *init = node->getInit(); + if (init->hasSideEffects()) + { + queueReplacement(init, OriginalNode::IS_DROPPED); + } + else + { + TIntermSequence emptyReplacement; + ASSERT(getParentNode()->getAsBlock()); + mMultiReplacements.push_back(NodeReplaceWithMultipleEntry(getParentNode()->getAsBlock(), + node, emptyReplacement)); + } + return false; + } + if (lastNoOpInStatementList < statements->size()) + { + statements->erase(statements->begin() + lastNoOpInStatementList, statements->end()); + } + + return true; +} + +} // namespace + +void PruneEmptyCases(TIntermBlock *root) +{ + PruneEmptyCasesTraverser::apply(root); +} + +} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h new file mode 100644 index 000000000000..0b88ac181c25 --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneEmptyCases.h @@ -0,0 +1,19 @@ +// +// Copyright (c) 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// PruneEmptyCases.h: The PruneEmptyCases function prunes cases that are followed by nothing from +// the AST. + +#ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_ +#define COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_ + +namespace sh +{ +class TIntermBlock; + +void PruneEmptyCases(TIntermBlock *root); +} // namespace sh + +#endif // COMPILER_TRANSLATOR_TREEOPS_PRUNEEMPTYCASES_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/PruneNoOps.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp similarity index 98% rename from gfx/angle/checkout/src/compiler/translator/PruneNoOps.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp index ebba6faf7b1b..9e80c382187b 100644 --- a/gfx/angle/checkout/src/compiler/translator/PruneNoOps.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp @@ -11,10 +11,10 @@ // 2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float, // so float literal statements would end up with no precision which is invalid ESSL. -#include "compiler/translator/PruneNoOps.h" +#include "compiler/translator/tree_ops/PruneNoOps.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/Symbol.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/PruneNoOps.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h similarity index 82% rename from gfx/angle/checkout/src/compiler/translator/PruneNoOps.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h index 5f1b3d1a348a..571340ace905 100644 --- a/gfx/angle/checkout/src/compiler/translator/PruneNoOps.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/PruneNoOps.h @@ -11,8 +11,8 @@ // 2. Literal statements: "1.0;". The ESSL output doesn't define a default precision for float, // so float literal statements would end up with no precision which is invalid ESSL. -#ifndef COMPILER_TRANSLATOR_PRUNENOOPS_H_ -#define COMPILER_TRANSLATOR_PRUNENOOPS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_ namespace sh { @@ -22,4 +22,4 @@ class TSymbolTable; void PruneNoOps(TIntermBlock *root, TSymbolTable *symbolTable); } -#endif // COMPILER_TRANSLATOR_PRUNENOOPS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_PRUNENOOPS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp index 19b93e3d9777..0dd57c350f74 100644 --- a/gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp @@ -14,11 +14,11 @@ // in case that is required for correct precision propagation. // -#include "compiler/translator/RecordConstantPrecision.h" +#include "compiler/translator/tree_ops/RecordConstantPrecision.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -36,6 +36,7 @@ class RecordConstantPrecisionTraverser : public TIntermTraverser void nextIteration(); bool foundHigherPrecisionConstant() const { return mFoundHigherPrecisionConstant; } + protected: bool operandAffectsParentOperationPrecision(TIntermTyped *operand); diff --git a/gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h similarity index 84% rename from gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h index f86c2a869393..5b15db5e48fa 100644 --- a/gfx/angle/checkout/src/compiler/translator/RecordConstantPrecision.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.h @@ -14,8 +14,8 @@ // in case that is required for correct precision propagation. // -#ifndef COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ -#define COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_ +#define COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_ namespace sh { @@ -25,4 +25,4 @@ class TSymbolTable; void RecordConstantPrecision(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_RECORDCONSTANTPRECISION_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_RECORDCONSTANTPRECISION_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp similarity index 97% rename from gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp index 536f5211fb35..dd700246db27 100644 --- a/gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp @@ -4,7 +4,7 @@ // found in the LICENSE file. // -#include "compiler/translator/RegenerateStructNames.h" +#include "compiler/translator/tree_ops/RegenerateStructNames.h" #include "common/debug.h" #include "compiler/translator/ImmutableStringBuilder.h" diff --git a/gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h similarity index 77% rename from gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h index cce9bc05a547..13b323a33c41 100644 --- a/gfx/angle/checkout/src/compiler/translator/RegenerateStructNames.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RegenerateStructNames.h @@ -4,11 +4,11 @@ // found in the LICENSE file. // -#ifndef COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ -#define COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_ -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include @@ -38,4 +38,4 @@ class RegenerateStructNames : public TIntermTraverser } // namespace sh -#endif // COMPILER_TRANSLATOR_REGENERATESTRUCTNAMES_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REGENERATESTRUCTNAMES_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp similarity index 95% rename from gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp index e9e6a1701311..473159f89c6c 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp @@ -19,10 +19,10 @@ // // Does nothing to length method calls done on runtime-sized arrays. -#include "compiler/translator/RemoveArrayLengthMethod.h" +#include "compiler/translator/tree_ops/RemoveArrayLengthMethod.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h similarity index 81% rename from gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h index 3b2c6df8242c..637682874987 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveArrayLengthMethod.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.h @@ -19,6 +19,9 @@ // // Does nothing to length method calls done on runtime-sized arrays. +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_ + namespace sh { @@ -27,3 +30,5 @@ class TIntermBlock; void RemoveArrayLengthMethod(TIntermBlock *root); } // namespace sh + +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEARRAYLENGTHMETHOD_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp similarity index 92% rename from gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp index 2b77ab390cc1..61f6860880ff 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp @@ -7,15 +7,15 @@ // replacing them with calls to functions that choose which component to return or write. // -#include "compiler/translator/RemoveDynamicIndexing.h" +#include "compiler/translator/tree_ops/RemoveDynamicIndexing.h" #include "compiler/translator/Diagnostics.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -65,13 +65,6 @@ std::string GetIndexFunctionName(const TType &type, bool write) return nameSink.str(); } -TIntermSymbol *CreateParameterSymbol(const TConstParameter ¶meter, TSymbolTable *symbolTable) -{ - TVariable *variable = - new TVariable(symbolTable, parameter.name, parameter.type, SymbolType::AngleInternal); - return new TIntermSymbol(variable); -} - TIntermConstantUnion *CreateIntConstantNode(int i) { TConstantUnion *constant = new TConstantUnion(); @@ -167,7 +160,7 @@ TIntermFunctionDefinition *GetIndexFunctionDefinition(const TType &type, { ASSERT(!type.isArray()); - int numCases = 0; + int numCases = 0; if (type.isMatrix()) { numCases = type.getCols(); @@ -180,15 +173,12 @@ TIntermFunctionDefinition *GetIndexFunctionDefinition(const TType &type, std::string functionName = GetIndexFunctionName(type, write); TIntermFunctionPrototype *prototypeNode = CreateInternalFunctionPrototypeNode(func); - TIntermSymbol *baseParam = CreateParameterSymbol(func.getParam(0), symbolTable); - prototypeNode->getSequence()->push_back(baseParam); - TIntermSymbol *indexParam = CreateParameterSymbol(func.getParam(1), symbolTable); - prototypeNode->getSequence()->push_back(indexParam); + TIntermSymbol *baseParam = new TIntermSymbol(func.getParam(0)); + TIntermSymbol *indexParam = new TIntermSymbol(func.getParam(1)); TIntermSymbol *valueParam = nullptr; if (write) { - valueParam = CreateParameterSymbol(func.getParam(2), symbolTable); - prototypeNode->getSequence()->push_back(valueParam); + valueParam = new TIntermSymbol(func.getParam(2)); } TIntermBlock *statementList = new TIntermBlock(); @@ -408,9 +398,10 @@ bool RemoveDynamicIndexingTraverser::visitBinary(Visit visit, TIntermBinary *nod indexingFunction = new TFunction(mSymbolTable, indexingFunctionName, SymbolType::AngleInternal, GetFieldType(type), true); + indexingFunction->addParameter(new TVariable( + mSymbolTable, kBaseName, GetBaseType(type, false), SymbolType::AngleInternal)); indexingFunction->addParameter( - TConstParameter(kBaseName, GetBaseType(type, false))); - indexingFunction->addParameter(TConstParameter(kIndexName, kIndexType)); + new TVariable(mSymbolTable, kIndexName, kIndexType, SymbolType::AngleInternal)); mIndexedVecAndMatrixTypes[type] = indexingFunction; } else @@ -458,13 +449,16 @@ bool RemoveDynamicIndexingTraverser::visitBinary(Visit visit, TIntermBinary *nod indexedWriteFunction = new TFunction(mSymbolTable, functionName, SymbolType::AngleInternal, StaticType::GetBasic(), false); - indexedWriteFunction->addParameter( - TConstParameter(kBaseName, GetBaseType(type, true))); - indexedWriteFunction->addParameter(TConstParameter(kIndexName, kIndexType)); + indexedWriteFunction->addParameter(new TVariable(mSymbolTable, kBaseName, + GetBaseType(type, true), + SymbolType::AngleInternal)); + indexedWriteFunction->addParameter(new TVariable( + mSymbolTable, kIndexName, kIndexType, SymbolType::AngleInternal)); TType *valueType = GetFieldType(type); valueType->setQualifier(EvqIn); - indexedWriteFunction->addParameter( - TConstParameter(kValueName, static_cast(valueType))); + indexedWriteFunction->addParameter(new TVariable( + mSymbolTable, kValueName, static_cast(valueType), + SymbolType::AngleInternal)); mWrittenVecAndMatrixTypes[type] = indexedWriteFunction; } else @@ -477,7 +471,7 @@ bool RemoveDynamicIndexingTraverser::visitBinary(Visit visit, TIntermBinary *nod // Store the index in a temporary signed int variable. // s0 = index_expr; - TIntermTyped *indexInitializer = EnsureSignedInt(node->getRight()); + TIntermTyped *indexInitializer = EnsureSignedInt(node->getRight()); TIntermDeclaration *indexVariableDeclaration = nullptr; TVariable *indexVariable = DeclareTempVariable( mSymbolTable, indexInitializer, EvqTemporary, &indexVariableDeclaration); diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h similarity index 77% rename from gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h index 33654700f357..93343c00058e 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveDynamicIndexing.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.h @@ -7,8 +7,8 @@ // replacing them with calls to functions that choose which component to return or write. // -#ifndef COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ -#define COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_ namespace sh { @@ -23,4 +23,4 @@ void RemoveDynamicIndexing(TIntermNode *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_REMOVEDYNAMICINDEXING_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEDYNAMICINDEXING_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp similarity index 89% rename from gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp index 4b533dc7b568..e40fe9592990 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp @@ -4,9 +4,9 @@ // found in the LICENSE file. // -#include "compiler/translator/RemoveInvariantDeclaration.h" +#include "compiler/translator/tree_ops/RemoveInvariantDeclaration.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h similarity index 59% rename from gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h index cf9d4aa4c278..3281014ad076 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveInvariantDeclaration.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.h @@ -4,8 +4,8 @@ // found in the LICENSE file. // -#ifndef COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_ -#define COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEINVARIANTDECLARATION_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVEINVARIANTDECLARATION_H_ class TIntermNode; namespace sh @@ -15,4 +15,4 @@ void RemoveInvariantDeclaration(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_REMOVEINVARIANTDECLARATION_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEINVARIANTDECLARATION_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemovePow.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp similarity index 73% rename from gfx/angle/checkout/src/compiler/translator/RemovePow.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp index b2cdac55f002..7cc5f491a043 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemovePow.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.cpp @@ -8,10 +8,11 @@ // OpenGL drivers. // -#include "compiler/translator/RemovePow.h" +#include "compiler/translator/tree_ops/RemovePow.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -34,7 +35,7 @@ bool IsProblematicPow(TIntermTyped *node) class RemovePowTraverser : public TIntermTraverser { public: - RemovePowTraverser(); + RemovePowTraverser(TSymbolTable *symbolTable); bool visitAggregate(Visit visit, TIntermAggregate *node) override; @@ -45,8 +46,8 @@ class RemovePowTraverser : public TIntermTraverser bool mNeedAnotherIteration; }; -RemovePowTraverser::RemovePowTraverser() - : TIntermTraverser(true, false, false), mNeedAnotherIteration(false) +RemovePowTraverser::RemovePowTraverser(TSymbolTable *symbolTable) + : TIntermTraverser(true, false, false, symbolTable), mNeedAnotherIteration(false) { } @@ -57,14 +58,18 @@ bool RemovePowTraverser::visitAggregate(Visit visit, TIntermAggregate *node) TIntermTyped *x = node->getSequence()->at(0)->getAsTyped(); TIntermTyped *y = node->getSequence()->at(1)->getAsTyped(); - TIntermUnary *log = new TIntermUnary(EOpLog2, x); + TIntermSequence *logArgs = new TIntermSequence(); + logArgs->push_back(x); + TIntermTyped *log = CreateBuiltInFunctionCallNode("log2", logArgs, *mSymbolTable, 100); log->setLine(node->getLine()); TOperator op = TIntermBinary::GetMulOpBasedOnOperands(y->getType(), log->getType()); TIntermBinary *mul = new TIntermBinary(op, y, log); mul->setLine(node->getLine()); - TIntermUnary *exp = new TIntermUnary(EOpExp2, mul); + TIntermSequence *expArgs = new TIntermSequence(); + expArgs->push_back(mul); + TIntermTyped *exp = CreateBuiltInFunctionCallNode("exp2", expArgs, *mSymbolTable, 100); exp->setLine(node->getLine()); queueReplacement(exp, OriginalNode::IS_DROPPED); @@ -82,9 +87,9 @@ bool RemovePowTraverser::visitAggregate(Visit visit, TIntermAggregate *node) } // namespace -void RemovePow(TIntermNode *root) +void RemovePow(TIntermNode *root, TSymbolTable *symbolTable) { - RemovePowTraverser traverser; + RemovePowTraverser traverser(symbolTable); // Iterate as necessary, and reset the traverser between iterations. do { diff --git a/gfx/angle/checkout/src/compiler/translator/RemovePow.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h similarity index 64% rename from gfx/angle/checkout/src/compiler/translator/RemovePow.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h index 3cd84988a99d..bb0e990656c0 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemovePow.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemovePow.h @@ -8,14 +8,15 @@ // OpenGL drivers. // -#ifndef COMPILER_TRANSLATOR_REMOVEPOW_H_ -#define COMPILER_TRANSLATOR_REMOVEPOW_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_ namespace sh { class TIntermNode; +class TSymbolTable; -void RemovePow(TIntermNode *root); +void RemovePow(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_REMOVEPOW_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEPOW_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp similarity index 98% rename from gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp index dea949f44845..9af46770f863 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp @@ -8,10 +8,10 @@ // by this function. It leaves duplicate nodes in the AST making replacements // unreliable. -#include "compiler/translator/RemoveSwitchFallThrough.h" +#include "compiler/translator/tree_ops/RemoveSwitchFallThrough.h" #include "compiler/translator/Diagnostics.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h similarity index 80% rename from gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h index 7a3b1963f254..58cad0c85675 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveSwitchFallThrough.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.h @@ -8,8 +8,8 @@ // by this function. It leaves duplicate nodes in the AST making replacements // unreliable. -#ifndef COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_ -#define COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_ namespace sh { @@ -24,4 +24,4 @@ TIntermBlock *RemoveSwitchFallThrough(TIntermBlock *statementList, } // namespace sh -#endif // COMPILER_TRANSLATOR_REMOVESWITCHFALLTHROUGH_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVESWITCHFALLTHROUGH_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp index 6445eb85bfcb..2a14e0f80972 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp @@ -8,10 +8,10 @@ // initialization code for them. Also removes unreferenced struct types. // -#include "compiler/translator/RemoveUnreferencedVariables.h" +#include "compiler/translator/tree_ops/RemoveUnreferencedVariables.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -30,7 +30,7 @@ class CollectVariableRefCountsTraverser : public TIntermTraverser void visitSymbol(TIntermSymbol *node) override; bool visitAggregate(Visit visit, TIntermAggregate *node) override; - bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) override; + void visitFunctionPrototype(TIntermFunctionPrototype *node) override; private: void incrementStructTypeRefCount(const TType &type); @@ -108,11 +108,14 @@ bool CollectVariableRefCountsTraverser::visitAggregate(Visit visit, TIntermAggre return true; } -bool CollectVariableRefCountsTraverser::visitFunctionPrototype(Visit visit, - TIntermFunctionPrototype *node) +void CollectVariableRefCountsTraverser::visitFunctionPrototype(TIntermFunctionPrototype *node) { incrementStructTypeRefCount(node->getType()); - return true; + size_t paramCount = node->getFunction()->getParamCount(); + for (size_t i = 0; i < paramCount; ++i) + { + incrementStructTypeRefCount(node->getFunction()->getParam(i)->getType()); + } } // Traverser that removes all unreferenced variables on one traversal. diff --git a/gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h similarity index 73% rename from gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h index 39c8327776e4..6888b2f2a0bf 100644 --- a/gfx/angle/checkout/src/compiler/translator/RemoveUnreferencedVariables.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.h @@ -8,8 +8,8 @@ // initialization code for them. Also removes unreferenced struct types. // -#ifndef COMPILER_TRANSLATOR_REMOVEUNREFERENCEDVARIABLES_H_ -#define COMPILER_TRANSLATOR_REMOVEUNREFERENCEDVARIABLES_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_ namespace sh { @@ -21,4 +21,4 @@ void RemoveUnreferencedVariables(TIntermBlock *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_REMOVEUNREFERENCEDVARIABLES_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REMOVEUNREFERENCEDVARIABLES_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp index aab608f17f37..ed3e4ab9e82d 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp @@ -7,11 +7,11 @@ // RewriteDoWhile.cpp: rewrites do-while loops using another equivalent // construct. -#include "compiler/translator/RewriteDoWhile.h" +#include "compiler/translator/tree_ops/RewriteDoWhile.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -96,7 +96,7 @@ class DoWhileRewriter : public TIntermTraverser breakBlock->getSequence()->push_back(breakStatement); TIntermUnary *negatedCondition = - new TIntermUnary(EOpLogicalNot, loop->getCondition()); + new TIntermUnary(EOpLogicalNot, loop->getCondition(), nullptr); TIntermIfElse *innerIf = new TIntermIfElse(negatedCondition, breakBlock, nullptr); diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h similarity index 71% rename from gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h index e83bfc4b568c..c91d7deb0623 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteDoWhile.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteDoWhile.h @@ -7,8 +7,8 @@ // RewriteDoWhile.h: rewrite do-while loops as while loops to work around // driver bugs -#ifndef COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ -#define COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_ namespace sh { @@ -20,4 +20,4 @@ void RewriteDoWhile(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_REWRITEDOWHILE_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEDOWHILE_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp similarity index 91% rename from gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp index a4e22cf38370..17af50c9c4a9 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp @@ -7,12 +7,12 @@ // all if-else blocks to if-if blocks. // -#include "compiler/translator/RewriteElseBlocks.h" +#include "compiler/translator/tree_ops/RewriteElseBlocks.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/NodeSearch.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/NodeSearch.h" namespace sh { @@ -87,12 +87,13 @@ TIntermNode *ElseBlockRewriter::rewriteIfElse(TIntermIfElse *ifElse) if (mFunctionType && mFunctionType->getBasicType() != EbtVoid) { TIntermNode *returnNode = new TIntermBranch(EOpReturn, CreateZeroNode(*mFunctionType)); - negatedElse = new TIntermBlock(); + negatedElse = new TIntermBlock(); negatedElse->appendStatement(returnNode); } TIntermSymbol *conditionSymbolElse = CreateTempSymbolNode(conditionVariable); - TIntermUnary *negatedCondition = new TIntermUnary(EOpLogicalNot, conditionSymbolElse); + TIntermUnary *negatedCondition = + new TIntermUnary(EOpLogicalNot, conditionSymbolElse, nullptr); TIntermIfElse *falseIfElse = new TIntermIfElse(negatedCondition, ifElse->getFalseBlock(), negatedElse); falseBlock = EnsureBlock(falseIfElse); diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h similarity index 70% rename from gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h index 2586b5405c44..9297311731a9 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteElseBlocks.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.h @@ -7,8 +7,8 @@ // all if-else blocks to if-if blocks. // -#ifndef COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ -#define COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_ namespace sh { @@ -19,4 +19,4 @@ class TSymbolTable; void RewriteElseBlocks(TIntermNode *node, TSymbolTable *symbolTable); } -#endif // COMPILER_TRANSLATOR_REWRITEELSEBLOCKS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEELSEBLOCKS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp similarity index 95% rename from gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp index b93d9a13d408..f57e5dff3012 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp @@ -6,12 +6,12 @@ // Implementation of texelFetchOffset translation issue workaround. // See header for more info. -#include "compiler/translator/RewriteTexelFetchOffset.h" +#include "compiler/translator/tree_ops/RewriteTexelFetchOffset.h" #include "common/angleutils.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h index 694d709f8e67..45e224dd620a 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteTexelFetchOffset.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.h @@ -12,8 +12,8 @@ // // See http://anglebug.com/1469 -#ifndef COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ -#define COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_ class TIntermNode; class TSymbolTable; @@ -25,4 +25,4 @@ void RewriteTexelFetchOffset(TIntermNode *root, const TSymbolTable &symbolTable, } // namespace sh -#endif // COMPILER_TRANSLATOR_REWRITE_TEXELFETCHOFFSET_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITE_TEXELFETCHOFFSET_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp similarity index 90% rename from gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp index 696a49536c1b..c75fd33f248e 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp @@ -4,10 +4,10 @@ // found in the LICENSE file. // -#include "compiler/translator/RewriteUnaryMinusOperatorFloat.h" +#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h similarity index 65% rename from gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h index ccbfbcbd9e51..2df592a77590 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.h @@ -5,8 +5,8 @@ // Rewrite "-float" to "0.0 - float" to work around unary minus operator on float issue on Intel Mac // OSX 10.11. -#ifndef COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORFLOAT_H_ -#define COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORFLOAT_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_ class TIntermNode; namespace sh @@ -16,4 +16,4 @@ void RewriteUnaryMinusOperatorFloat(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORFLOAT_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORFLOAT_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp similarity index 93% rename from gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp index 7b2fdf210fff..a7cb491798b3 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp @@ -6,9 +6,9 @@ // Implementation of evaluating unary integer variable bug workaround. // See header for more info. -#include "compiler/translator/RewriteUnaryMinusOperatorInt.h" +#include "compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -75,7 +75,7 @@ bool Traverser::visitUnary(Visit visit, TIntermUnary *node) // Potential problem case detected, apply workaround: -(int) -> ~(int) + 1. // ~(int) - TIntermUnary *bitwiseNot = new TIntermUnary(EOpBitwiseNot, opr); + TIntermUnary *bitwiseNot = new TIntermUnary(EOpBitwiseNot, opr, nullptr); bitwiseNot->setLine(opr->getLine()); // Constant 1 (or 1u) @@ -109,4 +109,4 @@ void RewriteUnaryMinusOperatorInt(TIntermNode *root) Traverser::Apply(root); } -} // namespace sh \ No newline at end of file +} // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h similarity index 70% rename from gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h index 50f0c442a733..66192179c414 100644 --- a/gfx/angle/checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.h @@ -6,8 +6,8 @@ // integer variable on Intel D3D driver. It works by rewriting -(int) to // ~(int) + 1 when evaluating unary integer variables. -#ifndef COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ -#define COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_ +#define COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_ class TIntermNode; namespace sh @@ -17,4 +17,4 @@ void RewriteUnaryMinusOperatorInt(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_REWRITEUNARYMINUSOPERATORINT_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEOPS_REWRITEUNARYMINUSOPERATORINT_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp similarity index 95% rename from gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp index 21edb70640c6..2fab729f84ad 100644 --- a/gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp @@ -8,16 +8,16 @@ // driver bugs around vector and matrix constructors. // +#include "compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h" #include "common/debug.h" -#include "compiler/translator/ScalarizeVecAndMatConstructorArgs.h" #include #include "angle_gl.h" #include "common/angleutils.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -206,7 +206,7 @@ TVariable *ScalarizeArgsTraverser::createTempVariable(TIntermTyped *original) TVariable *variable = CreateTempVariable(mSymbolTable, type); ASSERT(mBlockStack.size() > 0); - TIntermSequence &sequence = mBlockStack.back(); + TIntermSequence &sequence = mBlockStack.back(); TIntermDeclaration *declaration = CreateTempInitDeclarationNode(variable, original); sequence.push_back(declaration); diff --git a/gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h index b8f782d1ecac..e66908de1d9e 100644 --- a/gfx/angle/checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.h @@ -8,8 +8,8 @@ // driver bugs around vector and matrix constructors. // -#ifndef COMPILER_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ -#define COMPILER_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ #include "GLSLANG/ShaderLang.h" @@ -24,4 +24,4 @@ void ScalarizeVecAndMatConstructorArgs(TIntermBlock *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SCALARIZEVECANDMATCONSTRUCTORARGS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp index a98b7276ddfb..98150ce999fa 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp @@ -9,9 +9,9 @@ // Will be changed to: // i++; -#include "compiler/translator/SeparateArrayConstructorStatements.h" +#include "compiler/translator/tree_ops/SeparateArrayConstructorStatements.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h similarity index 69% rename from gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h index 0db93b11dcfe..740ba95aca37 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateArrayConstructorStatements.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.h @@ -9,8 +9,8 @@ // Will be changed to: // i++; -#ifndef COMPILER_TRANSLATOR_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ -#define COMPILER_TRANSLATOR_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ namespace sh { @@ -19,4 +19,4 @@ class TIntermBlock; void SeparateArrayConstructorStatements(TIntermBlock *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYCONSTRUCTORSTATEMENTS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp similarity index 97% rename from gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp index e1026cb4fd34..ee1d91b14a28 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp @@ -16,7 +16,7 @@ // stages don't care about const qualifiers. However, the initialization will not be split if the // initializer can be written as a HLSL literal. -#include "compiler/translator/SeparateArrayInitialization.h" +#include "compiler/translator/tree_ops/SeparateArrayInitialization.h" #include "compiler/translator/IntermNode.h" #include "compiler/translator/OutputHLSL.h" diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h similarity index 81% rename from gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h index 3a9bb55dd12e..a197ff5a86a3 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateArrayInitialization.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.h @@ -16,8 +16,8 @@ // stages don't care about const qualifiers. However, the initialization will not be split if the // initializer can be written as a HLSL literal. -#ifndef COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ -#define COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_ namespace sh { @@ -26,4 +26,4 @@ class TIntermNode; void SeparateArrayInitialization(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_SEPARATEARRAYINITIALIZATION_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEARRAYINITIALIZATION_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp index 9a066075c04f..c2414195a718 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp @@ -13,9 +13,9 @@ // int a[1] = int[1](1); // int b[1] = int[1](2); -#include "compiler/translator/SeparateDeclarations.h" +#include "compiler/translator/tree_ops/SeparateDeclarations.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h similarity index 80% rename from gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h index 8142faea1cc8..1e7f967be92c 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateDeclarations.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateDeclarations.h @@ -13,8 +13,8 @@ // int a[1] = int[1](1); // int b[1] = int[1](2); -#ifndef COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ -#define COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_ namespace sh { @@ -23,4 +23,4 @@ class TIntermNode; void SeparateDeclarations(TIntermNode *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_SEPARATEDECLARATIONS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEDECLARATIONS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp index 4f78a4a9578f..42f2166ca78e 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp @@ -9,11 +9,11 @@ // (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2; // type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i]; -#include "compiler/translator/SeparateExpressionsReturningArrays.h" +#include "compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h similarity index 76% rename from gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h index f8eb43874882..9b09f7c61eb2 100644 --- a/gfx/angle/checkout/src/compiler/translator/SeparateExpressionsReturningArrays.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.h @@ -9,8 +9,8 @@ // (a = b) == (a = c) is split into a = b; type[n] a1 = a; a = c; type[n] a2 = a; a1 == a2; // type d = type[n](...)[i]; is split into type[n] a1 = type[n](...); type d = a1[i]; -#ifndef COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ -#define COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ namespace sh { @@ -20,4 +20,4 @@ class TSymbolTable; void SeparateExpressionsReturningArrays(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SEPARATEEXPRESSIONSRETURNINGARRAYS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp similarity index 97% rename from gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp index 37d7b0effbfa..751975a50a26 100644 --- a/gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp @@ -8,12 +8,12 @@ // from loop conditions and loop expressions work correctly. // -#include "compiler/translator/SimplifyLoopConditions.h" +#include "compiler/translator/tree_ops/SimplifyLoopConditions.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h index 367487d4b108..15265bb5775e 100644 --- a/gfx/angle/checkout/src/compiler/translator/SimplifyLoopConditions.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.h @@ -8,8 +8,8 @@ // from loop conditions and loop expressions work correctly. // -#ifndef COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_ -#define COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_ namespace sh { @@ -21,4 +21,4 @@ void SimplifyLoopConditions(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_SIMPLIFYLOOPCONDITIONS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SIMPLIFYLOOPCONDITIONS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp similarity index 96% rename from gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp index 62da2ac3f96f..c22c85ef7f19 100644 --- a/gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp @@ -9,10 +9,10 @@ // evaluated before the latter parts of the sequence operator expression are evaluated. // -#include "compiler/translator/SplitSequenceOperator.h" +#include "compiler/translator/tree_ops/SplitSequenceOperator.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h similarity index 79% rename from gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h index fb9d5518ff93..fc341c968e6d 100644 --- a/gfx/angle/checkout/src/compiler/translator/SplitSequenceOperator.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.h @@ -9,8 +9,8 @@ // evaluated before the latter parts of the sequence operator expression are evaluated. // -#ifndef COMPILER_TRANSLATOR_SPLITSEQUENCEOPERATOR_H_ -#define COMPILER_TRANSLATOR_SPLITSEQUENCEOPERATOR_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_ +#define COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_ namespace sh { @@ -22,4 +22,4 @@ void SplitSequenceOperator(TIntermNode *root, int patternsToSplitMask, TSymbolTa } // namespace sh -#endif // COMPILER_TRANSLATOR_SPLITSEQUENCEOPERATOR_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_SPLITSEQUENCEOPERATOR_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp similarity index 90% rename from gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp index 3108bfe0f653..e408714fdeb1 100644 --- a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp @@ -4,11 +4,11 @@ // found in the LICENSE file. // -#include "compiler/translator/UnfoldShortCircuitAST.h" +#include "compiler/translator/tree_ops/UnfoldShortCircuitAST.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h similarity index 68% rename from gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h index 582df0211e3a..7f492a9ca06e 100644 --- a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitAST.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.h @@ -7,8 +7,8 @@ // operations with ternary operations. // -#ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ -#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_ +#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_ namespace sh { @@ -19,4 +19,4 @@ void UnfoldShortCircuitAST(TIntermBlock *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUITAST_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUITAST_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp index c8c56de2873d..3ed597c400c9 100644 --- a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp @@ -9,12 +9,12 @@ // the original expression. // -#include "compiler/translator/UnfoldShortCircuitToIf.h" +#include "compiler/translator/tree_ops/UnfoldShortCircuitToIf.h" -#include "compiler/translator/IntermNodePatternMatcher.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -88,7 +88,7 @@ bool UnfoldShortCircuitTraverser::visitBinary(Visit visit, TIntermBinary *node) CreateTempAssignmentNode(resultVariable, node->getRight())); TIntermUnary *notTempSymbol = - new TIntermUnary(EOpLogicalNot, CreateTempSymbolNode(resultVariable)); + new TIntermUnary(EOpLogicalNot, CreateTempSymbolNode(resultVariable), nullptr); TIntermIfElse *ifNode = new TIntermIfElse(notTempSymbol, assignRightBlock, nullptr); insertions.push_back(ifNode); @@ -149,12 +149,12 @@ bool UnfoldShortCircuitTraverser::visitTernary(Visit visit, TIntermTernary *node EvqTemporary, &tempDeclaration); insertions.push_back(tempDeclaration); - TIntermBlock *trueBlock = new TIntermBlock(); + TIntermBlock *trueBlock = new TIntermBlock(); TIntermBinary *trueAssignment = CreateTempAssignmentNode(resultVariable, node->getTrueExpression()); trueBlock->getSequence()->push_back(trueAssignment); - TIntermBlock *falseBlock = new TIntermBlock(); + TIntermBlock *falseBlock = new TIntermBlock(); TIntermBinary *falseAssignment = CreateTempAssignmentNode(resultVariable, node->getFalseExpression()); falseBlock->getSequence()->push_back(falseAssignment); diff --git a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h similarity index 76% rename from gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h index 37dd83a8cfa0..3458cd27f0f1 100644 --- a/gfx/angle/checkout/src/compiler/translator/UnfoldShortCircuitToIf.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.h @@ -9,8 +9,8 @@ // the original expression. // -#ifndef COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ -#define COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_ +#define COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_ namespace sh { @@ -22,4 +22,4 @@ void UnfoldShortCircuitToIf(TIntermNode *root, TSymbolTable *symbolTable); } // namespace sh -#endif // COMPILER_TRANSLATOR_UNFOLDSHORTCIRCUIT_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_UNFOLDSHORTCIRCUIT_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp index 900119d97798..394a414ca95e 100644 --- a/gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp @@ -8,12 +8,12 @@ // the beginning of main. This is to work around a Mac driver that treats unused standard/shared // uniform blocks as inactive. -#include "compiler/translator/UseInterfaceBlockFields.h" +#include "compiler/translator/tree_ops/UseInterfaceBlockFields.h" -#include "compiler/translator/FindMain.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/FindMain.h" +#include "compiler/translator/tree_util/IntermNode_util.h" #include "compiler/translator/util.h" namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h similarity index 79% rename from gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h index 3e2a4815d495..37f0ba02201f 100644 --- a/gfx/angle/checkout/src/compiler/translator/UseInterfaceBlockFields.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.h @@ -8,8 +8,8 @@ // the beginning of main. This is to work around a Mac driver that treats unused standard/shared // uniform blocks as inactive. -#ifndef COMPILER_TRANSLATOR_USEINTERFACEBLOCKFIELDS_H_ -#define COMPILER_TRANSLATOR_USEINTERFACEBLOCKFIELDS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_ #include @@ -27,4 +27,4 @@ void UseInterfaceBlockFields(TIntermBlock *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_USEINTERFACEBLOCKFIELDS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_USEINTERFACEBLOCKFIELDS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp similarity index 98% rename from gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp index 75b12283e444..e365d8ba1368 100644 --- a/gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp @@ -9,13 +9,13 @@ // This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA // driver version 387.92. It works around the most common occurrences of the bug. -#include "compiler/translator/VectorizeVectorScalarArithmetic.h" +#include "compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h" #include #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h similarity index 78% rename from gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h index 69f092e039d8..e6480646f81a 100644 --- a/gfx/angle/checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.h @@ -9,8 +9,8 @@ // This is targeted to work around a bug in NVIDIA OpenGL drivers that was reproducible on NVIDIA // driver version 387.92. It works around the most common occurrences of the bug. -#ifndef COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ -#define COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_ +#define COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_ namespace sh { @@ -22,4 +22,4 @@ void VectorizeVectorScalarArithmetic(TIntermBlock *root, TSymbolTable *symbolTab } // namespace sh -#endif // COMPILER_TRANSLATOR_VECTORIZEVECTORSCALARARITHMETIC_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEOPS_VECTORIZEVECTORSCALARARITHMETIC_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp similarity index 90% rename from gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp index 85a11c998dac..5a4dd30853ad 100644 --- a/gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp @@ -26,10 +26,10 @@ // } // } -#include "compiler/translator/WrapSwitchStatementsInBlocks.h" +#include "compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -40,16 +40,9 @@ namespace class WrapSwitchStatementsInBlocksTraverser : public TIntermTraverser { public: - WrapSwitchStatementsInBlocksTraverser() : TIntermTraverser(true, false, false), mDidWrap(false) - { - } + WrapSwitchStatementsInBlocksTraverser() : TIntermTraverser(true, false, false) {} bool visitSwitch(Visit visit, TIntermSwitch *node) override; - - bool didWrap() const { return mDidWrap; } - - private: - bool mDidWrap; }; bool WrapSwitchStatementsInBlocksTraverser::visitSwitch(Visit, TIntermSwitch *node) @@ -88,6 +81,9 @@ bool WrapSwitchStatementsInBlocksTraverser::visitSwitch(Visit, TIntermSwitch *no node->getStatementList(), declaration, emptyReplacement)); declarationInBlock->appendDeclarator(declaratorAsSymbol->deepCopy()); + // The declaration can't be the last statement inside the switch since unused variables + // should already have been pruned. + ASSERT(declaration != statementList->back()); } else { @@ -111,7 +107,6 @@ bool WrapSwitchStatementsInBlocksTraverser::visitSwitch(Visit, TIntermSwitch *no wrapperBlock->appendStatement(node); queueReplacement(wrapperBlock, OriginalNode::BECOMES_CHILD); - mDidWrap = true; // Should be fine to process multiple switch statements, even nesting ones in the same // traversal. @@ -121,12 +116,11 @@ bool WrapSwitchStatementsInBlocksTraverser::visitSwitch(Visit, TIntermSwitch *no } // anonymous namespace // Wrap switch statements in the AST into blocks when needed. -bool WrapSwitchStatementsInBlocks(TIntermBlock *root) +void WrapSwitchStatementsInBlocks(TIntermBlock *root) { WrapSwitchStatementsInBlocksTraverser traverser; root->traverse(&traverser); traverser.updateTree(); - return traverser.didWrap(); } } // namespace sh diff --git a/gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.h b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h similarity index 65% rename from gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.h rename to gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h index bc0179926d16..d04893cb521e 100644 --- a/gfx/angle/checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.h @@ -6,8 +6,8 @@ // WrapSwitchStatementsInBlocks.h: Wrap switch statements in blocks and declare all switch-scoped // variables there to make the AST compatible with HLSL output. -#ifndef COMPILER_TRANSLATOR_WRAPSWITCHSTATEMENTSINBLOCKS_H_ -#define COMPILER_TRANSLATOR_WRAPSWITCHSTATEMENTSINBLOCKS_H_ +#ifndef COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_ +#define COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_ namespace sh { @@ -15,8 +15,8 @@ namespace sh class TIntermBlock; // Wrap switch statements in the AST into blocks when needed. Returns true if the AST was changed. -bool WrapSwitchStatementsInBlocks(TIntermBlock *root); +void WrapSwitchStatementsInBlocks(TIntermBlock *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_WRAPSWITCHSTATEMENTSINBLOCKS_H_ +#endif // COMPILER_TRANSLATOR_TREEOPS_WRAPSWITCHSTATEMENTSINBLOCKS_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h b/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h new file mode 100644 index 000000000000..e617055b8d36 --- /dev/null +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/BuiltIn_autogen.h @@ -0,0 +1,1334 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by gen_builtin_symbols.py using data from builtin_variables.json and +// builtin_function_declarations.txt. +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// BuiltIn_autogen.h: +// Compile-time initialized built-ins. + +#ifndef COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_ + +#include "compiler/translator/SymbolUniqueId.h" + +namespace sh +{ + +class TVariable; + +class BuiltInId +{ + public: + static constexpr const TSymbolUniqueId radians_Float1 = TSymbolUniqueId(0); + static constexpr const TSymbolUniqueId pt0B = TSymbolUniqueId(1); + static constexpr const TSymbolUniqueId radians_Float2 = TSymbolUniqueId(2); + static constexpr const TSymbolUniqueId pt1B = TSymbolUniqueId(3); + static constexpr const TSymbolUniqueId radians_Float3 = TSymbolUniqueId(4); + static constexpr const TSymbolUniqueId pt2B = TSymbolUniqueId(5); + static constexpr const TSymbolUniqueId radians_Float4 = TSymbolUniqueId(6); + static constexpr const TSymbolUniqueId pt3B = TSymbolUniqueId(7); + static constexpr const TSymbolUniqueId degrees_Float1 = TSymbolUniqueId(8); + static constexpr const TSymbolUniqueId degrees_Float2 = TSymbolUniqueId(9); + static constexpr const TSymbolUniqueId degrees_Float3 = TSymbolUniqueId(10); + static constexpr const TSymbolUniqueId degrees_Float4 = TSymbolUniqueId(11); + static constexpr const TSymbolUniqueId sin_Float1 = TSymbolUniqueId(12); + static constexpr const TSymbolUniqueId sin_Float2 = TSymbolUniqueId(13); + static constexpr const TSymbolUniqueId sin_Float3 = TSymbolUniqueId(14); + static constexpr const TSymbolUniqueId sin_Float4 = TSymbolUniqueId(15); + static constexpr const TSymbolUniqueId cos_Float1 = TSymbolUniqueId(16); + static constexpr const TSymbolUniqueId cos_Float2 = TSymbolUniqueId(17); + static constexpr const TSymbolUniqueId cos_Float3 = TSymbolUniqueId(18); + static constexpr const TSymbolUniqueId cos_Float4 = TSymbolUniqueId(19); + static constexpr const TSymbolUniqueId tan_Float1 = TSymbolUniqueId(20); + static constexpr const TSymbolUniqueId tan_Float2 = TSymbolUniqueId(21); + static constexpr const TSymbolUniqueId tan_Float3 = TSymbolUniqueId(22); + static constexpr const TSymbolUniqueId tan_Float4 = TSymbolUniqueId(23); + static constexpr const TSymbolUniqueId asin_Float1 = TSymbolUniqueId(24); + static constexpr const TSymbolUniqueId asin_Float2 = TSymbolUniqueId(25); + static constexpr const TSymbolUniqueId asin_Float3 = TSymbolUniqueId(26); + static constexpr const TSymbolUniqueId asin_Float4 = TSymbolUniqueId(27); + static constexpr const TSymbolUniqueId acos_Float1 = TSymbolUniqueId(28); + static constexpr const TSymbolUniqueId acos_Float2 = TSymbolUniqueId(29); + static constexpr const TSymbolUniqueId acos_Float3 = TSymbolUniqueId(30); + static constexpr const TSymbolUniqueId acos_Float4 = TSymbolUniqueId(31); + static constexpr const TSymbolUniqueId atan_Float1_Float1 = TSymbolUniqueId(32); + static constexpr const TSymbolUniqueId atan_Float2_Float2 = TSymbolUniqueId(33); + static constexpr const TSymbolUniqueId atan_Float3_Float3 = TSymbolUniqueId(34); + static constexpr const TSymbolUniqueId atan_Float4_Float4 = TSymbolUniqueId(35); + static constexpr const TSymbolUniqueId atan_Float1 = TSymbolUniqueId(36); + static constexpr const TSymbolUniqueId atan_Float2 = TSymbolUniqueId(37); + static constexpr const TSymbolUniqueId atan_Float3 = TSymbolUniqueId(38); + static constexpr const TSymbolUniqueId atan_Float4 = TSymbolUniqueId(39); + static constexpr const TSymbolUniqueId sinh_Float1 = TSymbolUniqueId(40); + static constexpr const TSymbolUniqueId sinh_Float2 = TSymbolUniqueId(41); + static constexpr const TSymbolUniqueId sinh_Float3 = TSymbolUniqueId(42); + static constexpr const TSymbolUniqueId sinh_Float4 = TSymbolUniqueId(43); + static constexpr const TSymbolUniqueId cosh_Float1 = TSymbolUniqueId(44); + static constexpr const TSymbolUniqueId cosh_Float2 = TSymbolUniqueId(45); + static constexpr const TSymbolUniqueId cosh_Float3 = TSymbolUniqueId(46); + static constexpr const TSymbolUniqueId cosh_Float4 = TSymbolUniqueId(47); + static constexpr const TSymbolUniqueId tanh_Float1 = TSymbolUniqueId(48); + static constexpr const TSymbolUniqueId tanh_Float2 = TSymbolUniqueId(49); + static constexpr const TSymbolUniqueId tanh_Float3 = TSymbolUniqueId(50); + static constexpr const TSymbolUniqueId tanh_Float4 = TSymbolUniqueId(51); + static constexpr const TSymbolUniqueId asinh_Float1 = TSymbolUniqueId(52); + static constexpr const TSymbolUniqueId asinh_Float2 = TSymbolUniqueId(53); + static constexpr const TSymbolUniqueId asinh_Float3 = TSymbolUniqueId(54); + static constexpr const TSymbolUniqueId asinh_Float4 = TSymbolUniqueId(55); + static constexpr const TSymbolUniqueId acosh_Float1 = TSymbolUniqueId(56); + static constexpr const TSymbolUniqueId acosh_Float2 = TSymbolUniqueId(57); + static constexpr const TSymbolUniqueId acosh_Float3 = TSymbolUniqueId(58); + static constexpr const TSymbolUniqueId acosh_Float4 = TSymbolUniqueId(59); + static constexpr const TSymbolUniqueId atanh_Float1 = TSymbolUniqueId(60); + static constexpr const TSymbolUniqueId atanh_Float2 = TSymbolUniqueId(61); + static constexpr const TSymbolUniqueId atanh_Float3 = TSymbolUniqueId(62); + static constexpr const TSymbolUniqueId atanh_Float4 = TSymbolUniqueId(63); + static constexpr const TSymbolUniqueId pow_Float1_Float1 = TSymbolUniqueId(64); + static constexpr const TSymbolUniqueId pow_Float2_Float2 = TSymbolUniqueId(65); + static constexpr const TSymbolUniqueId pow_Float3_Float3 = TSymbolUniqueId(66); + static constexpr const TSymbolUniqueId pow_Float4_Float4 = TSymbolUniqueId(67); + static constexpr const TSymbolUniqueId exp_Float1 = TSymbolUniqueId(68); + static constexpr const TSymbolUniqueId exp_Float2 = TSymbolUniqueId(69); + static constexpr const TSymbolUniqueId exp_Float3 = TSymbolUniqueId(70); + static constexpr const TSymbolUniqueId exp_Float4 = TSymbolUniqueId(71); + static constexpr const TSymbolUniqueId log_Float1 = TSymbolUniqueId(72); + static constexpr const TSymbolUniqueId log_Float2 = TSymbolUniqueId(73); + static constexpr const TSymbolUniqueId log_Float3 = TSymbolUniqueId(74); + static constexpr const TSymbolUniqueId log_Float4 = TSymbolUniqueId(75); + static constexpr const TSymbolUniqueId exp2_Float1 = TSymbolUniqueId(76); + static constexpr const TSymbolUniqueId exp2_Float2 = TSymbolUniqueId(77); + static constexpr const TSymbolUniqueId exp2_Float3 = TSymbolUniqueId(78); + static constexpr const TSymbolUniqueId exp2_Float4 = TSymbolUniqueId(79); + static constexpr const TSymbolUniqueId log2_Float1 = TSymbolUniqueId(80); + static constexpr const TSymbolUniqueId log2_Float2 = TSymbolUniqueId(81); + static constexpr const TSymbolUniqueId log2_Float3 = TSymbolUniqueId(82); + static constexpr const TSymbolUniqueId log2_Float4 = TSymbolUniqueId(83); + static constexpr const TSymbolUniqueId sqrt_Float1 = TSymbolUniqueId(84); + static constexpr const TSymbolUniqueId sqrt_Float2 = TSymbolUniqueId(85); + static constexpr const TSymbolUniqueId sqrt_Float3 = TSymbolUniqueId(86); + static constexpr const TSymbolUniqueId sqrt_Float4 = TSymbolUniqueId(87); + static constexpr const TSymbolUniqueId inversesqrt_Float1 = TSymbolUniqueId(88); + static constexpr const TSymbolUniqueId inversesqrt_Float2 = TSymbolUniqueId(89); + static constexpr const TSymbolUniqueId inversesqrt_Float3 = TSymbolUniqueId(90); + static constexpr const TSymbolUniqueId inversesqrt_Float4 = TSymbolUniqueId(91); + static constexpr const TSymbolUniqueId abs_Float1 = TSymbolUniqueId(92); + static constexpr const TSymbolUniqueId abs_Float2 = TSymbolUniqueId(93); + static constexpr const TSymbolUniqueId abs_Float3 = TSymbolUniqueId(94); + static constexpr const TSymbolUniqueId abs_Float4 = TSymbolUniqueId(95); + static constexpr const TSymbolUniqueId abs_Int1 = TSymbolUniqueId(96); + static constexpr const TSymbolUniqueId pt0C = TSymbolUniqueId(97); + static constexpr const TSymbolUniqueId abs_Int2 = TSymbolUniqueId(98); + static constexpr const TSymbolUniqueId pt1C = TSymbolUniqueId(99); + static constexpr const TSymbolUniqueId abs_Int3 = TSymbolUniqueId(100); + static constexpr const TSymbolUniqueId pt2C = TSymbolUniqueId(101); + static constexpr const TSymbolUniqueId abs_Int4 = TSymbolUniqueId(102); + static constexpr const TSymbolUniqueId pt3C = TSymbolUniqueId(103); + static constexpr const TSymbolUniqueId sign_Float1 = TSymbolUniqueId(104); + static constexpr const TSymbolUniqueId sign_Float2 = TSymbolUniqueId(105); + static constexpr const TSymbolUniqueId sign_Float3 = TSymbolUniqueId(106); + static constexpr const TSymbolUniqueId sign_Float4 = TSymbolUniqueId(107); + static constexpr const TSymbolUniqueId sign_Int1 = TSymbolUniqueId(108); + static constexpr const TSymbolUniqueId sign_Int2 = TSymbolUniqueId(109); + static constexpr const TSymbolUniqueId sign_Int3 = TSymbolUniqueId(110); + static constexpr const TSymbolUniqueId sign_Int4 = TSymbolUniqueId(111); + static constexpr const TSymbolUniqueId floor_Float1 = TSymbolUniqueId(112); + static constexpr const TSymbolUniqueId floor_Float2 = TSymbolUniqueId(113); + static constexpr const TSymbolUniqueId floor_Float3 = TSymbolUniqueId(114); + static constexpr const TSymbolUniqueId floor_Float4 = TSymbolUniqueId(115); + static constexpr const TSymbolUniqueId trunc_Float1 = TSymbolUniqueId(116); + static constexpr const TSymbolUniqueId trunc_Float2 = TSymbolUniqueId(117); + static constexpr const TSymbolUniqueId trunc_Float3 = TSymbolUniqueId(118); + static constexpr const TSymbolUniqueId trunc_Float4 = TSymbolUniqueId(119); + static constexpr const TSymbolUniqueId round_Float1 = TSymbolUniqueId(120); + static constexpr const TSymbolUniqueId round_Float2 = TSymbolUniqueId(121); + static constexpr const TSymbolUniqueId round_Float3 = TSymbolUniqueId(122); + static constexpr const TSymbolUniqueId round_Float4 = TSymbolUniqueId(123); + static constexpr const TSymbolUniqueId roundEven_Float1 = TSymbolUniqueId(124); + static constexpr const TSymbolUniqueId roundEven_Float2 = TSymbolUniqueId(125); + static constexpr const TSymbolUniqueId roundEven_Float3 = TSymbolUniqueId(126); + static constexpr const TSymbolUniqueId roundEven_Float4 = TSymbolUniqueId(127); + static constexpr const TSymbolUniqueId ceil_Float1 = TSymbolUniqueId(128); + static constexpr const TSymbolUniqueId ceil_Float2 = TSymbolUniqueId(129); + static constexpr const TSymbolUniqueId ceil_Float3 = TSymbolUniqueId(130); + static constexpr const TSymbolUniqueId ceil_Float4 = TSymbolUniqueId(131); + static constexpr const TSymbolUniqueId fract_Float1 = TSymbolUniqueId(132); + static constexpr const TSymbolUniqueId fract_Float2 = TSymbolUniqueId(133); + static constexpr const TSymbolUniqueId fract_Float3 = TSymbolUniqueId(134); + static constexpr const TSymbolUniqueId fract_Float4 = TSymbolUniqueId(135); + static constexpr const TSymbolUniqueId mod_Float1_Float1 = TSymbolUniqueId(136); + static constexpr const TSymbolUniqueId mod_Float2_Float1 = TSymbolUniqueId(137); + static constexpr const TSymbolUniqueId mod_Float3_Float1 = TSymbolUniqueId(138); + static constexpr const TSymbolUniqueId mod_Float4_Float1 = TSymbolUniqueId(139); + static constexpr const TSymbolUniqueId mod_Float2_Float2 = TSymbolUniqueId(140); + static constexpr const TSymbolUniqueId mod_Float3_Float3 = TSymbolUniqueId(141); + static constexpr const TSymbolUniqueId mod_Float4_Float4 = TSymbolUniqueId(142); + static constexpr const TSymbolUniqueId min_Float1_Float1 = TSymbolUniqueId(143); + static constexpr const TSymbolUniqueId min_Float2_Float1 = TSymbolUniqueId(144); + static constexpr const TSymbolUniqueId min_Float3_Float1 = TSymbolUniqueId(145); + static constexpr const TSymbolUniqueId min_Float4_Float1 = TSymbolUniqueId(146); + static constexpr const TSymbolUniqueId min_Float2_Float2 = TSymbolUniqueId(147); + static constexpr const TSymbolUniqueId min_Float3_Float3 = TSymbolUniqueId(148); + static constexpr const TSymbolUniqueId min_Float4_Float4 = TSymbolUniqueId(149); + static constexpr const TSymbolUniqueId min_Int1_Int1 = TSymbolUniqueId(150); + static constexpr const TSymbolUniqueId min_Int2_Int2 = TSymbolUniqueId(151); + static constexpr const TSymbolUniqueId min_Int3_Int3 = TSymbolUniqueId(152); + static constexpr const TSymbolUniqueId min_Int4_Int4 = TSymbolUniqueId(153); + static constexpr const TSymbolUniqueId min_Int2_Int1 = TSymbolUniqueId(154); + static constexpr const TSymbolUniqueId min_Int3_Int1 = TSymbolUniqueId(155); + static constexpr const TSymbolUniqueId min_Int4_Int1 = TSymbolUniqueId(156); + static constexpr const TSymbolUniqueId min_UInt1_UInt1 = TSymbolUniqueId(157); + static constexpr const TSymbolUniqueId pt0D = TSymbolUniqueId(158); + static constexpr const TSymbolUniqueId min_UInt2_UInt2 = TSymbolUniqueId(159); + static constexpr const TSymbolUniqueId pt1D = TSymbolUniqueId(160); + static constexpr const TSymbolUniqueId min_UInt3_UInt3 = TSymbolUniqueId(161); + static constexpr const TSymbolUniqueId pt2D = TSymbolUniqueId(162); + static constexpr const TSymbolUniqueId min_UInt4_UInt4 = TSymbolUniqueId(163); + static constexpr const TSymbolUniqueId pt3D = TSymbolUniqueId(164); + static constexpr const TSymbolUniqueId min_UInt2_UInt1 = TSymbolUniqueId(165); + static constexpr const TSymbolUniqueId min_UInt3_UInt1 = TSymbolUniqueId(166); + static constexpr const TSymbolUniqueId min_UInt4_UInt1 = TSymbolUniqueId(167); + static constexpr const TSymbolUniqueId max_Float1_Float1 = TSymbolUniqueId(168); + static constexpr const TSymbolUniqueId max_Float2_Float1 = TSymbolUniqueId(169); + static constexpr const TSymbolUniqueId max_Float3_Float1 = TSymbolUniqueId(170); + static constexpr const TSymbolUniqueId max_Float4_Float1 = TSymbolUniqueId(171); + static constexpr const TSymbolUniqueId max_Float2_Float2 = TSymbolUniqueId(172); + static constexpr const TSymbolUniqueId max_Float3_Float3 = TSymbolUniqueId(173); + static constexpr const TSymbolUniqueId max_Float4_Float4 = TSymbolUniqueId(174); + static constexpr const TSymbolUniqueId max_Int1_Int1 = TSymbolUniqueId(175); + static constexpr const TSymbolUniqueId max_Int2_Int2 = TSymbolUniqueId(176); + static constexpr const TSymbolUniqueId max_Int3_Int3 = TSymbolUniqueId(177); + static constexpr const TSymbolUniqueId max_Int4_Int4 = TSymbolUniqueId(178); + static constexpr const TSymbolUniqueId max_Int2_Int1 = TSymbolUniqueId(179); + static constexpr const TSymbolUniqueId max_Int3_Int1 = TSymbolUniqueId(180); + static constexpr const TSymbolUniqueId max_Int4_Int1 = TSymbolUniqueId(181); + static constexpr const TSymbolUniqueId max_UInt1_UInt1 = TSymbolUniqueId(182); + static constexpr const TSymbolUniqueId max_UInt2_UInt2 = TSymbolUniqueId(183); + static constexpr const TSymbolUniqueId max_UInt3_UInt3 = TSymbolUniqueId(184); + static constexpr const TSymbolUniqueId max_UInt4_UInt4 = TSymbolUniqueId(185); + static constexpr const TSymbolUniqueId max_UInt2_UInt1 = TSymbolUniqueId(186); + static constexpr const TSymbolUniqueId max_UInt3_UInt1 = TSymbolUniqueId(187); + static constexpr const TSymbolUniqueId max_UInt4_UInt1 = TSymbolUniqueId(188); + static constexpr const TSymbolUniqueId clamp_Float1_Float1_Float1 = TSymbolUniqueId(189); + static constexpr const TSymbolUniqueId clamp_Float2_Float1_Float1 = TSymbolUniqueId(190); + static constexpr const TSymbolUniqueId clamp_Float3_Float1_Float1 = TSymbolUniqueId(191); + static constexpr const TSymbolUniqueId clamp_Float4_Float1_Float1 = TSymbolUniqueId(192); + static constexpr const TSymbolUniqueId clamp_Float2_Float2_Float2 = TSymbolUniqueId(193); + static constexpr const TSymbolUniqueId clamp_Float3_Float3_Float3 = TSymbolUniqueId(194); + static constexpr const TSymbolUniqueId clamp_Float4_Float4_Float4 = TSymbolUniqueId(195); + static constexpr const TSymbolUniqueId clamp_Int1_Int1_Int1 = TSymbolUniqueId(196); + static constexpr const TSymbolUniqueId clamp_Int2_Int1_Int1 = TSymbolUniqueId(197); + static constexpr const TSymbolUniqueId clamp_Int3_Int1_Int1 = TSymbolUniqueId(198); + static constexpr const TSymbolUniqueId clamp_Int4_Int1_Int1 = TSymbolUniqueId(199); + static constexpr const TSymbolUniqueId clamp_Int2_Int2_Int2 = TSymbolUniqueId(200); + static constexpr const TSymbolUniqueId clamp_Int3_Int3_Int3 = TSymbolUniqueId(201); + static constexpr const TSymbolUniqueId clamp_Int4_Int4_Int4 = TSymbolUniqueId(202); + static constexpr const TSymbolUniqueId clamp_UInt1_UInt1_UInt1 = TSymbolUniqueId(203); + static constexpr const TSymbolUniqueId clamp_UInt2_UInt1_UInt1 = TSymbolUniqueId(204); + static constexpr const TSymbolUniqueId clamp_UInt3_UInt1_UInt1 = TSymbolUniqueId(205); + static constexpr const TSymbolUniqueId clamp_UInt4_UInt1_UInt1 = TSymbolUniqueId(206); + static constexpr const TSymbolUniqueId clamp_UInt2_UInt2_UInt2 = TSymbolUniqueId(207); + static constexpr const TSymbolUniqueId clamp_UInt3_UInt3_UInt3 = TSymbolUniqueId(208); + static constexpr const TSymbolUniqueId clamp_UInt4_UInt4_UInt4 = TSymbolUniqueId(209); + static constexpr const TSymbolUniqueId mix_Float1_Float1_Float1 = TSymbolUniqueId(210); + static constexpr const TSymbolUniqueId mix_Float2_Float2_Float1 = TSymbolUniqueId(211); + static constexpr const TSymbolUniqueId mix_Float3_Float3_Float1 = TSymbolUniqueId(212); + static constexpr const TSymbolUniqueId mix_Float4_Float4_Float1 = TSymbolUniqueId(213); + static constexpr const TSymbolUniqueId mix_Float2_Float2_Float2 = TSymbolUniqueId(214); + static constexpr const TSymbolUniqueId mix_Float3_Float3_Float3 = TSymbolUniqueId(215); + static constexpr const TSymbolUniqueId mix_Float4_Float4_Float4 = TSymbolUniqueId(216); + static constexpr const TSymbolUniqueId mix_Float1_Float1_Bool1 = TSymbolUniqueId(217); + static constexpr const TSymbolUniqueId pt0E = TSymbolUniqueId(218); + static constexpr const TSymbolUniqueId mix_Float2_Float2_Bool2 = TSymbolUniqueId(219); + static constexpr const TSymbolUniqueId pt1E = TSymbolUniqueId(220); + static constexpr const TSymbolUniqueId mix_Float3_Float3_Bool3 = TSymbolUniqueId(221); + static constexpr const TSymbolUniqueId pt2E = TSymbolUniqueId(222); + static constexpr const TSymbolUniqueId mix_Float4_Float4_Bool4 = TSymbolUniqueId(223); + static constexpr const TSymbolUniqueId pt3E = TSymbolUniqueId(224); + static constexpr const TSymbolUniqueId step_Float1_Float1 = TSymbolUniqueId(225); + static constexpr const TSymbolUniqueId step_Float2_Float2 = TSymbolUniqueId(226); + static constexpr const TSymbolUniqueId step_Float3_Float3 = TSymbolUniqueId(227); + static constexpr const TSymbolUniqueId step_Float4_Float4 = TSymbolUniqueId(228); + static constexpr const TSymbolUniqueId step_Float1_Float2 = TSymbolUniqueId(229); + static constexpr const TSymbolUniqueId step_Float1_Float3 = TSymbolUniqueId(230); + static constexpr const TSymbolUniqueId step_Float1_Float4 = TSymbolUniqueId(231); + static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float1 = TSymbolUniqueId(232); + static constexpr const TSymbolUniqueId smoothstep_Float2_Float2_Float2 = TSymbolUniqueId(233); + static constexpr const TSymbolUniqueId smoothstep_Float3_Float3_Float3 = TSymbolUniqueId(234); + static constexpr const TSymbolUniqueId smoothstep_Float4_Float4_Float4 = TSymbolUniqueId(235); + static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float2 = TSymbolUniqueId(236); + static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float3 = TSymbolUniqueId(237); + static constexpr const TSymbolUniqueId smoothstep_Float1_Float1_Float4 = TSymbolUniqueId(238); + static constexpr const TSymbolUniqueId modf_Float1_Float1 = TSymbolUniqueId(239); + static constexpr const TSymbolUniqueId pt_o_0B = TSymbolUniqueId(240); + static constexpr const TSymbolUniqueId modf_Float2_Float2 = TSymbolUniqueId(241); + static constexpr const TSymbolUniqueId pt_o_1B = TSymbolUniqueId(242); + static constexpr const TSymbolUniqueId modf_Float3_Float3 = TSymbolUniqueId(243); + static constexpr const TSymbolUniqueId pt_o_2B = TSymbolUniqueId(244); + static constexpr const TSymbolUniqueId modf_Float4_Float4 = TSymbolUniqueId(245); + static constexpr const TSymbolUniqueId pt_o_3B = TSymbolUniqueId(246); + static constexpr const TSymbolUniqueId isnan_Float1 = TSymbolUniqueId(247); + static constexpr const TSymbolUniqueId isnan_Float2 = TSymbolUniqueId(248); + static constexpr const TSymbolUniqueId isnan_Float3 = TSymbolUniqueId(249); + static constexpr const TSymbolUniqueId isnan_Float4 = TSymbolUniqueId(250); + static constexpr const TSymbolUniqueId isinf_Float1 = TSymbolUniqueId(251); + static constexpr const TSymbolUniqueId isinf_Float2 = TSymbolUniqueId(252); + static constexpr const TSymbolUniqueId isinf_Float3 = TSymbolUniqueId(253); + static constexpr const TSymbolUniqueId isinf_Float4 = TSymbolUniqueId(254); + static constexpr const TSymbolUniqueId floatBitsToInt_Float1 = TSymbolUniqueId(255); + static constexpr const TSymbolUniqueId floatBitsToInt_Float2 = TSymbolUniqueId(256); + static constexpr const TSymbolUniqueId floatBitsToInt_Float3 = TSymbolUniqueId(257); + static constexpr const TSymbolUniqueId floatBitsToInt_Float4 = TSymbolUniqueId(258); + static constexpr const TSymbolUniqueId floatBitsToUint_Float1 = TSymbolUniqueId(259); + static constexpr const TSymbolUniqueId floatBitsToUint_Float2 = TSymbolUniqueId(260); + static constexpr const TSymbolUniqueId floatBitsToUint_Float3 = TSymbolUniqueId(261); + static constexpr const TSymbolUniqueId floatBitsToUint_Float4 = TSymbolUniqueId(262); + static constexpr const TSymbolUniqueId intBitsToFloat_Int1 = TSymbolUniqueId(263); + static constexpr const TSymbolUniqueId intBitsToFloat_Int2 = TSymbolUniqueId(264); + static constexpr const TSymbolUniqueId intBitsToFloat_Int3 = TSymbolUniqueId(265); + static constexpr const TSymbolUniqueId intBitsToFloat_Int4 = TSymbolUniqueId(266); + static constexpr const TSymbolUniqueId uintBitsToFloat_UInt1 = TSymbolUniqueId(267); + static constexpr const TSymbolUniqueId uintBitsToFloat_UInt2 = TSymbolUniqueId(268); + static constexpr const TSymbolUniqueId uintBitsToFloat_UInt3 = TSymbolUniqueId(269); + static constexpr const TSymbolUniqueId uintBitsToFloat_UInt4 = TSymbolUniqueId(270); + static constexpr const TSymbolUniqueId frexp_Float1_Int1 = TSymbolUniqueId(271); + static constexpr const TSymbolUniqueId pt_o_0C = TSymbolUniqueId(272); + static constexpr const TSymbolUniqueId frexp_Float2_Int2 = TSymbolUniqueId(273); + static constexpr const TSymbolUniqueId pt_o_1C = TSymbolUniqueId(274); + static constexpr const TSymbolUniqueId frexp_Float3_Int3 = TSymbolUniqueId(275); + static constexpr const TSymbolUniqueId pt_o_2C = TSymbolUniqueId(276); + static constexpr const TSymbolUniqueId frexp_Float4_Int4 = TSymbolUniqueId(277); + static constexpr const TSymbolUniqueId pt_o_3C = TSymbolUniqueId(278); + static constexpr const TSymbolUniqueId ldexp_Float1_Int1 = TSymbolUniqueId(279); + static constexpr const TSymbolUniqueId ldexp_Float2_Int2 = TSymbolUniqueId(280); + static constexpr const TSymbolUniqueId ldexp_Float3_Int3 = TSymbolUniqueId(281); + static constexpr const TSymbolUniqueId ldexp_Float4_Int4 = TSymbolUniqueId(282); + static constexpr const TSymbolUniqueId packSnorm2x16_Float2 = TSymbolUniqueId(283); + static constexpr const TSymbolUniqueId packUnorm2x16_Float2 = TSymbolUniqueId(284); + static constexpr const TSymbolUniqueId packHalf2x16_Float2 = TSymbolUniqueId(285); + static constexpr const TSymbolUniqueId unpackSnorm2x16_UInt1 = TSymbolUniqueId(286); + static constexpr const TSymbolUniqueId unpackUnorm2x16_UInt1 = TSymbolUniqueId(287); + static constexpr const TSymbolUniqueId unpackHalf2x16_UInt1 = TSymbolUniqueId(288); + static constexpr const TSymbolUniqueId packUnorm4x8_Float4 = TSymbolUniqueId(289); + static constexpr const TSymbolUniqueId packSnorm4x8_Float4 = TSymbolUniqueId(290); + static constexpr const TSymbolUniqueId unpackUnorm4x8_UInt1 = TSymbolUniqueId(291); + static constexpr const TSymbolUniqueId unpackSnorm4x8_UInt1 = TSymbolUniqueId(292); + static constexpr const TSymbolUniqueId length_Float1 = TSymbolUniqueId(293); + static constexpr const TSymbolUniqueId length_Float2 = TSymbolUniqueId(294); + static constexpr const TSymbolUniqueId length_Float3 = TSymbolUniqueId(295); + static constexpr const TSymbolUniqueId length_Float4 = TSymbolUniqueId(296); + static constexpr const TSymbolUniqueId distance_Float1_Float1 = TSymbolUniqueId(297); + static constexpr const TSymbolUniqueId distance_Float2_Float2 = TSymbolUniqueId(298); + static constexpr const TSymbolUniqueId distance_Float3_Float3 = TSymbolUniqueId(299); + static constexpr const TSymbolUniqueId distance_Float4_Float4 = TSymbolUniqueId(300); + static constexpr const TSymbolUniqueId dot_Float1_Float1 = TSymbolUniqueId(301); + static constexpr const TSymbolUniqueId dot_Float2_Float2 = TSymbolUniqueId(302); + static constexpr const TSymbolUniqueId dot_Float3_Float3 = TSymbolUniqueId(303); + static constexpr const TSymbolUniqueId dot_Float4_Float4 = TSymbolUniqueId(304); + static constexpr const TSymbolUniqueId cross_Float3_Float3 = TSymbolUniqueId(305); + static constexpr const TSymbolUniqueId normalize_Float1 = TSymbolUniqueId(306); + static constexpr const TSymbolUniqueId normalize_Float2 = TSymbolUniqueId(307); + static constexpr const TSymbolUniqueId normalize_Float3 = TSymbolUniqueId(308); + static constexpr const TSymbolUniqueId normalize_Float4 = TSymbolUniqueId(309); + static constexpr const TSymbolUniqueId faceforward_Float1_Float1_Float1 = TSymbolUniqueId(310); + static constexpr const TSymbolUniqueId faceforward_Float2_Float2_Float2 = TSymbolUniqueId(311); + static constexpr const TSymbolUniqueId faceforward_Float3_Float3_Float3 = TSymbolUniqueId(312); + static constexpr const TSymbolUniqueId faceforward_Float4_Float4_Float4 = TSymbolUniqueId(313); + static constexpr const TSymbolUniqueId reflect_Float1_Float1 = TSymbolUniqueId(314); + static constexpr const TSymbolUniqueId reflect_Float2_Float2 = TSymbolUniqueId(315); + static constexpr const TSymbolUniqueId reflect_Float3_Float3 = TSymbolUniqueId(316); + static constexpr const TSymbolUniqueId reflect_Float4_Float4 = TSymbolUniqueId(317); + static constexpr const TSymbolUniqueId refract_Float1_Float1_Float1 = TSymbolUniqueId(318); + static constexpr const TSymbolUniqueId refract_Float2_Float2_Float1 = TSymbolUniqueId(319); + static constexpr const TSymbolUniqueId refract_Float3_Float3_Float1 = TSymbolUniqueId(320); + static constexpr const TSymbolUniqueId refract_Float4_Float4_Float1 = TSymbolUniqueId(321); + static constexpr const TSymbolUniqueId matrixCompMult_Float2x2_Float2x2 = TSymbolUniqueId(322); + static constexpr const TSymbolUniqueId pt5B = TSymbolUniqueId(323); + static constexpr const TSymbolUniqueId matrixCompMult_Float3x3_Float3x3 = TSymbolUniqueId(324); + static constexpr const TSymbolUniqueId ptAB = TSymbolUniqueId(325); + static constexpr const TSymbolUniqueId matrixCompMult_Float4x4_Float4x4 = TSymbolUniqueId(326); + static constexpr const TSymbolUniqueId ptFB = TSymbolUniqueId(327); + static constexpr const TSymbolUniqueId matrixCompMult_Float2x3_Float2x3 = TSymbolUniqueId(328); + static constexpr const TSymbolUniqueId pt9B = TSymbolUniqueId(329); + static constexpr const TSymbolUniqueId matrixCompMult_Float3x2_Float3x2 = TSymbolUniqueId(330); + static constexpr const TSymbolUniqueId pt6B = TSymbolUniqueId(331); + static constexpr const TSymbolUniqueId matrixCompMult_Float2x4_Float2x4 = TSymbolUniqueId(332); + static constexpr const TSymbolUniqueId ptDB = TSymbolUniqueId(333); + static constexpr const TSymbolUniqueId matrixCompMult_Float4x2_Float4x2 = TSymbolUniqueId(334); + static constexpr const TSymbolUniqueId pt7B = TSymbolUniqueId(335); + static constexpr const TSymbolUniqueId matrixCompMult_Float3x4_Float3x4 = TSymbolUniqueId(336); + static constexpr const TSymbolUniqueId ptEB = TSymbolUniqueId(337); + static constexpr const TSymbolUniqueId matrixCompMult_Float4x3_Float4x3 = TSymbolUniqueId(338); + static constexpr const TSymbolUniqueId ptBB = TSymbolUniqueId(339); + static constexpr const TSymbolUniqueId outerProduct_Float2_Float2 = TSymbolUniqueId(340); + static constexpr const TSymbolUniqueId outerProduct_Float3_Float3 = TSymbolUniqueId(341); + static constexpr const TSymbolUniqueId outerProduct_Float4_Float4 = TSymbolUniqueId(342); + static constexpr const TSymbolUniqueId outerProduct_Float3_Float2 = TSymbolUniqueId(343); + static constexpr const TSymbolUniqueId outerProduct_Float2_Float3 = TSymbolUniqueId(344); + static constexpr const TSymbolUniqueId outerProduct_Float4_Float2 = TSymbolUniqueId(345); + static constexpr const TSymbolUniqueId outerProduct_Float2_Float4 = TSymbolUniqueId(346); + static constexpr const TSymbolUniqueId outerProduct_Float4_Float3 = TSymbolUniqueId(347); + static constexpr const TSymbolUniqueId outerProduct_Float3_Float4 = TSymbolUniqueId(348); + static constexpr const TSymbolUniqueId transpose_Float2x2 = TSymbolUniqueId(349); + static constexpr const TSymbolUniqueId transpose_Float3x3 = TSymbolUniqueId(350); + static constexpr const TSymbolUniqueId transpose_Float4x4 = TSymbolUniqueId(351); + static constexpr const TSymbolUniqueId transpose_Float3x2 = TSymbolUniqueId(352); + static constexpr const TSymbolUniqueId transpose_Float2x3 = TSymbolUniqueId(353); + static constexpr const TSymbolUniqueId transpose_Float4x2 = TSymbolUniqueId(354); + static constexpr const TSymbolUniqueId transpose_Float2x4 = TSymbolUniqueId(355); + static constexpr const TSymbolUniqueId transpose_Float4x3 = TSymbolUniqueId(356); + static constexpr const TSymbolUniqueId transpose_Float3x4 = TSymbolUniqueId(357); + static constexpr const TSymbolUniqueId determinant_Float2x2 = TSymbolUniqueId(358); + static constexpr const TSymbolUniqueId determinant_Float3x3 = TSymbolUniqueId(359); + static constexpr const TSymbolUniqueId determinant_Float4x4 = TSymbolUniqueId(360); + static constexpr const TSymbolUniqueId inverse_Float2x2 = TSymbolUniqueId(361); + static constexpr const TSymbolUniqueId inverse_Float3x3 = TSymbolUniqueId(362); + static constexpr const TSymbolUniqueId inverse_Float4x4 = TSymbolUniqueId(363); + static constexpr const TSymbolUniqueId lessThan_Float2_Float2 = TSymbolUniqueId(364); + static constexpr const TSymbolUniqueId lessThan_Float3_Float3 = TSymbolUniqueId(365); + static constexpr const TSymbolUniqueId lessThan_Float4_Float4 = TSymbolUniqueId(366); + static constexpr const TSymbolUniqueId lessThan_Int2_Int2 = TSymbolUniqueId(367); + static constexpr const TSymbolUniqueId lessThan_Int3_Int3 = TSymbolUniqueId(368); + static constexpr const TSymbolUniqueId lessThan_Int4_Int4 = TSymbolUniqueId(369); + static constexpr const TSymbolUniqueId lessThan_UInt2_UInt2 = TSymbolUniqueId(370); + static constexpr const TSymbolUniqueId lessThan_UInt3_UInt3 = TSymbolUniqueId(371); + static constexpr const TSymbolUniqueId lessThan_UInt4_UInt4 = TSymbolUniqueId(372); + static constexpr const TSymbolUniqueId lessThanEqual_Float2_Float2 = TSymbolUniqueId(373); + static constexpr const TSymbolUniqueId lessThanEqual_Float3_Float3 = TSymbolUniqueId(374); + static constexpr const TSymbolUniqueId lessThanEqual_Float4_Float4 = TSymbolUniqueId(375); + static constexpr const TSymbolUniqueId lessThanEqual_Int2_Int2 = TSymbolUniqueId(376); + static constexpr const TSymbolUniqueId lessThanEqual_Int3_Int3 = TSymbolUniqueId(377); + static constexpr const TSymbolUniqueId lessThanEqual_Int4_Int4 = TSymbolUniqueId(378); + static constexpr const TSymbolUniqueId lessThanEqual_UInt2_UInt2 = TSymbolUniqueId(379); + static constexpr const TSymbolUniqueId lessThanEqual_UInt3_UInt3 = TSymbolUniqueId(380); + static constexpr const TSymbolUniqueId lessThanEqual_UInt4_UInt4 = TSymbolUniqueId(381); + static constexpr const TSymbolUniqueId greaterThan_Float2_Float2 = TSymbolUniqueId(382); + static constexpr const TSymbolUniqueId greaterThan_Float3_Float3 = TSymbolUniqueId(383); + static constexpr const TSymbolUniqueId greaterThan_Float4_Float4 = TSymbolUniqueId(384); + static constexpr const TSymbolUniqueId greaterThan_Int2_Int2 = TSymbolUniqueId(385); + static constexpr const TSymbolUniqueId greaterThan_Int3_Int3 = TSymbolUniqueId(386); + static constexpr const TSymbolUniqueId greaterThan_Int4_Int4 = TSymbolUniqueId(387); + static constexpr const TSymbolUniqueId greaterThan_UInt2_UInt2 = TSymbolUniqueId(388); + static constexpr const TSymbolUniqueId greaterThan_UInt3_UInt3 = TSymbolUniqueId(389); + static constexpr const TSymbolUniqueId greaterThan_UInt4_UInt4 = TSymbolUniqueId(390); + static constexpr const TSymbolUniqueId greaterThanEqual_Float2_Float2 = TSymbolUniqueId(391); + static constexpr const TSymbolUniqueId greaterThanEqual_Float3_Float3 = TSymbolUniqueId(392); + static constexpr const TSymbolUniqueId greaterThanEqual_Float4_Float4 = TSymbolUniqueId(393); + static constexpr const TSymbolUniqueId greaterThanEqual_Int2_Int2 = TSymbolUniqueId(394); + static constexpr const TSymbolUniqueId greaterThanEqual_Int3_Int3 = TSymbolUniqueId(395); + static constexpr const TSymbolUniqueId greaterThanEqual_Int4_Int4 = TSymbolUniqueId(396); + static constexpr const TSymbolUniqueId greaterThanEqual_UInt2_UInt2 = TSymbolUniqueId(397); + static constexpr const TSymbolUniqueId greaterThanEqual_UInt3_UInt3 = TSymbolUniqueId(398); + static constexpr const TSymbolUniqueId greaterThanEqual_UInt4_UInt4 = TSymbolUniqueId(399); + static constexpr const TSymbolUniqueId equal_Float2_Float2 = TSymbolUniqueId(400); + static constexpr const TSymbolUniqueId equal_Float3_Float3 = TSymbolUniqueId(401); + static constexpr const TSymbolUniqueId equal_Float4_Float4 = TSymbolUniqueId(402); + static constexpr const TSymbolUniqueId equal_Int2_Int2 = TSymbolUniqueId(403); + static constexpr const TSymbolUniqueId equal_Int3_Int3 = TSymbolUniqueId(404); + static constexpr const TSymbolUniqueId equal_Int4_Int4 = TSymbolUniqueId(405); + static constexpr const TSymbolUniqueId equal_UInt2_UInt2 = TSymbolUniqueId(406); + static constexpr const TSymbolUniqueId equal_UInt3_UInt3 = TSymbolUniqueId(407); + static constexpr const TSymbolUniqueId equal_UInt4_UInt4 = TSymbolUniqueId(408); + static constexpr const TSymbolUniqueId equal_Bool2_Bool2 = TSymbolUniqueId(409); + static constexpr const TSymbolUniqueId equal_Bool3_Bool3 = TSymbolUniqueId(410); + static constexpr const TSymbolUniqueId equal_Bool4_Bool4 = TSymbolUniqueId(411); + static constexpr const TSymbolUniqueId notEqual_Float2_Float2 = TSymbolUniqueId(412); + static constexpr const TSymbolUniqueId notEqual_Float3_Float3 = TSymbolUniqueId(413); + static constexpr const TSymbolUniqueId notEqual_Float4_Float4 = TSymbolUniqueId(414); + static constexpr const TSymbolUniqueId notEqual_Int2_Int2 = TSymbolUniqueId(415); + static constexpr const TSymbolUniqueId notEqual_Int3_Int3 = TSymbolUniqueId(416); + static constexpr const TSymbolUniqueId notEqual_Int4_Int4 = TSymbolUniqueId(417); + static constexpr const TSymbolUniqueId notEqual_UInt2_UInt2 = TSymbolUniqueId(418); + static constexpr const TSymbolUniqueId notEqual_UInt3_UInt3 = TSymbolUniqueId(419); + static constexpr const TSymbolUniqueId notEqual_UInt4_UInt4 = TSymbolUniqueId(420); + static constexpr const TSymbolUniqueId notEqual_Bool2_Bool2 = TSymbolUniqueId(421); + static constexpr const TSymbolUniqueId notEqual_Bool3_Bool3 = TSymbolUniqueId(422); + static constexpr const TSymbolUniqueId notEqual_Bool4_Bool4 = TSymbolUniqueId(423); + static constexpr const TSymbolUniqueId any_Bool2 = TSymbolUniqueId(424); + static constexpr const TSymbolUniqueId any_Bool3 = TSymbolUniqueId(425); + static constexpr const TSymbolUniqueId any_Bool4 = TSymbolUniqueId(426); + static constexpr const TSymbolUniqueId all_Bool2 = TSymbolUniqueId(427); + static constexpr const TSymbolUniqueId all_Bool3 = TSymbolUniqueId(428); + static constexpr const TSymbolUniqueId all_Bool4 = TSymbolUniqueId(429); + static constexpr const TSymbolUniqueId notFunc_Bool2 = TSymbolUniqueId(430); + static constexpr const TSymbolUniqueId notFunc_Bool3 = TSymbolUniqueId(431); + static constexpr const TSymbolUniqueId notFunc_Bool4 = TSymbolUniqueId(432); + static constexpr const TSymbolUniqueId bitfieldExtract_Int1_Int1_Int1 = TSymbolUniqueId(433); + static constexpr const TSymbolUniqueId bitfieldExtract_Int2_Int1_Int1 = TSymbolUniqueId(434); + static constexpr const TSymbolUniqueId bitfieldExtract_Int3_Int1_Int1 = TSymbolUniqueId(435); + static constexpr const TSymbolUniqueId bitfieldExtract_Int4_Int1_Int1 = TSymbolUniqueId(436); + static constexpr const TSymbolUniqueId bitfieldExtract_UInt1_Int1_Int1 = TSymbolUniqueId(437); + static constexpr const TSymbolUniqueId bitfieldExtract_UInt2_Int1_Int1 = TSymbolUniqueId(438); + static constexpr const TSymbolUniqueId bitfieldExtract_UInt3_Int1_Int1 = TSymbolUniqueId(439); + static constexpr const TSymbolUniqueId bitfieldExtract_UInt4_Int1_Int1 = TSymbolUniqueId(440); + static constexpr const TSymbolUniqueId bitfieldInsert_Int1_Int1_Int1_Int1 = + TSymbolUniqueId(441); + static constexpr const TSymbolUniqueId bitfieldInsert_Int2_Int2_Int1_Int1 = + TSymbolUniqueId(442); + static constexpr const TSymbolUniqueId bitfieldInsert_Int3_Int3_Int1_Int1 = + TSymbolUniqueId(443); + static constexpr const TSymbolUniqueId bitfieldInsert_Int4_Int4_Int1_Int1 = + TSymbolUniqueId(444); + static constexpr const TSymbolUniqueId bitfieldInsert_UInt1_UInt1_Int1_Int1 = + TSymbolUniqueId(445); + static constexpr const TSymbolUniqueId bitfieldInsert_UInt2_UInt2_Int1_Int1 = + TSymbolUniqueId(446); + static constexpr const TSymbolUniqueId bitfieldInsert_UInt3_UInt3_Int1_Int1 = + TSymbolUniqueId(447); + static constexpr const TSymbolUniqueId bitfieldInsert_UInt4_UInt4_Int1_Int1 = + TSymbolUniqueId(448); + static constexpr const TSymbolUniqueId bitfieldReverse_Int1 = TSymbolUniqueId(449); + static constexpr const TSymbolUniqueId bitfieldReverse_Int2 = TSymbolUniqueId(450); + static constexpr const TSymbolUniqueId bitfieldReverse_Int3 = TSymbolUniqueId(451); + static constexpr const TSymbolUniqueId bitfieldReverse_Int4 = TSymbolUniqueId(452); + static constexpr const TSymbolUniqueId bitfieldReverse_UInt1 = TSymbolUniqueId(453); + static constexpr const TSymbolUniqueId bitfieldReverse_UInt2 = TSymbolUniqueId(454); + static constexpr const TSymbolUniqueId bitfieldReverse_UInt3 = TSymbolUniqueId(455); + static constexpr const TSymbolUniqueId bitfieldReverse_UInt4 = TSymbolUniqueId(456); + static constexpr const TSymbolUniqueId bitCount_Int1 = TSymbolUniqueId(457); + static constexpr const TSymbolUniqueId bitCount_Int2 = TSymbolUniqueId(458); + static constexpr const TSymbolUniqueId bitCount_Int3 = TSymbolUniqueId(459); + static constexpr const TSymbolUniqueId bitCount_Int4 = TSymbolUniqueId(460); + static constexpr const TSymbolUniqueId bitCount_UInt1 = TSymbolUniqueId(461); + static constexpr const TSymbolUniqueId bitCount_UInt2 = TSymbolUniqueId(462); + static constexpr const TSymbolUniqueId bitCount_UInt3 = TSymbolUniqueId(463); + static constexpr const TSymbolUniqueId bitCount_UInt4 = TSymbolUniqueId(464); + static constexpr const TSymbolUniqueId findLSB_Int1 = TSymbolUniqueId(465); + static constexpr const TSymbolUniqueId findLSB_Int2 = TSymbolUniqueId(466); + static constexpr const TSymbolUniqueId findLSB_Int3 = TSymbolUniqueId(467); + static constexpr const TSymbolUniqueId findLSB_Int4 = TSymbolUniqueId(468); + static constexpr const TSymbolUniqueId findLSB_UInt1 = TSymbolUniqueId(469); + static constexpr const TSymbolUniqueId findLSB_UInt2 = TSymbolUniqueId(470); + static constexpr const TSymbolUniqueId findLSB_UInt3 = TSymbolUniqueId(471); + static constexpr const TSymbolUniqueId findLSB_UInt4 = TSymbolUniqueId(472); + static constexpr const TSymbolUniqueId findMSB_Int1 = TSymbolUniqueId(473); + static constexpr const TSymbolUniqueId findMSB_Int2 = TSymbolUniqueId(474); + static constexpr const TSymbolUniqueId findMSB_Int3 = TSymbolUniqueId(475); + static constexpr const TSymbolUniqueId findMSB_Int4 = TSymbolUniqueId(476); + static constexpr const TSymbolUniqueId findMSB_UInt1 = TSymbolUniqueId(477); + static constexpr const TSymbolUniqueId findMSB_UInt2 = TSymbolUniqueId(478); + static constexpr const TSymbolUniqueId findMSB_UInt3 = TSymbolUniqueId(479); + static constexpr const TSymbolUniqueId findMSB_UInt4 = TSymbolUniqueId(480); + static constexpr const TSymbolUniqueId uaddCarry_UInt1_UInt1_UInt1 = TSymbolUniqueId(481); + static constexpr const TSymbolUniqueId pt_o_0D = TSymbolUniqueId(482); + static constexpr const TSymbolUniqueId uaddCarry_UInt2_UInt2_UInt2 = TSymbolUniqueId(483); + static constexpr const TSymbolUniqueId pt_o_1D = TSymbolUniqueId(484); + static constexpr const TSymbolUniqueId uaddCarry_UInt3_UInt3_UInt3 = TSymbolUniqueId(485); + static constexpr const TSymbolUniqueId pt_o_2D = TSymbolUniqueId(486); + static constexpr const TSymbolUniqueId uaddCarry_UInt4_UInt4_UInt4 = TSymbolUniqueId(487); + static constexpr const TSymbolUniqueId pt_o_3D = TSymbolUniqueId(488); + static constexpr const TSymbolUniqueId usubBorrow_UInt1_UInt1_UInt1 = TSymbolUniqueId(489); + static constexpr const TSymbolUniqueId usubBorrow_UInt2_UInt2_UInt2 = TSymbolUniqueId(490); + static constexpr const TSymbolUniqueId usubBorrow_UInt3_UInt3_UInt3 = TSymbolUniqueId(491); + static constexpr const TSymbolUniqueId usubBorrow_UInt4_UInt4_UInt4 = TSymbolUniqueId(492); + static constexpr const TSymbolUniqueId umulExtended_UInt1_UInt1_UInt1_UInt1 = + TSymbolUniqueId(493); + static constexpr const TSymbolUniqueId umulExtended_UInt2_UInt2_UInt2_UInt2 = + TSymbolUniqueId(494); + static constexpr const TSymbolUniqueId umulExtended_UInt3_UInt3_UInt3_UInt3 = + TSymbolUniqueId(495); + static constexpr const TSymbolUniqueId umulExtended_UInt4_UInt4_UInt4_UInt4 = + TSymbolUniqueId(496); + static constexpr const TSymbolUniqueId imulExtended_Int1_Int1_Int1_Int1 = TSymbolUniqueId(497); + static constexpr const TSymbolUniqueId imulExtended_Int2_Int2_Int2_Int2 = TSymbolUniqueId(498); + static constexpr const TSymbolUniqueId imulExtended_Int3_Int3_Int3_Int3 = TSymbolUniqueId(499); + static constexpr const TSymbolUniqueId imulExtended_Int4_Int4_Int4_Int4 = TSymbolUniqueId(500); + static constexpr const TSymbolUniqueId texture2D_Sampler2D1_Float2 = TSymbolUniqueId(501); + static constexpr const TSymbolUniqueId pt0H = TSymbolUniqueId(502); + static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float3 = TSymbolUniqueId(503); + static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float4 = TSymbolUniqueId(504); + static constexpr const TSymbolUniqueId textureCube_SamplerCube1_Float3 = TSymbolUniqueId(505); + static constexpr const TSymbolUniqueId pt0J = TSymbolUniqueId(506); + static constexpr const TSymbolUniqueId texture2D_SamplerExternalOES1_Float2 = + TSymbolUniqueId(507); + static constexpr const TSymbolUniqueId pt0L = TSymbolUniqueId(508); + static constexpr const TSymbolUniqueId texture2DProj_SamplerExternalOES1_Float3 = + TSymbolUniqueId(509); + static constexpr const TSymbolUniqueId texture2DProj_SamplerExternalOES1_Float4 = + TSymbolUniqueId(510); + static constexpr const TSymbolUniqueId texture2DRect_Sampler2DRect1_Float2 = + TSymbolUniqueId(511); + static constexpr const TSymbolUniqueId pt0N = TSymbolUniqueId(512); + static constexpr const TSymbolUniqueId texture2DRectProj_Sampler2DRect1_Float3 = + TSymbolUniqueId(513); + static constexpr const TSymbolUniqueId texture2DRectProj_Sampler2DRect1_Float4 = + TSymbolUniqueId(514); + static constexpr const TSymbolUniqueId texture_Sampler2DRect1_Float2 = TSymbolUniqueId(515); + static constexpr const TSymbolUniqueId textureProj_Sampler2DRect1_Float3 = TSymbolUniqueId(516); + static constexpr const TSymbolUniqueId textureProj_Sampler2DRect1_Float4 = TSymbolUniqueId(517); + static constexpr const TSymbolUniqueId texture2DGradEXT_Sampler2D1_Float2_Float2_Float2 = + TSymbolUniqueId(518); + static constexpr const TSymbolUniqueId texture2DProjGradEXT_Sampler2D1_Float3_Float2_Float2 = + TSymbolUniqueId(519); + static constexpr const TSymbolUniqueId texture2DProjGradEXT_Sampler2D1_Float4_Float2_Float2 = + TSymbolUniqueId(520); + static constexpr const TSymbolUniqueId textureCubeGradEXT_SamplerCube1_Float3_Float3_Float3 = + TSymbolUniqueId(521); + static constexpr const TSymbolUniqueId texture2D_Sampler2D1_Float2_Float1 = + TSymbolUniqueId(522); + static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float3_Float1 = + TSymbolUniqueId(523); + static constexpr const TSymbolUniqueId texture2DProj_Sampler2D1_Float4_Float1 = + TSymbolUniqueId(524); + static constexpr const TSymbolUniqueId textureCube_SamplerCube1_Float3_Float1 = + TSymbolUniqueId(525); + static constexpr const TSymbolUniqueId dFdxExt_Float1 = TSymbolUniqueId(526); + static constexpr const TSymbolUniqueId dFdxExt_Float2 = TSymbolUniqueId(527); + static constexpr const TSymbolUniqueId dFdxExt_Float3 = TSymbolUniqueId(528); + static constexpr const TSymbolUniqueId dFdxExt_Float4 = TSymbolUniqueId(529); + static constexpr const TSymbolUniqueId dFdyExt_Float1 = TSymbolUniqueId(530); + static constexpr const TSymbolUniqueId dFdyExt_Float2 = TSymbolUniqueId(531); + static constexpr const TSymbolUniqueId dFdyExt_Float3 = TSymbolUniqueId(532); + static constexpr const TSymbolUniqueId dFdyExt_Float4 = TSymbolUniqueId(533); + static constexpr const TSymbolUniqueId fwidthExt_Float1 = TSymbolUniqueId(534); + static constexpr const TSymbolUniqueId fwidthExt_Float2 = TSymbolUniqueId(535); + static constexpr const TSymbolUniqueId fwidthExt_Float3 = TSymbolUniqueId(536); + static constexpr const TSymbolUniqueId fwidthExt_Float4 = TSymbolUniqueId(537); + static constexpr const TSymbolUniqueId texture2DLodEXT_Sampler2D1_Float2_Float1 = + TSymbolUniqueId(538); + static constexpr const TSymbolUniqueId texture2DProjLodEXT_Sampler2D1_Float3_Float1 = + TSymbolUniqueId(539); + static constexpr const TSymbolUniqueId texture2DProjLodEXT_Sampler2D1_Float4_Float1 = + TSymbolUniqueId(540); + static constexpr const TSymbolUniqueId textureCubeLodEXT_SamplerCube1_Float3_Float1 = + TSymbolUniqueId(541); + static constexpr const TSymbolUniqueId texture2DLod_Sampler2D1_Float2_Float1 = + TSymbolUniqueId(542); + static constexpr const TSymbolUniqueId texture2DProjLod_Sampler2D1_Float3_Float1 = + TSymbolUniqueId(543); + static constexpr const TSymbolUniqueId texture2DProjLod_Sampler2D1_Float4_Float1 = + TSymbolUniqueId(544); + static constexpr const TSymbolUniqueId textureCubeLod_SamplerCube1_Float3_Float1 = + TSymbolUniqueId(545); + static constexpr const TSymbolUniqueId texture_Sampler2D1_Float2 = TSymbolUniqueId(546); + static constexpr const TSymbolUniqueId texture_ISampler2D1_Float2 = TSymbolUniqueId(547); + static constexpr const TSymbolUniqueId pt0P = TSymbolUniqueId(548); + static constexpr const TSymbolUniqueId texture_USampler2D1_Float2 = TSymbolUniqueId(549); + static constexpr const TSymbolUniqueId pt0U = TSymbolUniqueId(550); + static constexpr const TSymbolUniqueId texture_Sampler3D1_Float3 = TSymbolUniqueId(551); + static constexpr const TSymbolUniqueId pt0I = TSymbolUniqueId(552); + static constexpr const TSymbolUniqueId texture_ISampler3D1_Float3 = TSymbolUniqueId(553); + static constexpr const TSymbolUniqueId pt0Q = TSymbolUniqueId(554); + static constexpr const TSymbolUniqueId texture_USampler3D1_Float3 = TSymbolUniqueId(555); + static constexpr const TSymbolUniqueId pt0V = TSymbolUniqueId(556); + static constexpr const TSymbolUniqueId texture_SamplerCube1_Float3 = TSymbolUniqueId(557); + static constexpr const TSymbolUniqueId texture_ISamplerCube1_Float3 = TSymbolUniqueId(558); + static constexpr const TSymbolUniqueId pt0R = TSymbolUniqueId(559); + static constexpr const TSymbolUniqueId texture_USamplerCube1_Float3 = TSymbolUniqueId(560); + static constexpr const TSymbolUniqueId pt0W = TSymbolUniqueId(561); + static constexpr const TSymbolUniqueId texture_Sampler2DArray1_Float3 = TSymbolUniqueId(562); + static constexpr const TSymbolUniqueId pt0K = TSymbolUniqueId(563); + static constexpr const TSymbolUniqueId texture_ISampler2DArray1_Float3 = TSymbolUniqueId(564); + static constexpr const TSymbolUniqueId pt0S = TSymbolUniqueId(565); + static constexpr const TSymbolUniqueId texture_USampler2DArray1_Float3 = TSymbolUniqueId(566); + static constexpr const TSymbolUniqueId pt0X = TSymbolUniqueId(567); + static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float3 = TSymbolUniqueId(568); + static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float3 = TSymbolUniqueId(569); + static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float3 = TSymbolUniqueId(570); + static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float4 = TSymbolUniqueId(571); + static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float4 = TSymbolUniqueId(572); + static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float4 = TSymbolUniqueId(573); + static constexpr const TSymbolUniqueId textureProj_Sampler3D1_Float4 = TSymbolUniqueId(574); + static constexpr const TSymbolUniqueId textureProj_ISampler3D1_Float4 = TSymbolUniqueId(575); + static constexpr const TSymbolUniqueId textureProj_USampler3D1_Float4 = TSymbolUniqueId(576); + static constexpr const TSymbolUniqueId textureLod_Sampler2D1_Float2_Float1 = + TSymbolUniqueId(577); + static constexpr const TSymbolUniqueId textureLod_ISampler2D1_Float2_Float1 = + TSymbolUniqueId(578); + static constexpr const TSymbolUniqueId textureLod_USampler2D1_Float2_Float1 = + TSymbolUniqueId(579); + static constexpr const TSymbolUniqueId textureLod_Sampler3D1_Float3_Float1 = + TSymbolUniqueId(580); + static constexpr const TSymbolUniqueId textureLod_ISampler3D1_Float3_Float1 = + TSymbolUniqueId(581); + static constexpr const TSymbolUniqueId textureLod_USampler3D1_Float3_Float1 = + TSymbolUniqueId(582); + static constexpr const TSymbolUniqueId textureLod_SamplerCube1_Float3_Float1 = + TSymbolUniqueId(583); + static constexpr const TSymbolUniqueId textureLod_ISamplerCube1_Float3_Float1 = + TSymbolUniqueId(584); + static constexpr const TSymbolUniqueId textureLod_USamplerCube1_Float3_Float1 = + TSymbolUniqueId(585); + static constexpr const TSymbolUniqueId textureLod_Sampler2DArray1_Float3_Float1 = + TSymbolUniqueId(586); + static constexpr const TSymbolUniqueId textureLod_ISampler2DArray1_Float3_Float1 = + TSymbolUniqueId(587); + static constexpr const TSymbolUniqueId textureLod_USampler2DArray1_Float3_Float1 = + TSymbolUniqueId(588); + static constexpr const TSymbolUniqueId texture_Sampler2DShadow1_Float3 = TSymbolUniqueId(589); + static constexpr const TSymbolUniqueId pt0Z = TSymbolUniqueId(590); + static constexpr const TSymbolUniqueId texture_SamplerCubeShadow1_Float4 = TSymbolUniqueId(591); + static constexpr const TSymbolUniqueId pt0a = TSymbolUniqueId(592); + static constexpr const TSymbolUniqueId texture_Sampler2DArrayShadow1_Float4 = + TSymbolUniqueId(593); + static constexpr const TSymbolUniqueId pt0b = TSymbolUniqueId(594); + static constexpr const TSymbolUniqueId textureProj_Sampler2DShadow1_Float4 = + TSymbolUniqueId(595); + static constexpr const TSymbolUniqueId textureLod_Sampler2DShadow1_Float3_Float1 = + TSymbolUniqueId(596); + static constexpr const TSymbolUniqueId textureSize_Sampler2D1_Int1 = TSymbolUniqueId(597); + static constexpr const TSymbolUniqueId textureSize_ISampler2D1_Int1 = TSymbolUniqueId(598); + static constexpr const TSymbolUniqueId textureSize_USampler2D1_Int1 = TSymbolUniqueId(599); + static constexpr const TSymbolUniqueId textureSize_Sampler3D1_Int1 = TSymbolUniqueId(600); + static constexpr const TSymbolUniqueId textureSize_ISampler3D1_Int1 = TSymbolUniqueId(601); + static constexpr const TSymbolUniqueId textureSize_USampler3D1_Int1 = TSymbolUniqueId(602); + static constexpr const TSymbolUniqueId textureSize_SamplerCube1_Int1 = TSymbolUniqueId(603); + static constexpr const TSymbolUniqueId textureSize_ISamplerCube1_Int1 = TSymbolUniqueId(604); + static constexpr const TSymbolUniqueId textureSize_USamplerCube1_Int1 = TSymbolUniqueId(605); + static constexpr const TSymbolUniqueId textureSize_Sampler2DArray1_Int1 = TSymbolUniqueId(606); + static constexpr const TSymbolUniqueId textureSize_ISampler2DArray1_Int1 = TSymbolUniqueId(607); + static constexpr const TSymbolUniqueId textureSize_USampler2DArray1_Int1 = TSymbolUniqueId(608); + static constexpr const TSymbolUniqueId textureSize_Sampler2DShadow1_Int1 = TSymbolUniqueId(609); + static constexpr const TSymbolUniqueId textureSize_SamplerCubeShadow1_Int1 = + TSymbolUniqueId(610); + static constexpr const TSymbolUniqueId textureSize_Sampler2DArrayShadow1_Int1 = + TSymbolUniqueId(611); + static constexpr const TSymbolUniqueId textureSize_Sampler2DMS1 = TSymbolUniqueId(612); + static constexpr const TSymbolUniqueId pt0O = TSymbolUniqueId(613); + static constexpr const TSymbolUniqueId textureSize_ISampler2DMS1 = TSymbolUniqueId(614); + static constexpr const TSymbolUniqueId pt0T = TSymbolUniqueId(615); + static constexpr const TSymbolUniqueId textureSize_USampler2DMS1 = TSymbolUniqueId(616); + static constexpr const TSymbolUniqueId pt0Y = TSymbolUniqueId(617); + static constexpr const TSymbolUniqueId textureProjLod_Sampler2D1_Float3_Float1 = + TSymbolUniqueId(618); + static constexpr const TSymbolUniqueId textureProjLod_ISampler2D1_Float3_Float1 = + TSymbolUniqueId(619); + static constexpr const TSymbolUniqueId textureProjLod_USampler2D1_Float3_Float1 = + TSymbolUniqueId(620); + static constexpr const TSymbolUniqueId textureProjLod_Sampler2D1_Float4_Float1 = + TSymbolUniqueId(621); + static constexpr const TSymbolUniqueId textureProjLod_ISampler2D1_Float4_Float1 = + TSymbolUniqueId(622); + static constexpr const TSymbolUniqueId textureProjLod_USampler2D1_Float4_Float1 = + TSymbolUniqueId(623); + static constexpr const TSymbolUniqueId textureProjLod_Sampler3D1_Float4_Float1 = + TSymbolUniqueId(624); + static constexpr const TSymbolUniqueId textureProjLod_ISampler3D1_Float4_Float1 = + TSymbolUniqueId(625); + static constexpr const TSymbolUniqueId textureProjLod_USampler3D1_Float4_Float1 = + TSymbolUniqueId(626); + static constexpr const TSymbolUniqueId textureProjLod_Sampler2DShadow1_Float4_Float1 = + TSymbolUniqueId(627); + static constexpr const TSymbolUniqueId texelFetch_Sampler2D1_Int2_Int1 = TSymbolUniqueId(628); + static constexpr const TSymbolUniqueId texelFetch_ISampler2D1_Int2_Int1 = TSymbolUniqueId(629); + static constexpr const TSymbolUniqueId texelFetch_USampler2D1_Int2_Int1 = TSymbolUniqueId(630); + static constexpr const TSymbolUniqueId texelFetch_Sampler3D1_Int3_Int1 = TSymbolUniqueId(631); + static constexpr const TSymbolUniqueId texelFetch_ISampler3D1_Int3_Int1 = TSymbolUniqueId(632); + static constexpr const TSymbolUniqueId texelFetch_USampler3D1_Int3_Int1 = TSymbolUniqueId(633); + static constexpr const TSymbolUniqueId texelFetch_Sampler2DArray1_Int3_Int1 = + TSymbolUniqueId(634); + static constexpr const TSymbolUniqueId texelFetch_ISampler2DArray1_Int3_Int1 = + TSymbolUniqueId(635); + static constexpr const TSymbolUniqueId texelFetch_USampler2DArray1_Int3_Int1 = + TSymbolUniqueId(636); + static constexpr const TSymbolUniqueId textureGrad_Sampler2D1_Float2_Float2_Float2 = + TSymbolUniqueId(637); + static constexpr const TSymbolUniqueId textureGrad_ISampler2D1_Float2_Float2_Float2 = + TSymbolUniqueId(638); + static constexpr const TSymbolUniqueId textureGrad_USampler2D1_Float2_Float2_Float2 = + TSymbolUniqueId(639); + static constexpr const TSymbolUniqueId textureGrad_Sampler3D1_Float3_Float3_Float3 = + TSymbolUniqueId(640); + static constexpr const TSymbolUniqueId textureGrad_ISampler3D1_Float3_Float3_Float3 = + TSymbolUniqueId(641); + static constexpr const TSymbolUniqueId textureGrad_USampler3D1_Float3_Float3_Float3 = + TSymbolUniqueId(642); + static constexpr const TSymbolUniqueId textureGrad_SamplerCube1_Float3_Float3_Float3 = + TSymbolUniqueId(643); + static constexpr const TSymbolUniqueId textureGrad_ISamplerCube1_Float3_Float3_Float3 = + TSymbolUniqueId(644); + static constexpr const TSymbolUniqueId textureGrad_USamplerCube1_Float3_Float3_Float3 = + TSymbolUniqueId(645); + static constexpr const TSymbolUniqueId textureGrad_Sampler2DShadow1_Float3_Float2_Float2 = + TSymbolUniqueId(646); + static constexpr const TSymbolUniqueId textureGrad_SamplerCubeShadow1_Float4_Float3_Float3 = + TSymbolUniqueId(647); + static constexpr const TSymbolUniqueId textureGrad_Sampler2DArray1_Float3_Float2_Float2 = + TSymbolUniqueId(648); + static constexpr const TSymbolUniqueId textureGrad_ISampler2DArray1_Float3_Float2_Float2 = + TSymbolUniqueId(649); + static constexpr const TSymbolUniqueId textureGrad_USampler2DArray1_Float3_Float2_Float2 = + TSymbolUniqueId(650); + static constexpr const TSymbolUniqueId textureGrad_Sampler2DArrayShadow1_Float4_Float2_Float2 = + TSymbolUniqueId(651); + static constexpr const TSymbolUniqueId textureProjGrad_Sampler2D1_Float3_Float2_Float2 = + TSymbolUniqueId(652); + static constexpr const TSymbolUniqueId textureProjGrad_ISampler2D1_Float3_Float2_Float2 = + TSymbolUniqueId(653); + static constexpr const TSymbolUniqueId textureProjGrad_USampler2D1_Float3_Float2_Float2 = + TSymbolUniqueId(654); + static constexpr const TSymbolUniqueId textureProjGrad_Sampler2D1_Float4_Float2_Float2 = + TSymbolUniqueId(655); + static constexpr const TSymbolUniqueId textureProjGrad_ISampler2D1_Float4_Float2_Float2 = + TSymbolUniqueId(656); + static constexpr const TSymbolUniqueId textureProjGrad_USampler2D1_Float4_Float2_Float2 = + TSymbolUniqueId(657); + static constexpr const TSymbolUniqueId textureProjGrad_Sampler3D1_Float4_Float3_Float3 = + TSymbolUniqueId(658); + static constexpr const TSymbolUniqueId textureProjGrad_ISampler3D1_Float4_Float3_Float3 = + TSymbolUniqueId(659); + static constexpr const TSymbolUniqueId textureProjGrad_USampler3D1_Float4_Float3_Float3 = + TSymbolUniqueId(660); + static constexpr const TSymbolUniqueId textureProjGrad_Sampler2DShadow1_Float4_Float2_Float2 = + TSymbolUniqueId(661); + static constexpr const TSymbolUniqueId textureOffset_Sampler2D1_Float2_Int2 = + TSymbolUniqueId(662); + static constexpr const TSymbolUniqueId textureOffset_ISampler2D1_Float2_Int2 = + TSymbolUniqueId(663); + static constexpr const TSymbolUniqueId textureOffset_USampler2D1_Float2_Int2 = + TSymbolUniqueId(664); + static constexpr const TSymbolUniqueId textureOffset_Sampler3D1_Float3_Int3 = + TSymbolUniqueId(665); + static constexpr const TSymbolUniqueId textureOffset_ISampler3D1_Float3_Int3 = + TSymbolUniqueId(666); + static constexpr const TSymbolUniqueId textureOffset_USampler3D1_Float3_Int3 = + TSymbolUniqueId(667); + static constexpr const TSymbolUniqueId textureOffset_Sampler2DShadow1_Float3_Int2 = + TSymbolUniqueId(668); + static constexpr const TSymbolUniqueId textureOffset_Sampler2DArray1_Float3_Int2 = + TSymbolUniqueId(669); + static constexpr const TSymbolUniqueId textureOffset_ISampler2DArray1_Float3_Int2 = + TSymbolUniqueId(670); + static constexpr const TSymbolUniqueId textureOffset_USampler2DArray1_Float3_Int2 = + TSymbolUniqueId(671); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float3_Int2 = + TSymbolUniqueId(672); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float3_Int2 = + TSymbolUniqueId(673); + static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float3_Int2 = + TSymbolUniqueId(674); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float4_Int2 = + TSymbolUniqueId(675); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float4_Int2 = + TSymbolUniqueId(676); + static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float4_Int2 = + TSymbolUniqueId(677); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler3D1_Float4_Int3 = + TSymbolUniqueId(678); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler3D1_Float4_Int3 = + TSymbolUniqueId(679); + static constexpr const TSymbolUniqueId textureProjOffset_USampler3D1_Float4_Int3 = + TSymbolUniqueId(680); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2DShadow1_Float4_Int2 = + TSymbolUniqueId(681); + static constexpr const TSymbolUniqueId textureLodOffset_Sampler2D1_Float2_Float1_Int2 = + TSymbolUniqueId(682); + static constexpr const TSymbolUniqueId textureLodOffset_ISampler2D1_Float2_Float1_Int2 = + TSymbolUniqueId(683); + static constexpr const TSymbolUniqueId textureLodOffset_USampler2D1_Float2_Float1_Int2 = + TSymbolUniqueId(684); + static constexpr const TSymbolUniqueId textureLodOffset_Sampler3D1_Float3_Float1_Int3 = + TSymbolUniqueId(685); + static constexpr const TSymbolUniqueId textureLodOffset_ISampler3D1_Float3_Float1_Int3 = + TSymbolUniqueId(686); + static constexpr const TSymbolUniqueId textureLodOffset_USampler3D1_Float3_Float1_Int3 = + TSymbolUniqueId(687); + static constexpr const TSymbolUniqueId textureLodOffset_Sampler2DShadow1_Float3_Float1_Int2 = + TSymbolUniqueId(688); + static constexpr const TSymbolUniqueId textureLodOffset_Sampler2DArray1_Float3_Float1_Int2 = + TSymbolUniqueId(689); + static constexpr const TSymbolUniqueId textureLodOffset_ISampler2DArray1_Float3_Float1_Int2 = + TSymbolUniqueId(690); + static constexpr const TSymbolUniqueId textureLodOffset_USampler2DArray1_Float3_Float1_Int2 = + TSymbolUniqueId(691); + static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler2D1_Float3_Float1_Int2 = + TSymbolUniqueId(692); + static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler2D1_Float3_Float1_Int2 = + TSymbolUniqueId(693); + static constexpr const TSymbolUniqueId textureProjLodOffset_USampler2D1_Float3_Float1_Int2 = + TSymbolUniqueId(694); + static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler2D1_Float4_Float1_Int2 = + TSymbolUniqueId(695); + static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler2D1_Float4_Float1_Int2 = + TSymbolUniqueId(696); + static constexpr const TSymbolUniqueId textureProjLodOffset_USampler2D1_Float4_Float1_Int2 = + TSymbolUniqueId(697); + static constexpr const TSymbolUniqueId textureProjLodOffset_Sampler3D1_Float4_Float1_Int3 = + TSymbolUniqueId(698); + static constexpr const TSymbolUniqueId textureProjLodOffset_ISampler3D1_Float4_Float1_Int3 = + TSymbolUniqueId(699); + static constexpr const TSymbolUniqueId textureProjLodOffset_USampler3D1_Float4_Float1_Int3 = + TSymbolUniqueId(700); + static constexpr const TSymbolUniqueId + textureProjLodOffset_Sampler2DShadow1_Float4_Float1_Int2 = TSymbolUniqueId(701); + static constexpr const TSymbolUniqueId texelFetchOffset_Sampler2D1_Int2_Int1_Int2 = + TSymbolUniqueId(702); + static constexpr const TSymbolUniqueId texelFetchOffset_ISampler2D1_Int2_Int1_Int2 = + TSymbolUniqueId(703); + static constexpr const TSymbolUniqueId texelFetchOffset_USampler2D1_Int2_Int1_Int2 = + TSymbolUniqueId(704); + static constexpr const TSymbolUniqueId texelFetchOffset_Sampler3D1_Int3_Int1_Int3 = + TSymbolUniqueId(705); + static constexpr const TSymbolUniqueId texelFetchOffset_ISampler3D1_Int3_Int1_Int3 = + TSymbolUniqueId(706); + static constexpr const TSymbolUniqueId texelFetchOffset_USampler3D1_Int3_Int1_Int3 = + TSymbolUniqueId(707); + static constexpr const TSymbolUniqueId texelFetchOffset_Sampler2DArray1_Int3_Int1_Int2 = + TSymbolUniqueId(708); + static constexpr const TSymbolUniqueId texelFetchOffset_ISampler2DArray1_Int3_Int1_Int2 = + TSymbolUniqueId(709); + static constexpr const TSymbolUniqueId texelFetchOffset_USampler2DArray1_Int3_Int1_Int2 = + TSymbolUniqueId(710); + static constexpr const TSymbolUniqueId textureGradOffset_Sampler2D1_Float2_Float2_Float2_Int2 = + TSymbolUniqueId(711); + static constexpr const TSymbolUniqueId textureGradOffset_ISampler2D1_Float2_Float2_Float2_Int2 = + TSymbolUniqueId(712); + static constexpr const TSymbolUniqueId textureGradOffset_USampler2D1_Float2_Float2_Float2_Int2 = + TSymbolUniqueId(713); + static constexpr const TSymbolUniqueId textureGradOffset_Sampler3D1_Float3_Float3_Float3_Int3 = + TSymbolUniqueId(714); + static constexpr const TSymbolUniqueId textureGradOffset_ISampler3D1_Float3_Float3_Float3_Int3 = + TSymbolUniqueId(715); + static constexpr const TSymbolUniqueId textureGradOffset_USampler3D1_Float3_Float3_Float3_Int3 = + TSymbolUniqueId(716); + static constexpr const TSymbolUniqueId + textureGradOffset_Sampler2DShadow1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(717); + static constexpr const TSymbolUniqueId + textureGradOffset_Sampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(718); + static constexpr const TSymbolUniqueId + textureGradOffset_ISampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(719); + static constexpr const TSymbolUniqueId + textureGradOffset_USampler2DArray1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(720); + static constexpr const TSymbolUniqueId + textureGradOffset_Sampler2DArrayShadow1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(721); + static constexpr const TSymbolUniqueId + textureProjGradOffset_Sampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(722); + static constexpr const TSymbolUniqueId + textureProjGradOffset_ISampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(723); + static constexpr const TSymbolUniqueId + textureProjGradOffset_USampler2D1_Float3_Float2_Float2_Int2 = TSymbolUniqueId(724); + static constexpr const TSymbolUniqueId + textureProjGradOffset_Sampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(725); + static constexpr const TSymbolUniqueId + textureProjGradOffset_ISampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(726); + static constexpr const TSymbolUniqueId + textureProjGradOffset_USampler2D1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(727); + static constexpr const TSymbolUniqueId + textureProjGradOffset_Sampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(728); + static constexpr const TSymbolUniqueId + textureProjGradOffset_ISampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(729); + static constexpr const TSymbolUniqueId + textureProjGradOffset_USampler3D1_Float4_Float3_Float3_Int3 = TSymbolUniqueId(730); + static constexpr const TSymbolUniqueId + textureProjGradOffset_Sampler2DShadow1_Float4_Float2_Float2_Int2 = TSymbolUniqueId(731); + static constexpr const TSymbolUniqueId textureOffset_Sampler2D1_Float2_Int2_Float1 = + TSymbolUniqueId(732); + static constexpr const TSymbolUniqueId textureOffset_ISampler2D1_Float2_Int2_Float1 = + TSymbolUniqueId(733); + static constexpr const TSymbolUniqueId textureOffset_USampler2D1_Float2_Int2_Float1 = + TSymbolUniqueId(734); + static constexpr const TSymbolUniqueId textureOffset_Sampler3D1_Float3_Int3_Float1 = + TSymbolUniqueId(735); + static constexpr const TSymbolUniqueId textureOffset_ISampler3D1_Float3_Int3_Float1 = + TSymbolUniqueId(736); + static constexpr const TSymbolUniqueId textureOffset_USampler3D1_Float3_Int3_Float1 = + TSymbolUniqueId(737); + static constexpr const TSymbolUniqueId textureOffset_Sampler2DShadow1_Float3_Int2_Float1 = + TSymbolUniqueId(738); + static constexpr const TSymbolUniqueId textureOffset_Sampler2DArray1_Float3_Int2_Float1 = + TSymbolUniqueId(739); + static constexpr const TSymbolUniqueId textureOffset_ISampler2DArray1_Float3_Int2_Float1 = + TSymbolUniqueId(740); + static constexpr const TSymbolUniqueId textureOffset_USampler2DArray1_Float3_Int2_Float1 = + TSymbolUniqueId(741); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float3_Int2_Float1 = + TSymbolUniqueId(742); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float3_Int2_Float1 = + TSymbolUniqueId(743); + static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float3_Int2_Float1 = + TSymbolUniqueId(744); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2D1_Float4_Int2_Float1 = + TSymbolUniqueId(745); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler2D1_Float4_Int2_Float1 = + TSymbolUniqueId(746); + static constexpr const TSymbolUniqueId textureProjOffset_USampler2D1_Float4_Int2_Float1 = + TSymbolUniqueId(747); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler3D1_Float4_Int3_Float1 = + TSymbolUniqueId(748); + static constexpr const TSymbolUniqueId textureProjOffset_ISampler3D1_Float4_Int3_Float1 = + TSymbolUniqueId(749); + static constexpr const TSymbolUniqueId textureProjOffset_USampler3D1_Float4_Int3_Float1 = + TSymbolUniqueId(750); + static constexpr const TSymbolUniqueId textureProjOffset_Sampler2DShadow1_Float4_Int2_Float1 = + TSymbolUniqueId(751); + static constexpr const TSymbolUniqueId texture_SamplerExternalOES1_Float2 = + TSymbolUniqueId(752); + static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float3 = + TSymbolUniqueId(753); + static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float4 = + TSymbolUniqueId(754); + static constexpr const TSymbolUniqueId textureSize_SamplerExternalOES1_Int1 = + TSymbolUniqueId(755); + static constexpr const TSymbolUniqueId texelFetch_SamplerExternalOES1_Int2_Int1 = + TSymbolUniqueId(756); + static constexpr const TSymbolUniqueId texture_SamplerExternal2DY2YEXT1_Float2 = + TSymbolUniqueId(757); + static constexpr const TSymbolUniqueId pt0M = TSymbolUniqueId(758); + static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float3 = + TSymbolUniqueId(759); + static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float4 = + TSymbolUniqueId(760); + static constexpr const TSymbolUniqueId rgb_2_yuv_Float3_YuvCscStandardEXT1 = + TSymbolUniqueId(761); + static constexpr const TSymbolUniqueId pt0G = TSymbolUniqueId(762); + static constexpr const TSymbolUniqueId yuv_2_rgb_Float3_YuvCscStandardEXT1 = + TSymbolUniqueId(763); + static constexpr const TSymbolUniqueId textureSize_SamplerExternal2DY2YEXT1_Int1 = + TSymbolUniqueId(764); + static constexpr const TSymbolUniqueId texelFetch_SamplerExternal2DY2YEXT1_Int2_Int1 = + TSymbolUniqueId(765); + static constexpr const TSymbolUniqueId texture_Sampler2D1_Float2_Float1 = TSymbolUniqueId(766); + static constexpr const TSymbolUniqueId texture_ISampler2D1_Float2_Float1 = TSymbolUniqueId(767); + static constexpr const TSymbolUniqueId texture_USampler2D1_Float2_Float1 = TSymbolUniqueId(768); + static constexpr const TSymbolUniqueId texture_Sampler3D1_Float3_Float1 = TSymbolUniqueId(769); + static constexpr const TSymbolUniqueId texture_ISampler3D1_Float3_Float1 = TSymbolUniqueId(770); + static constexpr const TSymbolUniqueId texture_USampler3D1_Float3_Float1 = TSymbolUniqueId(771); + static constexpr const TSymbolUniqueId texture_SamplerCube1_Float3_Float1 = + TSymbolUniqueId(772); + static constexpr const TSymbolUniqueId texture_ISamplerCube1_Float3_Float1 = + TSymbolUniqueId(773); + static constexpr const TSymbolUniqueId texture_USamplerCube1_Float3_Float1 = + TSymbolUniqueId(774); + static constexpr const TSymbolUniqueId texture_Sampler2DArray1_Float3_Float1 = + TSymbolUniqueId(775); + static constexpr const TSymbolUniqueId texture_ISampler2DArray1_Float3_Float1 = + TSymbolUniqueId(776); + static constexpr const TSymbolUniqueId texture_USampler2DArray1_Float3_Float1 = + TSymbolUniqueId(777); + static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float3_Float1 = + TSymbolUniqueId(778); + static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float3_Float1 = + TSymbolUniqueId(779); + static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float3_Float1 = + TSymbolUniqueId(780); + static constexpr const TSymbolUniqueId textureProj_Sampler2D1_Float4_Float1 = + TSymbolUniqueId(781); + static constexpr const TSymbolUniqueId textureProj_ISampler2D1_Float4_Float1 = + TSymbolUniqueId(782); + static constexpr const TSymbolUniqueId textureProj_USampler2D1_Float4_Float1 = + TSymbolUniqueId(783); + static constexpr const TSymbolUniqueId textureProj_Sampler3D1_Float4_Float1 = + TSymbolUniqueId(784); + static constexpr const TSymbolUniqueId textureProj_ISampler3D1_Float4_Float1 = + TSymbolUniqueId(785); + static constexpr const TSymbolUniqueId textureProj_USampler3D1_Float4_Float1 = + TSymbolUniqueId(786); + static constexpr const TSymbolUniqueId texture_Sampler2DShadow1_Float3_Float1 = + TSymbolUniqueId(787); + static constexpr const TSymbolUniqueId texture_SamplerCubeShadow1_Float4_Float1 = + TSymbolUniqueId(788); + static constexpr const TSymbolUniqueId textureProj_Sampler2DShadow1_Float4_Float1 = + TSymbolUniqueId(789); + static constexpr const TSymbolUniqueId texture_SamplerExternalOES1_Float2_Float1 = + TSymbolUniqueId(790); + static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float3_Float1 = + TSymbolUniqueId(791); + static constexpr const TSymbolUniqueId textureProj_SamplerExternalOES1_Float4_Float1 = + TSymbolUniqueId(792); + static constexpr const TSymbolUniqueId texture_SamplerExternal2DY2YEXT1_Float2_Float1 = + TSymbolUniqueId(793); + static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float3_Float1 = + TSymbolUniqueId(794); + static constexpr const TSymbolUniqueId textureProj_SamplerExternal2DY2YEXT1_Float4_Float1 = + TSymbolUniqueId(795); + static constexpr const TSymbolUniqueId texelFetch_Sampler2DMS1_Int2_Int1 = TSymbolUniqueId(796); + static constexpr const TSymbolUniqueId texelFetch_ISampler2DMS1_Int2_Int1 = + TSymbolUniqueId(797); + static constexpr const TSymbolUniqueId texelFetch_USampler2DMS1_Int2_Int1 = + TSymbolUniqueId(798); + static constexpr const TSymbolUniqueId textureGather_Sampler2D1_Float2 = TSymbolUniqueId(799); + static constexpr const TSymbolUniqueId textureGather_ISampler2D1_Float2 = TSymbolUniqueId(800); + static constexpr const TSymbolUniqueId textureGather_USampler2D1_Float2 = TSymbolUniqueId(801); + static constexpr const TSymbolUniqueId textureGather_Sampler2D1_Float2_Int1 = + TSymbolUniqueId(802); + static constexpr const TSymbolUniqueId textureGather_ISampler2D1_Float2_Int1 = + TSymbolUniqueId(803); + static constexpr const TSymbolUniqueId textureGather_USampler2D1_Float2_Int1 = + TSymbolUniqueId(804); + static constexpr const TSymbolUniqueId textureGather_Sampler2DArray1_Float3 = + TSymbolUniqueId(805); + static constexpr const TSymbolUniqueId textureGather_ISampler2DArray1_Float3 = + TSymbolUniqueId(806); + static constexpr const TSymbolUniqueId textureGather_USampler2DArray1_Float3 = + TSymbolUniqueId(807); + static constexpr const TSymbolUniqueId textureGather_Sampler2DArray1_Float3_Int1 = + TSymbolUniqueId(808); + static constexpr const TSymbolUniqueId textureGather_ISampler2DArray1_Float3_Int1 = + TSymbolUniqueId(809); + static constexpr const TSymbolUniqueId textureGather_USampler2DArray1_Float3_Int1 = + TSymbolUniqueId(810); + static constexpr const TSymbolUniqueId textureGather_SamplerCube1_Float3 = TSymbolUniqueId(811); + static constexpr const TSymbolUniqueId textureGather_ISamplerCube1_Float3 = + TSymbolUniqueId(812); + static constexpr const TSymbolUniqueId textureGather_USamplerCube1_Float3 = + TSymbolUniqueId(813); + static constexpr const TSymbolUniqueId textureGather_SamplerCube1_Float3_Int1 = + TSymbolUniqueId(814); + static constexpr const TSymbolUniqueId textureGather_ISamplerCube1_Float3_Int1 = + TSymbolUniqueId(815); + static constexpr const TSymbolUniqueId textureGather_USamplerCube1_Float3_Int1 = + TSymbolUniqueId(816); + static constexpr const TSymbolUniqueId textureGather_Sampler2DShadow1_Float2 = + TSymbolUniqueId(817); + static constexpr const TSymbolUniqueId textureGather_Sampler2DShadow1_Float2_Float1 = + TSymbolUniqueId(818); + static constexpr const TSymbolUniqueId textureGather_Sampler2DArrayShadow1_Float3 = + TSymbolUniqueId(819); + static constexpr const TSymbolUniqueId textureGather_Sampler2DArrayShadow1_Float3_Float1 = + TSymbolUniqueId(820); + static constexpr const TSymbolUniqueId textureGather_SamplerCubeShadow1_Float3 = + TSymbolUniqueId(821); + static constexpr const TSymbolUniqueId textureGather_SamplerCubeShadow1_Float3_Float1 = + TSymbolUniqueId(822); + static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2D1_Float2_Int2 = + TSymbolUniqueId(823); + static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2D1_Float2_Int2 = + TSymbolUniqueId(824); + static constexpr const TSymbolUniqueId textureGatherOffset_USampler2D1_Float2_Int2 = + TSymbolUniqueId(825); + static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2D1_Float2_Int2_Int1 = + TSymbolUniqueId(826); + static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2D1_Float2_Int2_Int1 = + TSymbolUniqueId(827); + static constexpr const TSymbolUniqueId textureGatherOffset_USampler2D1_Float2_Int2_Int1 = + TSymbolUniqueId(828); + static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DArray1_Float3_Int2 = + TSymbolUniqueId(829); + static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2DArray1_Float3_Int2 = + TSymbolUniqueId(830); + static constexpr const TSymbolUniqueId textureGatherOffset_USampler2DArray1_Float3_Int2 = + TSymbolUniqueId(831); + static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DArray1_Float3_Int2_Int1 = + TSymbolUniqueId(832); + static constexpr const TSymbolUniqueId textureGatherOffset_ISampler2DArray1_Float3_Int2_Int1 = + TSymbolUniqueId(833); + static constexpr const TSymbolUniqueId textureGatherOffset_USampler2DArray1_Float3_Int2_Int1 = + TSymbolUniqueId(834); + static constexpr const TSymbolUniqueId textureGatherOffset_Sampler2DShadow1_Float2_Float1_Int2 = + TSymbolUniqueId(835); + static constexpr const TSymbolUniqueId + textureGatherOffset_Sampler2DArrayShadow1_Float3_Float1_Int2 = TSymbolUniqueId(836); + static constexpr const TSymbolUniqueId dFdx_Float1 = TSymbolUniqueId(837); + static constexpr const TSymbolUniqueId dFdx_Float2 = TSymbolUniqueId(838); + static constexpr const TSymbolUniqueId dFdx_Float3 = TSymbolUniqueId(839); + static constexpr const TSymbolUniqueId dFdx_Float4 = TSymbolUniqueId(840); + static constexpr const TSymbolUniqueId dFdy_Float1 = TSymbolUniqueId(841); + static constexpr const TSymbolUniqueId dFdy_Float2 = TSymbolUniqueId(842); + static constexpr const TSymbolUniqueId dFdy_Float3 = TSymbolUniqueId(843); + static constexpr const TSymbolUniqueId dFdy_Float4 = TSymbolUniqueId(844); + static constexpr const TSymbolUniqueId fwidth_Float1 = TSymbolUniqueId(845); + static constexpr const TSymbolUniqueId fwidth_Float2 = TSymbolUniqueId(846); + static constexpr const TSymbolUniqueId fwidth_Float3 = TSymbolUniqueId(847); + static constexpr const TSymbolUniqueId fwidth_Float4 = TSymbolUniqueId(848); + static constexpr const TSymbolUniqueId atomicCounter_AtomicCounter1 = TSymbolUniqueId(849); + static constexpr const TSymbolUniqueId pt0F = TSymbolUniqueId(850); + static constexpr const TSymbolUniqueId atomicCounterIncrement_AtomicCounter1 = + TSymbolUniqueId(851); + static constexpr const TSymbolUniqueId atomicCounterDecrement_AtomicCounter1 = + TSymbolUniqueId(852); + static constexpr const TSymbolUniqueId atomicAdd_UInt1_UInt1 = TSymbolUniqueId(853); + static constexpr const TSymbolUniqueId pt_io_0D = TSymbolUniqueId(854); + static constexpr const TSymbolUniqueId atomicAdd_Int1_Int1 = TSymbolUniqueId(855); + static constexpr const TSymbolUniqueId pt_io_0C = TSymbolUniqueId(856); + static constexpr const TSymbolUniqueId atomicMin_UInt1_UInt1 = TSymbolUniqueId(857); + static constexpr const TSymbolUniqueId atomicMin_Int1_Int1 = TSymbolUniqueId(858); + static constexpr const TSymbolUniqueId atomicMax_UInt1_UInt1 = TSymbolUniqueId(859); + static constexpr const TSymbolUniqueId atomicMax_Int1_Int1 = TSymbolUniqueId(860); + static constexpr const TSymbolUniqueId atomicAnd_UInt1_UInt1 = TSymbolUniqueId(861); + static constexpr const TSymbolUniqueId atomicAnd_Int1_Int1 = TSymbolUniqueId(862); + static constexpr const TSymbolUniqueId atomicOr_UInt1_UInt1 = TSymbolUniqueId(863); + static constexpr const TSymbolUniqueId atomicOr_Int1_Int1 = TSymbolUniqueId(864); + static constexpr const TSymbolUniqueId atomicXor_UInt1_UInt1 = TSymbolUniqueId(865); + static constexpr const TSymbolUniqueId atomicXor_Int1_Int1 = TSymbolUniqueId(866); + static constexpr const TSymbolUniqueId atomicExchange_UInt1_UInt1 = TSymbolUniqueId(867); + static constexpr const TSymbolUniqueId atomicExchange_Int1_Int1 = TSymbolUniqueId(868); + static constexpr const TSymbolUniqueId atomicCompSwap_UInt1_UInt1_UInt1 = TSymbolUniqueId(869); + static constexpr const TSymbolUniqueId atomicCompSwap_Int1_Int1_Int1 = TSymbolUniqueId(870); + static constexpr const TSymbolUniqueId imageSize_Image2D1 = TSymbolUniqueId(871); + static constexpr const TSymbolUniqueId pt0c = TSymbolUniqueId(872); + static constexpr const TSymbolUniqueId imageSize_IImage2D1 = TSymbolUniqueId(873); + static constexpr const TSymbolUniqueId pt0d = TSymbolUniqueId(874); + static constexpr const TSymbolUniqueId imageSize_UImage2D1 = TSymbolUniqueId(875); + static constexpr const TSymbolUniqueId pt0e = TSymbolUniqueId(876); + static constexpr const TSymbolUniqueId imageSize_Image3D1 = TSymbolUniqueId(877); + static constexpr const TSymbolUniqueId pt0f = TSymbolUniqueId(878); + static constexpr const TSymbolUniqueId imageSize_IImage3D1 = TSymbolUniqueId(879); + static constexpr const TSymbolUniqueId pt0g = TSymbolUniqueId(880); + static constexpr const TSymbolUniqueId imageSize_UImage3D1 = TSymbolUniqueId(881); + static constexpr const TSymbolUniqueId pt0h = TSymbolUniqueId(882); + static constexpr const TSymbolUniqueId imageSize_Image2DArray1 = TSymbolUniqueId(883); + static constexpr const TSymbolUniqueId pt0i = TSymbolUniqueId(884); + static constexpr const TSymbolUniqueId imageSize_IImage2DArray1 = TSymbolUniqueId(885); + static constexpr const TSymbolUniqueId pt0j = TSymbolUniqueId(886); + static constexpr const TSymbolUniqueId imageSize_UImage2DArray1 = TSymbolUniqueId(887); + static constexpr const TSymbolUniqueId pt0k = TSymbolUniqueId(888); + static constexpr const TSymbolUniqueId imageSize_ImageCube1 = TSymbolUniqueId(889); + static constexpr const TSymbolUniqueId pt0l = TSymbolUniqueId(890); + static constexpr const TSymbolUniqueId imageSize_IImageCube1 = TSymbolUniqueId(891); + static constexpr const TSymbolUniqueId pt0m = TSymbolUniqueId(892); + static constexpr const TSymbolUniqueId imageSize_UImageCube1 = TSymbolUniqueId(893); + static constexpr const TSymbolUniqueId pt0n = TSymbolUniqueId(894); + static constexpr const TSymbolUniqueId imageLoad_Image2D1_Int2 = TSymbolUniqueId(895); + static constexpr const TSymbolUniqueId imageLoad_IImage2D1_Int2 = TSymbolUniqueId(896); + static constexpr const TSymbolUniqueId imageLoad_UImage2D1_Int2 = TSymbolUniqueId(897); + static constexpr const TSymbolUniqueId imageLoad_Image3D1_Int3 = TSymbolUniqueId(898); + static constexpr const TSymbolUniqueId imageLoad_IImage3D1_Int3 = TSymbolUniqueId(899); + static constexpr const TSymbolUniqueId imageLoad_UImage3D1_Int3 = TSymbolUniqueId(900); + static constexpr const TSymbolUniqueId imageLoad_Image2DArray1_Int3 = TSymbolUniqueId(901); + static constexpr const TSymbolUniqueId imageLoad_IImage2DArray1_Int3 = TSymbolUniqueId(902); + static constexpr const TSymbolUniqueId imageLoad_UImage2DArray1_Int3 = TSymbolUniqueId(903); + static constexpr const TSymbolUniqueId imageLoad_ImageCube1_Int3 = TSymbolUniqueId(904); + static constexpr const TSymbolUniqueId imageLoad_IImageCube1_Int3 = TSymbolUniqueId(905); + static constexpr const TSymbolUniqueId imageLoad_UImageCube1_Int3 = TSymbolUniqueId(906); + static constexpr const TSymbolUniqueId imageStore_Image2D1_Int2_Float4 = TSymbolUniqueId(907); + static constexpr const TSymbolUniqueId imageStore_IImage2D1_Int2_Int4 = TSymbolUniqueId(908); + static constexpr const TSymbolUniqueId imageStore_UImage2D1_Int2_UInt4 = TSymbolUniqueId(909); + static constexpr const TSymbolUniqueId imageStore_Image3D1_Int3_Float4 = TSymbolUniqueId(910); + static constexpr const TSymbolUniqueId imageStore_IImage3D1_Int3_Int4 = TSymbolUniqueId(911); + static constexpr const TSymbolUniqueId imageStore_UImage3D1_Int3_UInt4 = TSymbolUniqueId(912); + static constexpr const TSymbolUniqueId imageStore_Image2DArray1_Int3_Float4 = + TSymbolUniqueId(913); + static constexpr const TSymbolUniqueId imageStore_IImage2DArray1_Int3_Int4 = + TSymbolUniqueId(914); + static constexpr const TSymbolUniqueId imageStore_UImage2DArray1_Int3_UInt4 = + TSymbolUniqueId(915); + static constexpr const TSymbolUniqueId imageStore_ImageCube1_Int3_Float4 = TSymbolUniqueId(916); + static constexpr const TSymbolUniqueId imageStore_IImageCube1_Int3_Int4 = TSymbolUniqueId(917); + static constexpr const TSymbolUniqueId imageStore_UImageCube1_Int3_UInt4 = TSymbolUniqueId(918); + static constexpr const TSymbolUniqueId memoryBarrier = TSymbolUniqueId(919); + static constexpr const TSymbolUniqueId memoryBarrierAtomicCounter = TSymbolUniqueId(920); + static constexpr const TSymbolUniqueId memoryBarrierBuffer = TSymbolUniqueId(921); + static constexpr const TSymbolUniqueId memoryBarrierImage = TSymbolUniqueId(922); + static constexpr const TSymbolUniqueId barrier = TSymbolUniqueId(923); + static constexpr const TSymbolUniqueId memoryBarrierShared = TSymbolUniqueId(924); + static constexpr const TSymbolUniqueId groupMemoryBarrier = TSymbolUniqueId(925); + static constexpr const TSymbolUniqueId EmitVertex = TSymbolUniqueId(926); + static constexpr const TSymbolUniqueId EndPrimitive = TSymbolUniqueId(927); + static constexpr const TSymbolUniqueId gl_DepthRangeParameters = TSymbolUniqueId(928); + static constexpr const TSymbolUniqueId gl_DepthRange = TSymbolUniqueId(929); + static constexpr const TSymbolUniqueId gl_MaxVertexAttribs = TSymbolUniqueId(930); + static constexpr const TSymbolUniqueId gl_MaxVertexUniformVectors = TSymbolUniqueId(931); + static constexpr const TSymbolUniqueId gl_MaxVertexTextureImageUnits = TSymbolUniqueId(932); + static constexpr const TSymbolUniqueId gl_MaxCombinedTextureImageUnits = TSymbolUniqueId(933); + static constexpr const TSymbolUniqueId gl_MaxTextureImageUnits = TSymbolUniqueId(934); + static constexpr const TSymbolUniqueId gl_MaxFragmentUniformVectors = TSymbolUniqueId(935); + static constexpr const TSymbolUniqueId gl_MaxVaryingVectors = TSymbolUniqueId(936); + static constexpr const TSymbolUniqueId gl_MaxDrawBuffers = TSymbolUniqueId(937); + static constexpr const TSymbolUniqueId gl_MaxDualSourceDrawBuffersEXT = TSymbolUniqueId(938); + static constexpr const TSymbolUniqueId gl_MaxVertexOutputVectors = TSymbolUniqueId(939); + static constexpr const TSymbolUniqueId gl_MaxFragmentInputVectors = TSymbolUniqueId(940); + static constexpr const TSymbolUniqueId gl_MinProgramTexelOffset = TSymbolUniqueId(941); + static constexpr const TSymbolUniqueId gl_MaxProgramTexelOffset = TSymbolUniqueId(942); + static constexpr const TSymbolUniqueId gl_MaxImageUnits = TSymbolUniqueId(943); + static constexpr const TSymbolUniqueId gl_MaxVertexImageUniforms = TSymbolUniqueId(944); + static constexpr const TSymbolUniqueId gl_MaxFragmentImageUniforms = TSymbolUniqueId(945); + static constexpr const TSymbolUniqueId gl_MaxComputeImageUniforms = TSymbolUniqueId(946); + static constexpr const TSymbolUniqueId gl_MaxCombinedImageUniforms = TSymbolUniqueId(947); + static constexpr const TSymbolUniqueId gl_MaxCombinedShaderOutputResources = + TSymbolUniqueId(948); + static constexpr const TSymbolUniqueId gl_MaxComputeWorkGroupCount = TSymbolUniqueId(949); + static constexpr const TSymbolUniqueId gl_MaxComputeWorkGroupSize = TSymbolUniqueId(950); + static constexpr const TSymbolUniqueId gl_MaxComputeUniformComponents = TSymbolUniqueId(951); + static constexpr const TSymbolUniqueId gl_MaxComputeTextureImageUnits = TSymbolUniqueId(952); + static constexpr const TSymbolUniqueId gl_MaxComputeAtomicCounters = TSymbolUniqueId(953); + static constexpr const TSymbolUniqueId gl_MaxComputeAtomicCounterBuffers = TSymbolUniqueId(954); + static constexpr const TSymbolUniqueId gl_MaxVertexAtomicCounters = TSymbolUniqueId(955); + static constexpr const TSymbolUniqueId gl_MaxFragmentAtomicCounters = TSymbolUniqueId(956); + static constexpr const TSymbolUniqueId gl_MaxCombinedAtomicCounters = TSymbolUniqueId(957); + static constexpr const TSymbolUniqueId gl_MaxAtomicCounterBindings = TSymbolUniqueId(958); + static constexpr const TSymbolUniqueId gl_MaxVertexAtomicCounterBuffers = TSymbolUniqueId(959); + static constexpr const TSymbolUniqueId gl_MaxFragmentAtomicCounterBuffers = + TSymbolUniqueId(960); + static constexpr const TSymbolUniqueId gl_MaxCombinedAtomicCounterBuffers = + TSymbolUniqueId(961); + static constexpr const TSymbolUniqueId gl_MaxAtomicCounterBufferSize = TSymbolUniqueId(962); + static constexpr const TSymbolUniqueId gl_MaxGeometryInputComponents = TSymbolUniqueId(963); + static constexpr const TSymbolUniqueId gl_MaxGeometryOutputComponents = TSymbolUniqueId(964); + static constexpr const TSymbolUniqueId gl_MaxGeometryImageUniforms = TSymbolUniqueId(965); + static constexpr const TSymbolUniqueId gl_MaxGeometryTextureImageUnits = TSymbolUniqueId(966); + static constexpr const TSymbolUniqueId gl_MaxGeometryOutputVertices = TSymbolUniqueId(967); + static constexpr const TSymbolUniqueId gl_MaxGeometryTotalOutputComponents = + TSymbolUniqueId(968); + static constexpr const TSymbolUniqueId gl_MaxGeometryUniformComponents = TSymbolUniqueId(969); + static constexpr const TSymbolUniqueId gl_MaxGeometryAtomicCounters = TSymbolUniqueId(970); + static constexpr const TSymbolUniqueId gl_MaxGeometryAtomicCounterBuffers = + TSymbolUniqueId(971); + static constexpr const TSymbolUniqueId gl_FragCoord = TSymbolUniqueId(972); + static constexpr const TSymbolUniqueId gl_FrontFacing = TSymbolUniqueId(973); + static constexpr const TSymbolUniqueId gl_PointCoord = TSymbolUniqueId(974); + static constexpr const TSymbolUniqueId gl_FragColor = TSymbolUniqueId(975); + static constexpr const TSymbolUniqueId gl_FragData = TSymbolUniqueId(976); + static constexpr const TSymbolUniqueId gl_FragDepth = TSymbolUniqueId(977); + static constexpr const TSymbolUniqueId gl_SecondaryFragColorEXT = TSymbolUniqueId(978); + static constexpr const TSymbolUniqueId gl_SecondaryFragDataEXT = TSymbolUniqueId(979); + static constexpr const TSymbolUniqueId gl_FragDepthEXT = TSymbolUniqueId(980); + static constexpr const TSymbolUniqueId gl_LastFragData = TSymbolUniqueId(981); + static constexpr const TSymbolUniqueId gl_LastFragColor = TSymbolUniqueId(982); + static constexpr const TSymbolUniqueId gl_LastFragDataNV = TSymbolUniqueId(983); + static constexpr const TSymbolUniqueId gl_LastFragColorARM = TSymbolUniqueId(984); + static constexpr const TSymbolUniqueId gl_PrimitiveID = TSymbolUniqueId(985); + static constexpr const TSymbolUniqueId gl_Layer = TSymbolUniqueId(986); + static constexpr const TSymbolUniqueId gl_Position = TSymbolUniqueId(987); + static constexpr const TSymbolUniqueId gl_PointSize = TSymbolUniqueId(988); + static constexpr const TSymbolUniqueId gl_InstanceID = TSymbolUniqueId(989); + static constexpr const TSymbolUniqueId gl_VertexID = TSymbolUniqueId(990); + static constexpr const TSymbolUniqueId gl_ViewportIndex = TSymbolUniqueId(991); + static constexpr const TSymbolUniqueId gl_LayerVS = TSymbolUniqueId(992); + static constexpr const TSymbolUniqueId gl_NumWorkGroups = TSymbolUniqueId(993); + static constexpr const TSymbolUniqueId gl_WorkGroupSize = TSymbolUniqueId(994); + static constexpr const TSymbolUniqueId gl_WorkGroupID = TSymbolUniqueId(995); + static constexpr const TSymbolUniqueId gl_LocalInvocationID = TSymbolUniqueId(996); + static constexpr const TSymbolUniqueId gl_GlobalInvocationID = TSymbolUniqueId(997); + static constexpr const TSymbolUniqueId gl_LocalInvocationIndex = TSymbolUniqueId(998); + static constexpr const TSymbolUniqueId gl_PrimitiveIDIn = TSymbolUniqueId(999); + static constexpr const TSymbolUniqueId gl_InvocationID = TSymbolUniqueId(1000); + static constexpr const TSymbolUniqueId gl_PrimitiveIDGS = TSymbolUniqueId(1001); + static constexpr const TSymbolUniqueId gl_LayerGS = TSymbolUniqueId(1002); + static constexpr const TSymbolUniqueId gl_PerVertex = TSymbolUniqueId(1003); + static constexpr const TSymbolUniqueId gl_in = TSymbolUniqueId(1004); + static constexpr const TSymbolUniqueId gl_PerVertexOutBlock = TSymbolUniqueId(1005); + static constexpr const TSymbolUniqueId gl_PositionGS = TSymbolUniqueId(1006); + static constexpr const TSymbolUniqueId gl_ViewID_OVR = TSymbolUniqueId(1007); + static constexpr const TSymbolUniqueId gl_ViewID_OVRESSL1 = TSymbolUniqueId(1008); + +}; // class BuiltInId + +namespace BuiltInVariable +{ + +const TVariable *gl_FragColor(); +const TVariable *gl_FragCoord(); +const TVariable *gl_FragDepth(); +const TVariable *gl_FrontFacing(); +const TVariable *gl_GlobalInvocationID(); +const TVariable *gl_InstanceID(); +const TVariable *gl_InvocationID(); +const TVariable *gl_LastFragColor(); +const TVariable *gl_LastFragColorARM(); +const TVariable *gl_Layer(); +const TVariable *gl_LayerGS(); +const TVariable *gl_LayerVS(); +const TVariable *gl_LocalInvocationID(); +const TVariable *gl_LocalInvocationIndex(); +const TVariable *gl_NumWorkGroups(); +const TVariable *gl_PointCoord(); +const TVariable *gl_PointSize(); +const TVariable *gl_Position(); +const TVariable *gl_PrimitiveID(); +const TVariable *gl_PrimitiveIDGS(); +const TVariable *gl_PrimitiveIDIn(); +const TVariable *gl_SecondaryFragColorEXT(); +const TVariable *gl_VertexID(); +const TVariable *gl_ViewID_OVR(); +const TVariable *gl_ViewID_OVRESSL1(); +const TVariable *gl_ViewportIndex(); +const TVariable *gl_WorkGroupID(); +const TVariable *gl_WorkGroupSize(); + +} // namespace BuiltInVariable + +} // namespace sh + +#endif // COMPILER_TRANSLATOR_TREEUTIL_BUILTIN_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/FindMain.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/FindMain.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp index 091e21a38cbd..9823a0109379 100644 --- a/gfx/angle/checkout/src/compiler/translator/FindMain.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.cpp @@ -6,7 +6,7 @@ // FindMain.cpp: Find the main() function definition in a given AST. -#include "compiler/translator/FindMain.h" +#include "compiler/translator/tree_util/FindMain.h" #include "compiler/translator/IntermNode.h" #include "compiler/translator/Symbol.h" diff --git a/gfx/angle/checkout/src/compiler/translator/FindMain.h b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h similarity index 75% rename from gfx/angle/checkout/src/compiler/translator/FindMain.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h index bf2c45d871e6..f619e6ed6d99 100644 --- a/gfx/angle/checkout/src/compiler/translator/FindMain.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindMain.h @@ -6,8 +6,8 @@ // FindMain.h: Adds functions to get the main function definition and its body. -#ifndef COMPILER_TRANSLATOR_FINDMAIN_H_ -#define COMPILER_TRANSLATOR_FINDMAIN_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_ namespace sh { @@ -20,4 +20,4 @@ TIntermBlock *FindMainBody(TIntermBlock *root); } // namespace sh -#endif // COMPILER_TRANSLATOR_FINDMAIN_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDMAIN_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/FindSymbolNode.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp similarity index 91% rename from gfx/angle/checkout/src/compiler/translator/FindSymbolNode.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp index f63acf5a1bca..97318ef7219f 100644 --- a/gfx/angle/checkout/src/compiler/translator/FindSymbolNode.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp @@ -6,11 +6,11 @@ // FindSymbol.cpp: // Utility for finding a symbol node inside an AST tree. -#include "compiler/translator/FindSymbolNode.h" +#include "compiler/translator/tree_util/FindSymbolNode.h" #include "compiler/translator/ImmutableString.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/Symbol.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/FindSymbolNode.h b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h similarity index 73% rename from gfx/angle/checkout/src/compiler/translator/FindSymbolNode.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h index 0e6f8cb2fddc..f285479277f3 100644 --- a/gfx/angle/checkout/src/compiler/translator/FindSymbolNode.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/FindSymbolNode.h @@ -6,8 +6,8 @@ // FindSymbolNode.h: // Utility for finding a symbol node inside an AST tree. -#ifndef COMPILER_TRANSLATOR_FIND_SYMBOL_H_ -#define COMPILER_TRANSLATOR_FIND_SYMBOL_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_ namespace sh { @@ -20,4 +20,4 @@ const TIntermSymbol *FindSymbolNode(TIntermNode *root, const ImmutableString &sy } // namespace sh -#endif // COMPILER_TRANSLATOR_FIND_SYMBOL_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEUTIL_FINDSYMBOLNODE_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp similarity index 98% rename from gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp index 80180fbaae23..752b9e29b11e 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp @@ -8,7 +8,7 @@ // traversers. // -#include "compiler/translator/IntermNodePatternMatcher.h" +#include "compiler/translator/tree_util/IntermNodePatternMatcher.h" #include "compiler/translator/IntermNode.h" #include "compiler/translator/SymbolTable.h" diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h similarity index 92% rename from gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h index b83ec67e0afd..1e7db4e3a2a6 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNodePatternMatcher.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.h @@ -8,8 +8,8 @@ // traversers. // -#ifndef COMPILER_TRANSLATOR_INTERMNODEPATTERNMATCHER_H_ -#define COMPILER_TRANSLATOR_INTERMNODEPATTERNMATCHER_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_ namespace sh { @@ -76,4 +76,4 @@ class IntermNodePatternMatcher } // namespace sh -#endif +#endif // COMPILER_TRANSLATOR_TREEUTIL_INTERMNODEPATTERNMATCHER_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode_util.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp similarity index 98% rename from gfx/angle/checkout/src/compiler/translator/IntermNode_util.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp index df747bdc2a68..cb3029d87067 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNode_util.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.cpp @@ -6,7 +6,7 @@ // IntermNode_util.cpp: High-level utilities for creating AST nodes and node hierarchies. Mostly // meant to be used in AST transforms. -#include "compiler/translator/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermNode_util.h" #include "compiler/translator/FunctionLookup.h" #include "compiler/translator/SymbolTable.h" @@ -216,7 +216,7 @@ TVariable *DeclareTempVariable(TSymbolTable *symbolTable, { TVariable *variable = CreateTempVariable(symbolTable, new TType(initializer->getType()), qualifier); - *declarationOut = CreateTempInitDeclarationNode(variable, initializer); + *declarationOut = CreateTempInitDeclarationNode(variable, initializer); return variable; } @@ -246,7 +246,7 @@ TIntermSymbol *ReferenceBuiltInVariable(const ImmutableString &name, int shaderVersion) { const TVariable *var = - reinterpret_cast(symbolTable.findBuiltIn(name, shaderVersion, true)); + reinterpret_cast(symbolTable.findBuiltIn(name, shaderVersion)); ASSERT(var); return new TIntermSymbol(var); } @@ -261,7 +261,7 @@ TIntermTyped *CreateBuiltInFunctionCallNode(const char *name, TOperator op = fn->getBuiltInOp(); if (op != EOpCallBuiltInFunction && arguments->size() == 1) { - return new TIntermUnary(op, arguments->at(0)->getAsTyped()); + return new TIntermUnary(op, arguments->at(0)->getAsTyped(), fn); } return TIntermAggregate::CreateBuiltInFunctionCall(*fn, arguments); } diff --git a/gfx/angle/checkout/src/compiler/translator/IntermNode_util.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/IntermNode_util.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h index 99a6b001cd0c..fe5652a0c361 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermNode_util.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermNode_util.h @@ -52,7 +52,8 @@ TIntermBlock *EnsureBlock(TIntermNode *node); TIntermSymbol *ReferenceGlobalVariable(const ImmutableString &name, const TSymbolTable &symbolTable); -// Note: this can access desktop GLSL built-ins that are hidden from the parser. +// Note: this can't access desktop GLSL built-ins. Those can only be accessed directly through +// BuiltIn_autogen.h. TIntermSymbol *ReferenceBuiltInVariable(const ImmutableString &name, const TSymbolTable &symbolTable, int shaderVersion); diff --git a/gfx/angle/checkout/src/compiler/translator/IntermTraverse.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/IntermTraverse.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp index 1c9e67dde2a9..2cdc4057ecfb 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermTraverse.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp @@ -4,11 +4,11 @@ // found in the LICENSE file. // -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" #include "compiler/translator/InfoSink.h" -#include "compiler/translator/IntermNode_util.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/IntermNode_util.h" namespace sh { @@ -110,8 +110,8 @@ TIntermTraverser::TIntermTraverser(bool preVisit, : preVisit(preVisit), inVisit(inVisit), postVisit(postVisit), - mDepth(-1), mMaxDepth(0), + mMaxAllowedDepth(std::numeric_limits::max()), mInGlobalScope(true), mSymbolTable(symbolTable) { @@ -121,6 +121,11 @@ TIntermTraverser::~TIntermTraverser() { } +void TIntermTraverser::setMaxAllowedDepth(int depth) +{ + mMaxAllowedDepth = depth; +} + const TIntermBlock *TIntermTraverser::getParentBlock() const { if (!mParentBlockStack.empty()) @@ -215,6 +220,8 @@ void TIntermTraverser::traverseConstantUnion(TIntermConstantUnion *node) void TIntermTraverser::traverseSwizzle(TIntermSwizzle *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -236,6 +243,8 @@ void TIntermTraverser::traverseSwizzle(TIntermSwizzle *node) void TIntermTraverser::traverseBinary(TIntermBinary *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -271,6 +280,8 @@ void TIntermTraverser::traverseBinary(TIntermBinary *node) void TLValueTrackingTraverser::traverseBinary(TIntermBinary *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -335,6 +346,8 @@ void TLValueTrackingTraverser::traverseBinary(TIntermBinary *node) void TIntermTraverser::traverseUnary(TIntermUnary *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -353,6 +366,8 @@ void TIntermTraverser::traverseUnary(TIntermUnary *node) void TLValueTrackingTraverser::traverseUnary(TIntermUnary *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -387,6 +402,8 @@ void TLValueTrackingTraverser::traverseUnary(TIntermUnary *node) void TIntermTraverser::traverseFunctionDefinition(TIntermFunctionDefinition *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -413,6 +430,9 @@ void TIntermTraverser::traverseFunctionDefinition(TIntermFunctionDefinition *nod void TIntermTraverser::traverseBlock(TIntermBlock *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; + pushParentBlock(node); bool visit = true; @@ -446,6 +466,8 @@ void TIntermTraverser::traverseBlock(TIntermBlock *node) void TIntermTraverser::traverseInvariantDeclaration(TIntermInvariantDeclaration *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -468,6 +490,8 @@ void TIntermTraverser::traverseInvariantDeclaration(TIntermInvariantDeclaration void TIntermTraverser::traverseDeclaration(TIntermDeclaration *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -497,34 +521,15 @@ void TIntermTraverser::traverseFunctionPrototype(TIntermFunctionPrototype *node) { ScopedNodeInTraversalPath addToPath(this, node); - bool visit = true; - - TIntermSequence *sequence = node->getSequence(); - - if (preVisit) - visit = visitFunctionPrototype(PreVisit, node); - - if (visit) - { - for (auto *child : *sequence) - { - child->traverse(this); - if (visit && inVisit) - { - if (child != sequence->back()) - visit = visitFunctionPrototype(InVisit, node); - } - } - } - - if (visit && postVisit) - visitFunctionPrototype(PostVisit, node); + visitFunctionPrototype(node); } // Traverse an aggregate node. Same comments in binary node apply here. void TIntermTraverser::traverseAggregate(TIntermAggregate *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -655,6 +660,8 @@ TLValueTrackingTraverser::TLValueTrackingTraverser(bool preVisit, void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -673,7 +680,7 @@ void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node) // Both built-ins and user defined functions should have the function symbol set. ASSERT(paramIndex < node->getFunction()->getParamCount()); TQualifier qualifier = - node->getFunction()->getParam(paramIndex).type->getQualifier(); + node->getFunction()->getParam(paramIndex)->getType().getQualifier(); setInFunctionCallOutParameter(qualifier == EvqOut || qualifier == EvqInOut); ++paramIndex; } @@ -702,6 +709,8 @@ void TLValueTrackingTraverser::traverseAggregate(TIntermAggregate *node) void TIntermTraverser::traverseTernary(TIntermTernary *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -725,6 +734,8 @@ void TIntermTraverser::traverseTernary(TIntermTernary *node) void TIntermTraverser::traverseIfElse(TIntermIfElse *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -750,6 +761,8 @@ void TIntermTraverser::traverseIfElse(TIntermIfElse *node) void TIntermTraverser::traverseSwitch(TIntermSwitch *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -775,6 +788,8 @@ void TIntermTraverser::traverseSwitch(TIntermSwitch *node) void TIntermTraverser::traverseCase(TIntermCase *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -796,6 +811,8 @@ void TIntermTraverser::traverseCase(TIntermCase *node) void TIntermTraverser::traverseLoop(TIntermLoop *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; @@ -827,6 +844,8 @@ void TIntermTraverser::traverseLoop(TIntermLoop *node) void TIntermTraverser::traverseBranch(TIntermBranch *node) { ScopedNodeInTraversalPath addToPath(this, node); + if (!addToPath.isWithinDepthLimit()) + return; bool visit = true; diff --git a/gfx/angle/checkout/src/compiler/translator/IntermTraverse.h b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h similarity index 94% rename from gfx/angle/checkout/src/compiler/translator/IntermTraverse.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h index 3cd0d1e761b9..468f6f1ad4b2 100644 --- a/gfx/angle/checkout/src/compiler/translator/IntermTraverse.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.h @@ -6,8 +6,8 @@ // IntermTraverse.h : base classes for AST traversers that walk the AST and // also have the ability to transform it by replacing nodes. -#ifndef COMPILER_TRANSLATOR_INTERMTRAVERSE_H_ -#define COMPILER_TRANSLATOR_INTERMTRAVERSE_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_ #include "compiler/translator/IntermNode.h" @@ -53,10 +53,7 @@ class TIntermTraverser : angle::NonCopyable virtual bool visitIfElse(Visit visit, TIntermIfElse *node) { return true; } virtual bool visitSwitch(Visit visit, TIntermSwitch *node) { return true; } virtual bool visitCase(Visit visit, TIntermCase *node) { return true; } - virtual bool visitFunctionPrototype(Visit visit, TIntermFunctionPrototype *node) - { - return true; - } + virtual void visitFunctionPrototype(TIntermFunctionPrototype *node) {} virtual bool visitFunctionDefinition(Visit visit, TIntermFunctionDefinition *node) { return true; @@ -101,21 +98,24 @@ class TIntermTraverser : angle::NonCopyable void updateTree(); protected: + void setMaxAllowedDepth(int depth); + // Should only be called from traverse*() functions - void incrementDepth(TIntermNode *current) + bool incrementDepth(TIntermNode *current) { - mDepth++; - mMaxDepth = std::max(mMaxDepth, mDepth); + mMaxDepth = std::max(mMaxDepth, static_cast(mPath.size())); mPath.push_back(current); + return mMaxDepth < mMaxAllowedDepth; } // Should only be called from traverse*() functions void decrementDepth() { - mDepth--; mPath.pop_back(); } + int getCurrentTraversalDepth() const { return static_cast(mPath.size()) - 1; } + // RAII helper for incrementDepth/decrementDepth class ScopedNodeInTraversalPath { @@ -123,12 +123,15 @@ class TIntermTraverser : angle::NonCopyable ScopedNodeInTraversalPath(TIntermTraverser *traverser, TIntermNode *current) : mTraverser(traverser) { - mTraverser->incrementDepth(current); + mWithinDepthLimit = mTraverser->incrementDepth(current); } ~ScopedNodeInTraversalPath() { mTraverser->decrementDepth(); } + bool isWithinDepthLimit() { return mWithinDepthLimit; } + private: TIntermTraverser *mTraverser; + bool mWithinDepthLimit; }; TIntermNode *getParentNode() { return mPath.size() <= 1 ? nullptr : mPath[mPath.size() - 2u]; } @@ -199,8 +202,8 @@ class TIntermTraverser : angle::NonCopyable const bool inVisit; const bool postVisit; - int mDepth; int mMaxDepth; + int mMaxAllowedDepth; bool mInGlobalScope; @@ -317,4 +320,4 @@ class TLValueTrackingTraverser : public TIntermTraverser } // namespace sh -#endif // COMPILER_TRANSLATOR_INTERMTRAVERSE_H_ +#endif // COMPILER_TRANSLATOR_TREEUTIL_INTERMTRAVERSE_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/NodeSearch.h b/gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h similarity index 83% rename from gfx/angle/checkout/src/compiler/translator/NodeSearch.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h index af86b8bde461..53c800c983c8 100644 --- a/gfx/angle/checkout/src/compiler/translator/NodeSearch.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/NodeSearch.h @@ -6,10 +6,10 @@ // NodeSearch.h: Utilities for searching translator node graphs // -#ifndef COMPILER_TRANSLATOR_NODESEARCH_H_ -#define COMPILER_TRANSLATOR_NODESEARCH_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_ -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -53,4 +53,4 @@ class FindDiscard : public NodeSearchTraverser }; } -#endif // COMPILER_TRANSLATOR_NODESEARCH_H_ +#endif // COMPILER_TRANSLATOR_TREEUTIL_NODESEARCH_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/ReplaceVariable.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp similarity index 92% rename from gfx/angle/checkout/src/compiler/translator/ReplaceVariable.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp index 98667db2444d..4a61f096e618 100644 --- a/gfx/angle/checkout/src/compiler/translator/ReplaceVariable.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp @@ -6,10 +6,10 @@ // ReplaceVariable.cpp: Replace all references to a specific variable in the AST with references to // another variable. -#include "compiler/translator/ReplaceVariable.h" +#include "compiler/translator/tree_util/ReplaceVariable.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { diff --git a/gfx/angle/checkout/src/compiler/translator/ReplaceVariable.h b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h similarity index 75% rename from gfx/angle/checkout/src/compiler/translator/ReplaceVariable.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h index aa6fdb59447a..2eec741c92a8 100644 --- a/gfx/angle/checkout/src/compiler/translator/ReplaceVariable.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/ReplaceVariable.h @@ -6,8 +6,8 @@ // ReplaceVariable.h: Replace all references to a specific variable in the AST with references to // another variable. -#ifndef COMPILER_TRANSLATOR_REPLACEVARIABLE_H_ -#define COMPILER_TRANSLATOR_REPLACEVARIABLE_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_ namespace sh { @@ -21,4 +21,4 @@ void ReplaceVariable(TIntermBlock *root, } // namespace sh -#endif // COMPILER_TRANSLATOR_REPLACEVARIABLE_H_ +#endif // COMPILER_TRANSLATOR_TREEUTIL_REPLACEVARIABLE_H_ diff --git a/gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.cpp b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp similarity index 91% rename from gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.cpp rename to gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp index 9a6f8d666b54..4f6160b8b7f0 100644 --- a/gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.cpp +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp @@ -19,14 +19,14 @@ // This way the code will get run even if the return statement inside main is executed. // -#include "compiler/translator/RunAtTheEndOfShader.h" +#include "compiler/translator/tree_util/RunAtTheEndOfShader.h" -#include "compiler/translator/FindMain.h" #include "compiler/translator/IntermNode.h" -#include "compiler/translator/IntermNode_util.h" -#include "compiler/translator/IntermTraverse.h" #include "compiler/translator/StaticType.h" #include "compiler/translator/SymbolTable.h" +#include "compiler/translator/tree_util/FindMain.h" +#include "compiler/translator/tree_util/IntermNode_util.h" +#include "compiler/translator/tree_util/IntermTraverse.h" namespace sh { @@ -86,7 +86,7 @@ void WrapMainAndAppend(TIntermBlock *root, // main0(); // codeToRun // } - TIntermBlock *newMainBody = new TIntermBlock(); + TIntermBlock *newMainBody = new TIntermBlock(); TIntermAggregate *oldMainCall = TIntermAggregate::CreateFunctionCall(*oldMain, new TIntermSequence()); newMainBody->appendStatement(oldMainCall); diff --git a/gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.h b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h similarity index 71% rename from gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.h rename to gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h index ed94c28daecc..ed5a0bb64f2b 100644 --- a/gfx/angle/checkout/src/compiler/translator/RunAtTheEndOfShader.h +++ b/gfx/angle/checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.h @@ -6,8 +6,8 @@ // RunAtTheEndOfShader.h: Add code to be run at the end of the shader. // -#ifndef COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ -#define COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ +#ifndef COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_ +#define COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_ namespace sh { @@ -20,4 +20,4 @@ void RunAtTheEndOfShader(TIntermBlock *root, TIntermNode *codeToRun, TSymbolTabl } // namespace sh -#endif // COMPILER_TRANSLATOR_RUNATTHEENDOFSHADER_H_ \ No newline at end of file +#endif // COMPILER_TRANSLATOR_TREEUTIL_RUNATTHEENDOFSHADER_H_ \ No newline at end of file diff --git a/gfx/angle/checkout/src/libANGLE/BinaryStream.h b/gfx/angle/checkout/src/libANGLE/BinaryStream.h index 3e4c0934cfb5..4ceff36c95c2 100644 --- a/gfx/angle/checkout/src/libANGLE/BinaryStream.h +++ b/gfx/angle/checkout/src/libANGLE/BinaryStream.h @@ -56,6 +56,19 @@ class BinaryInputStream : angle::NonCopyable } } + template + EnumT readEnum() + { + using UnderlyingType = typename std::underlying_type::type; + return static_cast(readInt()); + } + + template + void readEnum(EnumT *outValue) + { + *outValue = readEnum(); + } + bool readBool() { int value = 0; @@ -216,6 +229,13 @@ class BinaryOutputStream : angle::NonCopyable } } + template + void writeEnum(EnumT param) + { + using UnderlyingType = typename std::underlying_type::type; + writeInt(static_cast(param)); + } + void writeString(const std::string &v) { writeInt(v.length()); diff --git a/gfx/angle/checkout/src/libANGLE/Buffer.cpp b/gfx/angle/checkout/src/libANGLE/Buffer.cpp index a1ebfc1acbd0..17b252651c6e 100644 --- a/gfx/angle/checkout/src/libANGLE/Buffer.cpp +++ b/gfx/angle/checkout/src/libANGLE/Buffer.cpp @@ -26,7 +26,9 @@ BufferState::BufferState() mMapped(GL_FALSE), mMapPointer(nullptr), mMapOffset(0), - mMapLength(0) + mMapLength(0), + mBindingCount(0), + mTransformFeedbackBindingCount(0) { } @@ -86,6 +88,9 @@ Error Buffer::bufferData(const Context *context, mState.mUsage = usage; mState.mSize = size; + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); + return NoError(); } @@ -99,6 +104,9 @@ Error Buffer::bufferSubData(const Context *context, mIndexRangeCache.invalidateRange(static_cast(offset), static_cast(size)); + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); + return NoError(); } @@ -113,6 +121,9 @@ Error Buffer::copyBufferSubData(const Context *context, mIndexRangeCache.invalidateRange(static_cast(destOffset), static_cast(size)); + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); + return NoError(); } @@ -179,17 +190,26 @@ Error Buffer::unmap(const Context *context, GLboolean *result) mState.mAccess = GL_WRITE_ONLY_OES; mState.mAccessFlags = 0; + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); + return NoError(); } -void Buffer::onTransformFeedback() +void Buffer::onTransformFeedback(const Context *context) { mIndexRangeCache.clear(); + + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); } -void Buffer::onPixelUnpack() +void Buffer::onPixelPack(const Context *context) { mIndexRangeCache.clear(); + + // Notify when data changes. + mImpl->onStateChange(context, angle::SubjectMessage::CONTENTS_CHANGED); } Error Buffer::getIndexRange(const gl::Context *context, @@ -212,4 +232,26 @@ Error Buffer::getIndexRange(const gl::Context *context, return NoError(); } +bool Buffer::isBound() const +{ + return mState.mBindingCount; +} + +bool Buffer::isBoundForTransformFeedbackAndOtherUse() const +{ + return mState.mTransformFeedbackBindingCount > 0 && + mState.mTransformFeedbackBindingCount != mState.mBindingCount; +} + +void Buffer::onBindingChanged(bool bound, BufferBinding target) +{ + ASSERT(bound || mState.mBindingCount > 0); + mState.mBindingCount += bound ? 1 : -1; + if (target == BufferBinding::TransformFeedback) + { + ASSERT(bound || mState.mTransformFeedbackBindingCount > 0); + mState.mTransformFeedbackBindingCount += bound ? 1 : -1; + } +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/Buffer.h b/gfx/angle/checkout/src/libANGLE/Buffer.h index 86d4a9fd6f03..55a6bdea404c 100644 --- a/gfx/angle/checkout/src/libANGLE/Buffer.h +++ b/gfx/angle/checkout/src/libANGLE/Buffer.h @@ -59,6 +59,8 @@ class BufferState final : angle::NonCopyable void *mMapPointer; GLint64 mMapOffset; GLint64 mMapLength; + int mBindingCount; + int mTransformFeedbackBindingCount; }; class Buffer final : public RefCountObject, public LabeledObject @@ -90,8 +92,9 @@ class Buffer final : public RefCountObject, public LabeledObject Error mapRange(const Context *context, GLintptr offset, GLsizeiptr length, GLbitfield access); Error unmap(const Context *context, GLboolean *result); - void onTransformFeedback(); - void onPixelUnpack(); + // These are called when another operation changes Buffer data. + void onTransformFeedback(const Context *context); + void onPixelPack(const Context *context); Error getIndexRange(const gl::Context *context, GLenum type, @@ -111,6 +114,10 @@ class Buffer final : public RefCountObject, public LabeledObject rx::BufferImpl *getImplementation() const { return mImpl; } + bool isBound() const; + bool isBoundForTransformFeedbackAndOtherUse() const; + void onBindingChanged(bool bound, BufferBinding target); + private: BufferState mState; rx::BufferImpl *mImpl; diff --git a/gfx/angle/checkout/src/libANGLE/Caps.cpp b/gfx/angle/checkout/src/libANGLE/Caps.cpp index 8e3a9c58df64..1bf0b35aebf8 100644 --- a/gfx/angle/checkout/src/libANGLE/Caps.cpp +++ b/gfx/angle/checkout/src/libANGLE/Caps.cpp @@ -6,8 +6,8 @@ #include "libANGLE/Caps.h" -#include "common/debug.h" #include "common/angleutils.h" +#include "common/debug.h" #include "libANGLE/formatutils.h" @@ -16,7 +16,9 @@ #include #include -static void InsertExtensionString(const std::string &extension, bool supported, std::vector *extensionVector) +static void InsertExtensionString(const std::string &extension, + bool supported, + std::vector *extensionVector) { if (supported) { @@ -27,11 +29,7 @@ static void InsertExtensionString(const std::string &extension, bool supported, namespace gl { -TextureCaps::TextureCaps() - : texturable(false), - filterable(false), - renderable(false), - sampleCounts() +TextureCaps::TextureCaps() : texturable(false), filterable(false), renderable(false), sampleCounts() { } @@ -398,7 +396,9 @@ static bool DetermineRGFloatTextureSupport(const TextureCapsMap &textureCaps) return GetFormatSupport(textureCaps, requiredFormats, true, true, false); } -static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps, bool checkHalfFloatFormats, bool checkFloatFormats) +static bool DetermineRGTextureSupport(const TextureCapsMap &textureCaps, + bool checkHalfFloatFormats, + bool checkFloatFormats) { if (checkHalfFloatFormats && !DetermineRGHalfFloatTextureSupport(textureCaps)) { @@ -573,29 +573,29 @@ static bool DetermineTextureNorm16Support(const TextureCapsMap &textureCaps) void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps) { - packedDepthStencil = DeterminePackedDepthStencilSupport(textureCaps); - rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps); - textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps); - colorBufferHalfFloat = DetermineColorBufferHalfFloatSupport(textureCaps); - textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps); + packedDepthStencil = DeterminePackedDepthStencilSupport(textureCaps); + rgb8rgba8 = DetermineRGB8AndRGBA8TextureSupport(textureCaps); + textureFormatBGRA8888 = DetermineBGRA8TextureSupport(textureCaps); + colorBufferHalfFloat = DetermineColorBufferHalfFloatSupport(textureCaps); + textureHalfFloat = DetermineHalfFloatTextureSupport(textureCaps); textureHalfFloatLinear = DetermineHalfFloatTextureFilteringSupport(textureCaps); - textureFloat = DetermineFloatTextureSupport(textureCaps); - textureFloatLinear = DetermineFloatTextureFilteringSupport(textureCaps); - textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat); + textureFloat = DetermineFloatTextureSupport(textureCaps); + textureFloatLinear = DetermineFloatTextureFilteringSupport(textureCaps); + textureRG = DetermineRGTextureSupport(textureCaps, textureHalfFloat, textureFloat); textureCompressionDXT1 = DetermineDXT1TextureSupport(textureCaps); textureCompressionDXT3 = DetermineDXT3TextureSupport(textureCaps); textureCompressionDXT5 = DetermineDXT5TextureSupport(textureCaps); textureCompressionS3TCsRGB = DetermineS3TCsRGBTextureSupport(textureCaps); - textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps); - textureCompressionASTCLDR = textureCompressionASTCHDR; - compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps); - sRGB = DetermineSRGBTextureSupport(textureCaps); - depthTextures = DetermineDepthTextureSupport(textureCaps); - depth32 = DetermineDepth32Support(textureCaps); + textureCompressionASTCHDR = DetermineASTCTextureSupport(textureCaps); + textureCompressionASTCLDR = textureCompressionASTCHDR; + compressedETC1RGB8Texture = DetermineETC1RGB8TextureSupport(textureCaps); + sRGB = DetermineSRGBTextureSupport(textureCaps); + depthTextures = DetermineDepthTextureSupport(textureCaps); + depth32 = DetermineDepth32Support(textureCaps); colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps); colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps); - colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps); - textureNorm16 = DetermineTextureNorm16Support(textureCaps); + colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps); + textureNorm16 = DetermineTextureNorm16Support(textureCaps); } const ExtensionInfoMap &GetExtensionInfoMap() @@ -869,7 +869,16 @@ Caps::Caps() // Table 20.46 (GL_EXT_geometry_shader) maxGeometryImageUniforms(0), - maxCombinedGeometryUniformComponents(0) + maxCombinedGeometryUniformComponents(0), + + // GLES1 emulation: Table 6.20 / 6.22 (ES 1.1 spec) + maxMultitextureUnits(0), + maxClipPlanes(0), + maxLights(0), + maxModelviewMatrixStackDepth(0), + maxProjectionMatrixStackDepth(0), + maxTextureMatrixStackDepth(0) + { for (size_t i = 0; i < 3; ++i) { @@ -885,6 +894,18 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi { Caps caps; + // GLES1 emulation (Minimums taken from Table 6.20 / 6.22 (ES 1.1 spec)) + if (clientVersion < Version(2, 0)) + { + caps.maxMultitextureUnits = 2; + caps.maxLights = 8; + caps.maxClipPlanes = 1; + + caps.maxModelviewMatrixStackDepth = 16; + caps.maxProjectionMatrixStackDepth = 2; + caps.maxTextureMatrixStackDepth = 2; + } + if (clientVersion >= Version(2, 0)) { // Table 6.18 @@ -1111,8 +1132,7 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi namespace egl { -Caps::Caps() - : textureNPOT(false) +Caps::Caps() : textureNPOT(false) { } @@ -1153,7 +1173,8 @@ DisplayExtensions::DisplayExtensions() createContextClientArrays(false), programCacheControl(false), robustResourceInitialization(false), - iosurfaceClientBuffer(false) + iosurfaceClientBuffer(false), + createContextExtensionsEnabled(false) { } @@ -1199,6 +1220,7 @@ std::vector DisplayExtensions::getStrings() const InsertExtensionString("EGL_ANGLE_program_cache_control", programCacheControl, &extensionStrings); InsertExtensionString("EGL_ANGLE_robust_resource_initialization", robustResourceInitialization, &extensionStrings); InsertExtensionString("EGL_ANGLE_iosurface_client_buffer", iosurfaceClientBuffer, &extensionStrings); + InsertExtensionString("EGL_ANGLE_create_context_extensions_enabled", createContextExtensionsEnabled, &extensionStrings); // TODO(jmadill): Enable this when complete. //InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings); // clang-format on @@ -1206,8 +1228,7 @@ std::vector DisplayExtensions::getStrings() const return extensionStrings; } -DeviceExtensions::DeviceExtensions() - : deviceD3D(false) +DeviceExtensions::DeviceExtensions() : deviceD3D(false) { } @@ -1215,8 +1236,10 @@ std::vector DeviceExtensions::getStrings() const { std::vector extensionStrings; + // clang-format off // | Extension name | Supported flag | Output vector | InsertExtensionString("EGL_ANGLE_device_d3d", deviceD3D, &extensionStrings); + // clang-format on return extensionStrings; } diff --git a/gfx/angle/checkout/src/libANGLE/Caps.h b/gfx/angle/checkout/src/libANGLE/Caps.h index 45f0038fa327..9e34092cad5d 100644 --- a/gfx/angle/checkout/src/libANGLE/Caps.h +++ b/gfx/angle/checkout/src/libANGLE/Caps.h @@ -12,11 +12,11 @@ #include "libANGLE/angletypes.h" #include "libANGLE/renderer/Format.h" +#include #include #include #include #include -#include namespace gl { @@ -155,12 +155,13 @@ struct Extensions bool textureFloatLinear; // GL_EXT_texture_rg - // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if floating point extensions - // are also present) exist + // Implies that TextureCaps for GL_R8, GL_RG8 (and floating point R/RG texture formats if + // floating point extensions are also present) exist bool textureRG; - // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and GL_ANGLE_texture_compression_dxt5 - // Implies that TextureCaps exist for GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT + // GL_EXT_texture_compression_dxt1, GL_ANGLE_texture_compression_dxt3 and + // GL_ANGLE_texture_compression_dxt5 Implies that TextureCaps exist for + // GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT // GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE and GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE bool textureCompressionDXT1; bool textureCompressionDXT3; @@ -583,6 +584,15 @@ struct Caps // limits GLuint maxGeometryImageUniforms; GLuint maxCombinedGeometryUniformComponents; + + // GLES1 emulation: Caps for ES 1.1. Taken from Table 6.20 / 6.22 in the OpenGL ES 1.1 spec. + GLuint maxMultitextureUnits; + GLuint maxClipPlanes; + GLuint maxLights; + static constexpr int GlobalMatrixStackDepth = 16; + GLuint maxModelviewMatrixStackDepth; + GLuint maxProjectionMatrixStackDepth; + GLuint maxTextureMatrixStackDepth; }; Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensions); @@ -716,6 +726,9 @@ struct DisplayExtensions // EGL_ANGLE_iosurface_client_buffer bool iosurfaceClientBuffer; + + // EGL_ANGLE_create_context_extensions_enabled + bool createContextExtensionsEnabled; }; struct DeviceExtensions @@ -779,4 +792,4 @@ struct ClientExtensions } // namespace egl -#endif // LIBANGLE_CAPS_H_ +#endif // LIBANGLE_CAPS_H_ diff --git a/gfx/angle/checkout/src/libANGLE/Compiler.cpp b/gfx/angle/checkout/src/libANGLE/Compiler.cpp index ebcf028fc0c7..d2319b3e4bbd 100644 --- a/gfx/angle/checkout/src/libANGLE/Compiler.cpp +++ b/gfx/angle/checkout/src/libANGLE/Compiler.cpp @@ -36,6 +36,13 @@ ShShaderSpec SelectShaderSpec(GLint majorVersion, GLint minorVersion, bool isWeb return isWebGL ? SH_WEBGL2_SPEC : SH_GLES3_SPEC; } } + + // GLES1 emulation: Use GLES3 shader spec. + if (!isWebGL && majorVersion == 1) + { + return SH_GLES3_SPEC; + } + return isWebGL ? SH_WEBGL_SPEC : SH_GLES2_SPEC; } @@ -193,22 +200,22 @@ Compiler::~Compiler() ANGLE_SWALLOW_ERR(mImplementation->release()); } -ShHandle Compiler::getCompilerHandle(GLenum type) +ShHandle Compiler::getCompilerHandle(ShaderType type) { ShHandle *compiler = nullptr; switch (type) { - case GL_VERTEX_SHADER: + case ShaderType::Vertex: compiler = &mVertexCompiler; break; - case GL_FRAGMENT_SHADER: + case ShaderType::Fragment: compiler = &mFragmentCompiler; break; - case GL_COMPUTE_SHADER: + case ShaderType::Compute: compiler = &mComputeCompiler; break; - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: compiler = &mGeometryCompiler; break; default: @@ -223,7 +230,7 @@ ShHandle Compiler::getCompilerHandle(GLenum type) sh::Initialize(); } - *compiler = sh::ConstructCompiler(type, mSpec, mOutputType, &mResources); + *compiler = sh::ConstructCompiler(ToGLenum(type), mSpec, mOutputType, &mResources); ASSERT(*compiler); activeCompilerHandles++; } @@ -231,7 +238,7 @@ ShHandle Compiler::getCompilerHandle(GLenum type) return *compiler; } -const std::string &Compiler::getBuiltinResourcesString(GLenum type) +const std::string &Compiler::getBuiltinResourcesString(ShaderType type) { return sh::GetBuiltInResourcesString(getCompilerHandle(type)); } diff --git a/gfx/angle/checkout/src/libANGLE/Compiler.h b/gfx/angle/checkout/src/libANGLE/Compiler.h index b7f7e9f31b8f..b84357e94604 100644 --- a/gfx/angle/checkout/src/libANGLE/Compiler.h +++ b/gfx/angle/checkout/src/libANGLE/Compiler.h @@ -12,6 +12,7 @@ #include "GLSLANG/ShaderLang.h" #include "libANGLE/Error.h" +#include "libANGLE/PackedGLEnums_autogen.h" #include "libANGLE/RefCountObject.h" namespace rx @@ -29,9 +30,9 @@ class Compiler final : public RefCountObjectNoID public: Compiler(rx::GLImplFactory *implFactory, const ContextState &data); - ShHandle getCompilerHandle(GLenum type); + ShHandle getCompilerHandle(ShaderType shaderType); ShShaderOutput getShaderOutputType() const { return mOutputType; } - const std::string &getBuiltinResourcesString(GLenum type); + const std::string &getBuiltinResourcesString(ShaderType type); private: ~Compiler() override; diff --git a/gfx/angle/checkout/src/libANGLE/Context.cpp b/gfx/angle/checkout/src/libANGLE/Context.cpp index 1f8c1476e098..aea253abbda0 100644 --- a/gfx/angle/checkout/src/libANGLE/Context.cpp +++ b/gfx/angle/checkout/src/libANGLE/Context.cpp @@ -129,20 +129,14 @@ gl::Error GetQueryObjectParameter(gl::Query *query, GLenum pname, T *params) } } -void MarkTransformFeedbackBufferUsage(gl::TransformFeedback *transformFeedback) +void MarkTransformFeedbackBufferUsage(const gl::Context *context, + gl::TransformFeedback *transformFeedback, + GLsizei count, + GLsizei instanceCount) { if (transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused()) { - for (size_t tfBufferIndex = 0; tfBufferIndex < transformFeedback->getIndexedBufferCount(); - tfBufferIndex++) - { - const gl::OffsetBindingPointer &buffer = - transformFeedback->getIndexedBuffer(tfBufferIndex); - if (buffer.get() != nullptr) - { - buffer->onTransformFeedback(); - } - } + transformFeedback->onVerticesDrawn(context, count, instanceCount); } } @@ -164,8 +158,8 @@ gl::Version GetClientVersion(const egl::AttributeMap &attribs) GLenum GetResetStrategy(const egl::AttributeMap &attribs) { - EGLAttrib attrib = attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, - EGL_NO_RESET_NOTIFICATION); + EGLAttrib attrib = + attribs.get(EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT, EGL_NO_RESET_NOTIFICATION); switch (attrib) { case EGL_NO_RESET_NOTIFICATION: @@ -201,6 +195,13 @@ bool GetWebGLContext(const egl::AttributeMap &attribs) return (attribs.get(EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE, EGL_FALSE) == EGL_TRUE); } +bool GetExtensionsEnabled(const egl::AttributeMap &attribs, bool webGLContext) +{ + // If the context is WebGL, extensions are disabled by default + EGLAttrib defaultValue = webGLContext ? EGL_FALSE : EGL_TRUE; + return (attribs.get(EGL_EXTENSIONS_ENABLED_ANGLE, defaultValue) == EGL_TRUE); +} + bool GetBindGeneratesResource(const egl::AttributeMap &attribs) { return (attribs.get(EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM, EGL_TRUE) == EGL_TRUE); @@ -264,16 +265,18 @@ Context::Context(rx::EGLImplFactory *implFactory, MemoryProgramCache *memoryProgramCache, const egl::AttributeMap &attribs, const egl::DisplayExtensions &displayExtensions) - - : ValidationContext(shareContext, - shareTextures, - GetClientVersion(attribs), - &mGLState, - mCaps, - mTextureCaps, - mExtensions, - mLimitations, - GetNoError(attribs)), + : mState(reinterpret_cast(this), + shareContext ? &shareContext->mState : nullptr, + shareTextures, + GetClientVersion(attribs), + &mGLState, + mCaps, + mTextureCaps, + mExtensions, + mLimitations), + mSkipValidation(GetNoError(attribs)), + mDisplayTextureShareGroup(shareTextures != nullptr), + mSavedArgsType(nullptr), mImplementation(implFactory->createContext(mState)), mCompiler(), mConfig(config), @@ -288,10 +291,15 @@ Context::Context(rx::EGLImplFactory *implFactory, mCurrentDisplay(static_cast(EGL_NO_DISPLAY)), mSurfacelessFramebuffer(nullptr), mWebGLContext(GetWebGLContext(attribs)), + mExtensionsEnabled(GetExtensionsEnabled(attribs, mWebGLContext)), mMemoryProgramCache(memoryProgramCache), mScratchBuffer(1000u), mZeroFilledBuffer(1000u) { + // Needed to solve a Clang warning of unused variables. + UNUSED_VARIABLE(mSavedArgsType); + UNUSED_VARIABLE(mParamsBuffer); + mImplementation->setMemoryProgramCache(memoryProgramCache); bool robustResourceInit = GetRobustResourceInit(attribs); @@ -310,26 +318,26 @@ Context::Context(rx::EGLImplFactory *implFactory, // In order that access to these initial textures not be lost, they are treated as texture // objects all of whose names are 0. - Texture *zeroTexture2D = new Texture(mImplementation.get(), 0, GL_TEXTURE_2D); - mZeroTextures[GL_TEXTURE_2D].set(this, zeroTexture2D); + Texture *zeroTexture2D = new Texture(mImplementation.get(), 0, TextureType::_2D); + mZeroTextures[TextureType::_2D].set(this, zeroTexture2D); - Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, GL_TEXTURE_CUBE_MAP); - mZeroTextures[GL_TEXTURE_CUBE_MAP].set(this, zeroTextureCube); + Texture *zeroTextureCube = new Texture(mImplementation.get(), 0, TextureType::CubeMap); + mZeroTextures[TextureType::CubeMap].set(this, zeroTextureCube); if (getClientVersion() >= Version(3, 0)) { // TODO: These could also be enabled via extension - Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, GL_TEXTURE_3D); - mZeroTextures[GL_TEXTURE_3D].set(this, zeroTexture3D); + Texture *zeroTexture3D = new Texture(mImplementation.get(), 0, TextureType::_3D); + mZeroTextures[TextureType::_3D].set(this, zeroTexture3D); - Texture *zeroTexture2DArray = new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_ARRAY); - mZeroTextures[GL_TEXTURE_2D_ARRAY].set(this, zeroTexture2DArray); + Texture *zeroTexture2DArray = new Texture(mImplementation.get(), 0, TextureType::_2DArray); + mZeroTextures[TextureType::_2DArray].set(this, zeroTexture2DArray); } if (getClientVersion() >= Version(3, 1)) { Texture *zeroTexture2DMultisample = - new Texture(mImplementation.get(), 0, GL_TEXTURE_2D_MULTISAMPLE); - mZeroTextures[GL_TEXTURE_2D_MULTISAMPLE].set(this, zeroTexture2DMultisample); + new Texture(mImplementation.get(), 0, TextureType::_2DMultisample); + mZeroTextures[TextureType::_2DMultisample].set(this, zeroTexture2DMultisample); for (unsigned int i = 0; i < mCaps.maxAtomicCounterBufferBindings; i++) { @@ -346,15 +354,14 @@ Context::Context(rx::EGLImplFactory *implFactory, if (nativeExtensions.textureRectangle) { Texture *zeroTextureRectangle = - new Texture(mImplementation.get(), 0, GL_TEXTURE_RECTANGLE_ANGLE); - mZeroTextures[GL_TEXTURE_RECTANGLE_ANGLE].set(this, zeroTextureRectangle); + new Texture(mImplementation.get(), 0, TextureType::Rectangle); + mZeroTextures[TextureType::Rectangle].set(this, zeroTextureRectangle); } if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal) { - Texture *zeroTextureExternal = - new Texture(mImplementation.get(), 0, GL_TEXTURE_EXTERNAL_OES); - mZeroTextures[GL_TEXTURE_EXTERNAL_OES].set(this, zeroTextureExternal); + Texture *zeroTextureExternal = new Texture(mImplementation.get(), 0, TextureType::External); + mZeroTextures[TextureType::External].set(this, zeroTextureExternal); } mGLState.initializeZeroTextures(this, mZeroTextures); @@ -418,12 +425,18 @@ Context::Context(rx::EGLImplFactory *implFactory, mComputeDirtyBits.set(State::DIRTY_BIT_TEXTURE_BINDINGS); mComputeDirtyBits.set(State::DIRTY_BIT_SAMPLER_BINDINGS); mComputeDirtyBits.set(State::DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING); + mComputeDirtyObjects.set(State::DIRTY_OBJECT_PROGRAM_TEXTURES); handleError(mImplementation->initialize()); } egl::Error Context::onDestroy(const egl::Display *display) { + // Delete the Surface first to trigger a finish() in Vulkan. + SafeDelete(mSurfacelessFramebuffer); + + ANGLE_TRY(releaseSurface(display)); + for (auto fence : mFenceNVMap) { SafeDelete(fence.second); @@ -457,16 +470,15 @@ egl::Error Context::onDestroy(const egl::Display *display) } mTransformFeedbackMap.clear(); - for (auto &zeroTexture : mZeroTextures) + for (BindingPointer &zeroTexture : mZeroTextures) { - ANGLE_TRY(zeroTexture.second->onDestroy(this)); - zeroTexture.second.set(this, nullptr); + if (zeroTexture.get() != nullptr) + { + ANGLE_TRY(zeroTexture->onDestroy(this)); + zeroTexture.set(this, nullptr); + } } - mZeroTextures.clear(); - SafeDelete(mSurfacelessFramebuffer); - - ANGLE_TRY(releaseSurface(display)); releaseShaderCompiler(); mGLState.reset(this); @@ -598,7 +610,7 @@ GLuint Context::createProgram() return mState.mShaderPrograms->createProgram(mImplementation.get()); } -GLuint Context::createShader(GLenum type) +GLuint Context::createShader(ShaderType type) { return mState.mShaderPrograms->createShader(mImplementation.get(), mLimitations, type); } @@ -613,7 +625,7 @@ GLuint Context::createRenderbuffer() return mState.mRenderbuffers->createRenderbuffer(); } -GLuint Context::createPaths(GLsizei range) +GLuint Context::genPaths(GLsizei range) { auto resultOrError = mState.mPaths->createPaths(mImplementation.get(), range); if (resultOrError.isError()) @@ -645,20 +657,21 @@ GLuint Context::createProgramPipeline() return mState.mPipelines->createProgramPipeline(); } -GLuint Context::createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings) +GLuint Context::createShaderProgramv(ShaderType type, GLsizei count, const GLchar *const *strings) { UNIMPLEMENTED(); return 0u; } -void Context::deleteBuffer(GLuint buffer) +void Context::deleteBuffer(GLuint bufferName) { - if (mState.mBuffers->getBuffer(buffer)) + Buffer *buffer = mState.mBuffers->getBuffer(bufferName); + if (buffer) { detachBuffer(buffer); } - mState.mBuffers->deleteObject(this, buffer); + mState.mBuffers->deleteObject(this, bufferName); } void Context::deleteShader(GLuint shader) @@ -715,7 +728,7 @@ void Context::deletePaths(GLuint first, GLsizei range) mState.mPaths->deletePaths(first, range); } -bool Context::hasPathData(GLuint path) const +bool Context::isPath(GLuint path) const { const auto *pathObj = mState.mPaths->getPath(path); if (pathObj == nullptr) @@ -724,17 +737,17 @@ bool Context::hasPathData(GLuint path) const return pathObj->hasPathData(); } -bool Context::hasPath(GLuint path) const +bool Context::isPathGenerated(GLuint path) const { return mState.mPaths->hasPath(path); } -void Context::setPathCommands(GLuint path, - GLsizei numCommands, - const GLubyte *commands, - GLsizei numCoords, - GLenum coordType, - const void *coords) +void Context::pathCommands(GLuint path, + GLsizei numCommands, + const GLubyte *commands, + GLsizei numCoords, + GLenum coordType, + const void *coords) { auto *pathObject = mState.mPaths->getPath(path); @@ -809,7 +822,7 @@ void Context::getPathParameteriv(GLuint path, GLenum pname, GLint *value) *value = static_cast(val); } -void Context::setPathStencilFunc(GLenum func, GLint ref, GLuint mask) +void Context::pathStencilFunc(GLenum func, GLint ref, GLuint mask) { mGLState.setPathStencilFunc(func, ref, mask); } @@ -966,7 +979,7 @@ bool Context::isSampler(GLuint samplerName) const return mState.mSamplers->isSampler(samplerName); } -void Context::bindTexture(GLenum target, GLuint handle) +void Context::bindTexture(TextureType target, GLuint handle) { Texture *texture = nullptr; @@ -1118,26 +1131,71 @@ void Context::getQueryiv(GLenum target, GLenum pname, GLint *params) } } +void Context::getQueryivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getQueryiv(target, pname, params); +} + void Context::getQueryObjectiv(GLuint id, GLenum pname, GLint *params) { handleError(GetQueryObjectParameter(getQuery(id), pname, params)); } +void Context::getQueryObjectivRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getQueryObjectiv(id, pname, params); +} + void Context::getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params) { handleError(GetQueryObjectParameter(getQuery(id), pname, params)); } +void Context::getQueryObjectuivRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + getQueryObjectuiv(id, pname, params); +} + void Context::getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params) { handleError(GetQueryObjectParameter(getQuery(id), pname, params)); } +void Context::getQueryObjecti64vRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params) +{ + getQueryObjecti64v(id, pname, params); +} + void Context::getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params) { handleError(GetQueryObjectParameter(getQuery(id), pname, params)); } +void Context::getQueryObjectui64vRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint64 *params) +{ + getQueryObjectui64v(id, pname, params); +} + Framebuffer *Context::getFramebuffer(GLuint handle) const { return mState.mFramebuffers->getFramebuffer(handle); @@ -1170,13 +1228,13 @@ Query *Context::getQuery(GLuint handle) const return mQueryMap.query(handle); } -Texture *Context::getTargetTexture(GLenum target) const +Texture *Context::getTargetTexture(TextureType type) const { - ASSERT(ValidTextureTarget(this, target) || ValidTextureExternalTarget(this, target)); - return mGLState.getTargetTexture(target); + ASSERT(ValidTextureTarget(this, type) || ValidTextureExternalTarget(this, type)); + return mGLState.getTargetTexture(type); } -Texture *Context::getSamplerTexture(unsigned int sampler, GLenum type) const +Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const { return mGLState.getSamplerTexture(sampler, type); } @@ -1231,9 +1289,18 @@ void Context::getFloatvImpl(GLenum pname, GLfloat *params) case GL_PATH_MODELVIEW_MATRIX_CHROMIUM: case GL_PATH_PROJECTION_MATRIX_CHROMIUM: { - ASSERT(mExtensions.pathRendering); - const GLfloat *m = mGLState.getPathRenderingMatrix(pname); - memcpy(params, m, 16 * sizeof(GLfloat)); + // GLES1 emulation: // GL_PATH_(MODELVIEW|PROJECTION)_MATRIX_CHROMIUM collides with the + // GLES1 constants for modelview/projection matrix. + if (getClientVersion() < Version(2, 0)) + { + mGLState.getFloatv(pname, params); + } + else + { + ASSERT(mExtensions.pathRendering); + const GLfloat *m = mGLState.getPathRenderingMatrix(pname); + memcpy(params, m, 16 * sizeof(GLfloat)); + } } break; @@ -1585,8 +1652,21 @@ void Context::getIntegervImpl(GLenum pname, GLint *params) case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT: *params = mCaps.maxGeometryShaderStorageBlocks; break; + // GLES1 emulation: Caps queries + case GL_MAX_TEXTURE_UNITS: + *params = mCaps.maxMultitextureUnits; + break; + case GL_MAX_MODELVIEW_STACK_DEPTH: + *params = mCaps.maxModelviewMatrixStackDepth; + break; + case GL_MAX_PROJECTION_STACK_DEPTH: + *params = mCaps.maxProjectionMatrixStackDepth; + break; + case GL_MAX_TEXTURE_STACK_DEPTH: + *params = mCaps.maxTextureMatrixStackDepth; + break; default: - mGLState.getIntegerv(this, pname, params); + handleError(mGLState.getIntegerv(this, pname, params)); break; } } @@ -1632,6 +1712,14 @@ void Context::getPointerv(GLenum pname, void **params) const mGLState.getPointerv(pname, params); } +void Context::getPointervRobustANGLERobust(GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params) +{ + UNIMPLEMENTED(); +} + void Context::getIntegeri_v(GLenum target, GLuint index, GLint *data) { // Queries about context capabilities and maximums are answered by Context. @@ -1664,6 +1752,15 @@ void Context::getIntegeri_v(GLenum target, GLuint index, GLint *data) } } +void Context::getIntegeri_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint *data) +{ + getIntegeri_v(target, index, data); +} + void Context::getInteger64i_v(GLenum target, GLuint index, GLint64 *data) { // Queries about context capabilities and maximums are answered by Context. @@ -1684,6 +1781,15 @@ void Context::getInteger64i_v(GLenum target, GLuint index, GLint64 *data) } } +void Context::getInteger64i_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint64 *data) +{ + getInteger64i_v(target, index, data); +} + void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data) { // Queries about context capabilities and maximums are answered by Context. @@ -1704,12 +1810,30 @@ void Context::getBooleani_v(GLenum target, GLuint index, GLboolean *data) } } +void Context::getBooleani_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLboolean *data) +{ + getBooleani_v(target, index, data); +} + void Context::getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params) { Buffer *buffer = mGLState.getTargetBuffer(target); QueryBufferParameteriv(buffer, pname, params); } +void Context::getBufferParameterivRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getBufferParameteriv(target, pname, params); +} + void Context::getFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, @@ -1719,66 +1843,174 @@ void Context::getFramebufferAttachmentParameteriv(GLenum target, QueryFramebufferAttachmentParameteriv(this, framebuffer, attachment, pname, params); } +void Context::getFramebufferAttachmentParameterivRobust(GLenum target, + GLenum attachment, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getFramebufferAttachmentParameteriv(target, attachment, pname, params); +} + void Context::getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params) { Renderbuffer *renderbuffer = mGLState.getCurrentRenderbuffer(); QueryRenderbufferiv(this, renderbuffer, pname, params); } -void Context::getTexParameterfv(GLenum target, GLenum pname, GLfloat *params) +void Context::getRenderbufferParameterivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getRenderbufferParameteriv(target, pname, params); +} + +void Context::getTexParameterfv(TextureType target, GLenum pname, GLfloat *params) { Texture *texture = getTargetTexture(target); QueryTexParameterfv(texture, pname, params); } -void Context::getTexParameteriv(GLenum target, GLenum pname, GLint *params) +void Context::getTexParameterfvRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + getTexParameterfv(target, pname, params); +} + +void Context::getTexParameteriv(TextureType target, GLenum pname, GLint *params) { Texture *texture = getTargetTexture(target); QueryTexParameteriv(texture, pname, params); } -void Context::getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) +void Context::getTexParameterivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) { - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + getTexParameteriv(target, pname, params); +} + +void Context::getTexParameterIivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexParameterIuivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexLevelParameteriv(TextureTarget target, GLint level, GLenum pname, GLint *params) +{ + Texture *texture = getTargetTexture(TextureTargetToType(target)); QueryTexLevelParameteriv(texture, target, level, pname, params); } -void Context::getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) +void Context::getTexLevelParameterivRobust(TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) { - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + UNIMPLEMENTED(); +} + +void Context::getTexLevelParameterfv(TextureTarget target, + GLint level, + GLenum pname, + GLfloat *params) +{ + Texture *texture = getTargetTexture(TextureTargetToType(target)); QueryTexLevelParameterfv(texture, target, level, pname, params); } -void Context::texParameterf(GLenum target, GLenum pname, GLfloat param) +void Context::getTexLevelParameterfvRobust(TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::texParameterf(TextureType target, GLenum pname, GLfloat param) { Texture *texture = getTargetTexture(target); SetTexParameterf(this, texture, pname, param); onTextureChange(texture); } -void Context::texParameterfv(GLenum target, GLenum pname, const GLfloat *params) +void Context::texParameterfv(TextureType target, GLenum pname, const GLfloat *params) { Texture *texture = getTargetTexture(target); SetTexParameterfv(this, texture, pname, params); onTextureChange(texture); } -void Context::texParameteri(GLenum target, GLenum pname, GLint param) +void Context::texParameterfvRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLfloat *params) +{ + texParameterfv(target, pname, params); +} + +void Context::texParameteri(TextureType target, GLenum pname, GLint param) { Texture *texture = getTargetTexture(target); SetTexParameteri(this, texture, pname, param); onTextureChange(texture); } -void Context::texParameteriv(GLenum target, GLenum pname, const GLint *params) +void Context::texParameteriv(TextureType target, GLenum pname, const GLint *params) { Texture *texture = getTargetTexture(target); SetTexParameteriv(this, texture, pname, params); onTextureChange(texture); } +void Context::texParameterivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params) +{ + texParameteriv(target, pname, params); +} + +void Context::texParameterIivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::texParameterIuivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLuint *params) +{ + UNIMPLEMENTED(); +} + void Context::drawArrays(GLenum mode, GLint first, GLsizei count) { // No-op if zero count @@ -1789,7 +2021,7 @@ void Context::drawArrays(GLenum mode, GLint first, GLsizei count) ANGLE_CONTEXT_TRY(prepareForDraw()); ANGLE_CONTEXT_TRY(mImplementation->drawArrays(this, mode, first, count)); - MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback()); + MarkTransformFeedbackBufferUsage(this, mGLState.getCurrentTransformFeedback(), count, 1); } void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) @@ -1803,7 +2035,8 @@ void Context::drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsiz ANGLE_CONTEXT_TRY(prepareForDraw()); ANGLE_CONTEXT_TRY( mImplementation->drawArraysInstanced(this, mode, first, count, instanceCount)); - MarkTransformFeedbackBufferUsage(mGLState.getCurrentTransformFeedback()); + MarkTransformFeedbackBufferUsage(this, mGLState.getCurrentTransformFeedback(), count, + instanceCount); } void Context::drawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) @@ -1911,17 +2144,17 @@ void Context::bindUniformLocation(GLuint program, GLint location, const GLchar * programObject->bindUniformLocation(location, name); } -void Context::setCoverageModulation(GLenum components) +void Context::coverageModulation(GLenum components) { mGLState.setCoverageModulation(components); } -void Context::loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix) +void Context::matrixLoadf(GLenum matrixMode, const GLfloat *matrix) { mGLState.loadPathRenderingMatrix(matrixMode, matrix); } -void Context::loadPathRenderingIdentityMatrix(GLenum matrixMode) +void Context::matrixLoadIdentity(GLenum matrixMode) { GLfloat I[16]; angle::Matrix::setToIdentity(I); @@ -1936,7 +2169,7 @@ void Context::stencilFillPath(GLuint path, GLenum fillMode, GLuint mask) return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilFillPath(pathObj, fillMode, mask); } @@ -1948,7 +2181,7 @@ void Context::stencilStrokePath(GLuint path, GLint reference, GLuint mask) return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilStrokePath(pathObj, reference, mask); } @@ -1960,7 +2193,7 @@ void Context::coverFillPath(GLuint path, GLenum coverMode) return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->coverFillPath(pathObj, coverMode); } @@ -1972,7 +2205,7 @@ void Context::coverStrokePath(GLuint path, GLenum coverMode) return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->coverStrokePath(pathObj, coverMode); } @@ -1984,7 +2217,7 @@ void Context::stencilThenCoverFillPath(GLuint path, GLenum fillMode, GLuint mask return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilThenCoverFillPath(pathObj, fillMode, mask, coverMode); } @@ -1999,7 +2232,7 @@ void Context::stencilThenCoverStrokePath(GLuint path, return; // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilThenCoverStrokePath(pathObj, reference, mask, coverMode); } @@ -2015,7 +2248,7 @@ void Context::coverFillPathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->coverFillPathInstanced(pathObjects, coverMode, transformType, transformValues); } @@ -2031,7 +2264,7 @@ void Context::coverStrokePathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->coverStrokePathInstanced(pathObjects, coverMode, transformType, transformValues); @@ -2049,7 +2282,7 @@ void Context::stencilFillPathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilFillPathInstanced(pathObjects, fillMode, mask, transformType, transformValues); @@ -2067,7 +2300,7 @@ void Context::stencilStrokePathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilStrokePathInstanced(pathObjects, reference, mask, transformType, transformValues); @@ -2086,7 +2319,7 @@ void Context::stencilThenCoverFillPathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilThenCoverFillPathInstanced(pathObjects, coverMode, fillMode, mask, transformType, transformValues); @@ -2105,7 +2338,7 @@ void Context::stencilThenCoverStrokePathInstanced(GLsizei numPaths, const auto &pathObjects = GatherPaths(*mState.mPaths, numPaths, pathNameType, paths, pathBase); // TODO(svaisanen@nvidia.com): maybe sync only state required for path rendering? - syncRendererState(); + ANGLE_CONTEXT_TRY(syncState()); mImplementation->stencilThenCoverStrokePathInstanced(pathObjects, coverMode, reference, mask, transformType, transformValues); @@ -2177,6 +2410,16 @@ void Context::getProgramInterfaceiv(GLuint program, QueryProgramInterfaceiv(programObject, programInterface, pname, params); } +void Context::getProgramInterfaceivRobust(GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); +} + void Context::handleError(const Error &error) { if (error.isError()) @@ -2346,7 +2589,7 @@ void Context::detachTexture(GLuint texture) mGLState.detachTexture(this, mZeroTextures, texture); } -void Context::detachBuffer(GLuint buffer) +void Context::detachBuffer(Buffer *buffer) { // Simple pass-through to State's detachBuffer method, since // only buffer attachments to container objects that are bound to the current context @@ -2447,6 +2690,30 @@ void Context::samplerParameteriv(GLuint sampler, GLenum pname, const GLint *para mGLState.setObjectDirty(GL_SAMPLER); } +void Context::samplerParameterivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param) +{ + samplerParameteriv(sampler, pname, param); +} + +void Context::samplerParameterIivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param) +{ + UNIMPLEMENTED(); +} + +void Context::samplerParameterIuivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param) +{ + UNIMPLEMENTED(); +} + void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param) { Sampler *samplerObject = @@ -2463,6 +2730,14 @@ void Context::samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *pa mGLState.setObjectDirty(GL_SAMPLER); } +void Context::samplerParameterfvRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLfloat *param) +{ + samplerParameterfv(sampler, pname, param); +} + void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) { const Sampler *samplerObject = @@ -2471,6 +2746,33 @@ void Context::getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) mGLState.setObjectDirty(GL_SAMPLER); } +void Context::getSamplerParameterivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getSamplerParameteriv(sampler, pname, params); +} + +void Context::getSamplerParameterIivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getSamplerParameterIuivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); +} + void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params) { const Sampler *samplerObject = @@ -2479,6 +2781,15 @@ void Context::getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *param mGLState.setObjectDirty(GL_SAMPLER); } +void Context::getSamplerParameterfvRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + getSamplerParameterfv(sampler, pname, params); +} + void Context::programParameteri(GLuint program, GLenum pname, GLint value) { gl::Program *programObject = getProgram(program); @@ -2628,7 +2939,10 @@ void Context::requestExtension(const char *name) mState.mTextures->signalAllTexturesDirty(this); for (auto &zeroTexture : mZeroTextures) { - zeroTexture.second->signalDirty(this, InitState::Initialized); + if (zeroTexture.get() != nullptr) + { + zeroTexture->signalDirty(this, InitState::Initialized); + } } mState.mFramebuffers->invalidateFramebufferComplenessCache(); @@ -2664,6 +2978,17 @@ void Context::initCaps(const egl::DisplayExtensions &displayExtensions, bool rob { mCaps = mImplementation->getNativeCaps(); + // GLES1 emulation: Initialize caps (Table 6.20 / 6.22 in the ES 1.1 spec) + if (getClientVersion() < Version(2, 0)) + { + mCaps.maxMultitextureUnits = 4; + mCaps.maxClipPlanes = 6; + mCaps.maxLights = 8; + mCaps.maxModelviewMatrixStackDepth = Caps::GlobalMatrixStackDepth; + mCaps.maxProjectionMatrixStackDepth = Caps::GlobalMatrixStackDepth; + mCaps.maxTextureMatrixStackDepth = Caps::GlobalMatrixStackDepth; + } + mExtensions = mImplementation->getNativeExtensions(); mLimitations = mImplementation->getNativeLimitations(); @@ -2751,8 +3076,9 @@ void Context::initCaps(const egl::DisplayExtensions &displayExtensions, bool rob mExtensions.webglCompatibility = mWebGLContext; for (const auto &extensionInfo : GetExtensionInfoMap()) { - // If this context is for WebGL, disable all enableable extensions - if (mWebGLContext && extensionInfo.second.Requestable) + // If the user has requested that extensions start disabled and they are requestable, + // disable them. + if (!mExtensionsEnabled && extensionInfo.second.Requestable) { mExtensions.*(extensionInfo.second.ExtensionsMember) = false; } @@ -2891,7 +3217,7 @@ void Context::initWorkarounds() Error Context::prepareForDraw() { - syncRendererState(); + ANGLE_TRY(syncDirtyObjects()); if (isRobustResourceInitEnabled()) { @@ -2899,24 +3225,65 @@ Error Context::prepareForDraw() ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureDrawAttachmentsInitialized(this)); } + ANGLE_TRY(syncDirtyBits()); return NoError(); } -void Context::syncRendererState() +Error Context::prepareForClear(GLbitfield mask) +{ + ANGLE_TRY(syncDirtyObjects(mClearDirtyObjects)); + ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureClearAttachmentsInitialized(this, mask)); + ANGLE_TRY(syncDirtyBits(mClearDirtyBits)); + return NoError(); +} + +Error Context::prepareForClearBuffer(GLenum buffer, GLint drawbuffer) +{ + ANGLE_TRY(syncDirtyObjects(mClearDirtyObjects)); + ANGLE_TRY(mGLState.getDrawFramebuffer()->ensureClearBufferAttachmentsInitialized(this, buffer, + drawbuffer)); + ANGLE_TRY(syncDirtyBits(mClearDirtyBits)); + return NoError(); +} + +Error Context::syncState() +{ + ANGLE_TRY(syncDirtyObjects()); + ANGLE_TRY(syncDirtyBits()); + return NoError(); +} + +Error Context::syncState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask) +{ + ANGLE_TRY(syncDirtyObjects(objectMask)); + ANGLE_TRY(syncDirtyBits(bitMask)); + return NoError(); +} + +Error Context::syncDirtyBits() { - mGLState.syncDirtyObjects(this); const State::DirtyBits &dirtyBits = mGLState.getDirtyBits(); mImplementation->syncState(this, dirtyBits); mGLState.clearDirtyBits(); + return NoError(); } -void Context::syncRendererState(const State::DirtyBits &bitMask, - const State::DirtyObjects &objectMask) +Error Context::syncDirtyBits(const State::DirtyBits &bitMask) { - mGLState.syncDirtyObjects(this, objectMask); const State::DirtyBits &dirtyBits = (mGLState.getDirtyBits() & bitMask); mImplementation->syncState(this, dirtyBits); mGLState.clearDirtyBits(dirtyBits); + return NoError(); +} + +Error Context::syncDirtyObjects() +{ + return mGLState.syncDirtyObjects(this); +} + +Error Context::syncDirtyObjects(const State::DirtyObjects &objectMask) +{ + return mGLState.syncDirtyObjects(this, objectMask); } void Context::blitFramebuffer(GLint srcX0, @@ -2943,33 +3310,36 @@ void Context::blitFramebuffer(GLint srcX0, Rectangle srcArea(srcX0, srcY0, srcX1 - srcX0, srcY1 - srcY0); Rectangle dstArea(dstX0, dstY0, dstX1 - dstX0, dstY1 - dstY0); - syncStateForBlit(); + ANGLE_CONTEXT_TRY(syncStateForBlit()); handleError(drawFramebuffer->blit(this, srcArea, dstArea, mask, filter)); } void Context::clear(GLbitfield mask) { - syncStateForClear(); - handleError(mGLState.getDrawFramebuffer()->clear(this, mask)); + ANGLE_CONTEXT_TRY(prepareForClear(mask)); + ANGLE_CONTEXT_TRY(mGLState.getDrawFramebuffer()->clear(this, mask)); } void Context::clearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *values) { - syncStateForClear(); - handleError(mGLState.getDrawFramebuffer()->clearBufferfv(this, buffer, drawbuffer, values)); + ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer)); + ANGLE_CONTEXT_TRY( + mGLState.getDrawFramebuffer()->clearBufferfv(this, buffer, drawbuffer, values)); } void Context::clearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *values) { - syncStateForClear(); - handleError(mGLState.getDrawFramebuffer()->clearBufferuiv(this, buffer, drawbuffer, values)); + ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer)); + ANGLE_CONTEXT_TRY( + mGLState.getDrawFramebuffer()->clearBufferuiv(this, buffer, drawbuffer, values)); } void Context::clearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *values) { - syncStateForClear(); - handleError(mGLState.getDrawFramebuffer()->clearBufferiv(this, buffer, drawbuffer, values)); + ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer)); + ANGLE_CONTEXT_TRY( + mGLState.getDrawFramebuffer()->clearBufferiv(this, buffer, drawbuffer, values)); } void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) @@ -2984,8 +3354,8 @@ void Context::clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLin return; } - syncStateForClear(); - handleError(framebufferObject->clearBufferfi(this, buffer, drawbuffer, depth, stencil)); + ANGLE_CONTEXT_TRY(prepareForClearBuffer(buffer, drawbuffer)); + ANGLE_CONTEXT_TRY(framebufferObject->clearBufferfi(this, buffer, drawbuffer, depth, stencil)); } void Context::readPixels(GLint x, @@ -3001,7 +3371,7 @@ void Context::readPixels(GLint x, return; } - syncStateForReadPixels(); + ANGLE_CONTEXT_TRY(syncStateForReadPixels()); Framebuffer *readFBO = mGLState.getReadFramebuffer(); ASSERT(readFBO); @@ -3010,7 +3380,37 @@ void Context::readPixels(GLint x, handleError(readFBO->readPixels(this, area, format, type, pixels)); } -void Context::copyTexImage2D(GLenum target, +void Context::readPixelsRobust(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + GLsizei *columns, + GLsizei *rows, + void *pixels) +{ + readPixels(x, y, width, height, format, type, pixels); +} + +void Context::readnPixelsRobust(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + GLsizei *columns, + GLsizei *rows, + void *data) +{ + readPixels(x, y, width, height, format, type, data); +} + +void Context::copyTexImage2D(TextureTarget target, GLint level, GLenum internalformat, GLint x, @@ -3020,17 +3420,16 @@ void Context::copyTexImage2D(GLenum target, GLint border) { // Only sync the read FBO - mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER)); Rectangle sourceArea(x, y, width, height); Framebuffer *framebuffer = mGLState.getReadFramebuffer(); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->copyImage(this, target, level, sourceArea, internalformat, framebuffer)); } -void Context::copyTexSubImage2D(GLenum target, +void Context::copyTexSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -3045,18 +3444,17 @@ void Context::copyTexSubImage2D(GLenum target, } // Only sync the read FBO - mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER)); Offset destOffset(xoffset, yoffset, 0); Rectangle sourceArea(x, y, width, height); Framebuffer *framebuffer = mGLState.getReadFramebuffer(); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer)); } -void Context::copyTexSubImage3D(GLenum target, +void Context::copyTexSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -3072,19 +3470,20 @@ void Context::copyTexSubImage3D(GLenum target, } // Only sync the read FBO - mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_READ_FRAMEBUFFER)); Offset destOffset(xoffset, yoffset, zoffset); Rectangle sourceArea(x, y, width, height); Framebuffer *framebuffer = mGLState.getReadFramebuffer(); Texture *texture = getTargetTexture(target); - handleError(texture->copySubImage(this, target, level, destOffset, sourceArea, framebuffer)); + handleError(texture->copySubImage(this, NonCubeTextureTypeToTarget(target), level, destOffset, + sourceArea, framebuffer)); } void Context::framebufferTexture2D(GLenum target, GLenum attachment, - GLenum textarget, + TextureTarget textarget, GLuint texture, GLint level) { @@ -3097,22 +3496,22 @@ void Context::framebufferTexture2D(GLenum target, ImageIndex index = ImageIndex::MakeInvalid(); - if (textarget == GL_TEXTURE_2D) + if (textarget == TextureTarget::_2D) { index = ImageIndex::Make2D(level); } - else if (textarget == GL_TEXTURE_RECTANGLE_ANGLE) + else if (textarget == TextureTarget::Rectangle) { index = ImageIndex::MakeRectangle(level); } - else if (textarget == GL_TEXTURE_2D_MULTISAMPLE) + else if (textarget == TextureTarget::_2DMultisample) { ASSERT(level == 0); index = ImageIndex::Make2DMultisample(); } else { - ASSERT(IsCubeMapTextureTarget(textarget)); + ASSERT(TextureTargetToType(textarget) == TextureType::CubeMap); index = ImageIndex::MakeCube(textarget, level); } @@ -3164,13 +3563,13 @@ void Context::framebufferTextureLayer(GLenum target, ImageIndex index = ImageIndex::MakeInvalid(); - if (textureObject->getTarget() == GL_TEXTURE_3D) + if (textureObject->getType() == TextureType::_3D) { index = ImageIndex::Make3D(level, layer); } else { - ASSERT(textureObject->getTarget() == GL_TEXTURE_2D_ARRAY); + ASSERT(textureObject->getType() == TextureType::_2DArray); index = ImageIndex::Make2DArray(level, layer); } @@ -3184,12 +3583,12 @@ void Context::framebufferTextureLayer(GLenum target, mGLState.setObjectDirty(target); } -void Context::framebufferTextureMultiviewLayeredANGLE(GLenum target, - GLenum attachment, - GLuint texture, - GLint level, - GLint baseViewIndex, - GLsizei numViews) +void Context::framebufferTextureMultiviewLayered(GLenum target, + GLenum attachment, + GLuint texture, + GLint level, + GLint baseViewIndex, + GLsizei numViews) { Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); @@ -3210,12 +3609,12 @@ void Context::framebufferTextureMultiviewLayeredANGLE(GLenum target, mGLState.setObjectDirty(target); } -void Context::framebufferTextureMultiviewSideBySideANGLE(GLenum target, - GLenum attachment, - GLuint texture, - GLint level, - GLsizei numViews, - const GLint *viewportOffsets) +void Context::framebufferTextureMultiviewSideBySide(GLenum target, + GLenum attachment, + GLuint texture, + GLint level, + GLsizei numViews, + const GLint *viewportOffsets) { Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); @@ -3254,7 +3653,7 @@ void Context::readBuffer(GLenum mode) void Context::discardFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments) { // Only sync the FBO - mGLState.syncDirtyObject(this, target); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target)); Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); @@ -3269,12 +3668,14 @@ void Context::invalidateFramebuffer(GLenum target, const GLenum *attachments) { // Only sync the FBO - mGLState.syncDirtyObject(this, target); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target)); Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); - if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE) + bool complete = false; + ANGLE_CONTEXT_TRY(framebuffer->isComplete(this, &complete)); + if (!complete) { return; } @@ -3291,12 +3692,14 @@ void Context::invalidateSubFramebuffer(GLenum target, GLsizei height) { // Only sync the FBO - mGLState.syncDirtyObject(this, target); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, target)); Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); - if (framebuffer->checkStatus(this) != GL_FRAMEBUFFER_COMPLETE) + bool complete = false; + ANGLE_CONTEXT_TRY(framebuffer->isComplete(this, &complete)); + if (!complete) { return; } @@ -3305,7 +3708,7 @@ void Context::invalidateSubFramebuffer(GLenum target, handleError(framebuffer->invalidateSub(this, numAttachments, attachments, area)); } -void Context::texImage2D(GLenum target, +void Context::texImage2D(TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -3315,16 +3718,29 @@ void Context::texImage2D(GLenum target, GLenum type, const void *pixels) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Extents size(width, height, 1); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat, size, format, type, reinterpret_cast(pixels))); } -void Context::texImage3D(GLenum target, +void Context::texImage2DRobust(TextureTarget target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + texImage2D(target, level, internalformat, width, height, border, format, type, pixels); +} + +void Context::texImage3D(TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -3335,15 +3751,31 @@ void Context::texImage3D(GLenum target, GLenum type, const void *pixels) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Extents size(width, height, depth); Texture *texture = getTargetTexture(target); - handleError(texture->setImage(this, mGLState.getUnpackState(), target, level, internalformat, - size, format, type, reinterpret_cast(pixels))); + handleError(texture->setImage(this, mGLState.getUnpackState(), + NonCubeTextureTypeToTarget(target), level, internalformat, size, + format, type, reinterpret_cast(pixels))); } -void Context::texSubImage2D(GLenum target, +void Context::texImage3DRobust(TextureType target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + texImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels); +} + +void Context::texSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -3359,16 +3791,29 @@ void Context::texSubImage2D(GLenum target, return; } - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Box area(xoffset, yoffset, 0, width, height, 1); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format, type, reinterpret_cast(pixels))); } -void Context::texSubImage3D(GLenum target, +void Context::texSubImage2DRobust(TextureTarget target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +void Context::texSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -3386,15 +3831,33 @@ void Context::texSubImage3D(GLenum target, return; } - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Box area(xoffset, yoffset, zoffset, width, height, depth); Texture *texture = getTargetTexture(target); - handleError(texture->setSubImage(this, mGLState.getUnpackState(), target, level, area, format, - type, reinterpret_cast(pixels))); + handleError(texture->setSubImage(this, mGLState.getUnpackState(), + NonCubeTextureTypeToTarget(target), level, area, format, type, + reinterpret_cast(pixels))); } -void Context::compressedTexImage2D(GLenum target, +void Context::texSubImage3DRobust(TextureType target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, + pixels); +} + +void Context::compressedTexImage2D(TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -3403,17 +3866,29 @@ void Context::compressedTexImage2D(GLenum target, GLsizei imageSize, const void *data) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Extents size(width, height, 1); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level, internalformat, size, imageSize, reinterpret_cast(data))); } -void Context::compressedTexImage3D(GLenum target, +void Context::compressedTexImage2DRobust(TextureTarget target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data) +{ + compressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); +} + +void Context::compressedTexImage3D(TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -3423,16 +3898,31 @@ void Context::compressedTexImage3D(GLenum target, GLsizei imageSize, const void *data) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Extents size(width, height, depth); Texture *texture = getTargetTexture(target); - handleError(texture->setCompressedImage(this, mGLState.getUnpackState(), target, level, - internalformat, size, imageSize, - reinterpret_cast(data))); + handleError(texture->setCompressedImage( + this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, internalformat, + size, imageSize, reinterpret_cast(data))); } -void Context::compressedTexSubImage2D(GLenum target, +void Context::compressedTexImage3DRobust(TextureType target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data) +{ + compressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, + data); +} + +void Context::compressedTexSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -3442,17 +3932,31 @@ void Context::compressedTexSubImage2D(GLenum target, GLsizei imageSize, const void *data) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Box area(xoffset, yoffset, 0, width, height, 1); - Texture *texture = - getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + Texture *texture = getTargetTexture(TextureTargetToType(target)); handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area, format, imageSize, reinterpret_cast(data))); } -void Context::compressedTexSubImage3D(GLenum target, +void Context::compressedTexSubImage2DRobust(TextureTarget target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data) +{ + compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, + data); +} + +void Context::compressedTexSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -3470,16 +3974,33 @@ void Context::compressedTexSubImage3D(GLenum target, return; } - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); Box area(xoffset, yoffset, zoffset, width, height, depth); Texture *texture = getTargetTexture(target); - handleError(texture->setCompressedSubImage(this, mGLState.getUnpackState(), target, level, area, - format, imageSize, - reinterpret_cast(data))); + handleError(texture->setCompressedSubImage( + this, mGLState.getUnpackState(), NonCubeTextureTypeToTarget(target), level, area, format, + imageSize, reinterpret_cast(data))); } -void Context::generateMipmap(GLenum target) +void Context::compressedTexSubImage3DRobust(TextureType target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data) +{ + compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, + imageSize, data); +} + +void Context::generateMipmap(TextureType target) { Texture *texture = getTargetTexture(target); handleError(texture->generateMipmap(this)); @@ -3487,7 +4008,7 @@ void Context::generateMipmap(GLenum target) void Context::copyTexture(GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint internalFormat, @@ -3496,7 +4017,7 @@ void Context::copyTexture(GLuint sourceId, GLboolean unpackPremultiplyAlpha, GLboolean unpackUnmultiplyAlpha) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *destTexture = getTexture(destId); @@ -3508,7 +4029,7 @@ void Context::copyTexture(GLuint sourceId, void Context::copySubTexture(GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint xoffset, @@ -3527,7 +4048,7 @@ void Context::copySubTexture(GLuint sourceId, return; } - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *destTexture = getTexture(destId); @@ -3541,7 +4062,7 @@ void Context::copySubTexture(GLuint sourceId, void Context::compressedCopyTexture(GLuint sourceId, GLuint destId) { - syncStateForTexImage(); + ANGLE_CONTEXT_TRY(syncStateForTexImage()); gl::Texture *sourceTexture = getTexture(sourceId); gl::Texture *destTexture = getTexture(destId); @@ -3556,6 +4077,15 @@ void Context::getBufferPointerv(BufferBinding target, GLenum pname, void **param QueryBufferPointerv(buffer, pname, params); } +void Context::getBufferPointervRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params) +{ + getBufferPointerv(target, pname, params); +} + void *Context::mapBuffer(BufferBinding target, GLenum access) { Buffer *buffer = mGLState.getTargetBuffer(target); @@ -3612,24 +4142,19 @@ void Context::flushMappedBufferRange(BufferBinding /*target*/, // We do not currently support a non-trivial implementation of FlushMappedBufferRange } -void Context::syncStateForReadPixels() +Error Context::syncStateForReadPixels() { - syncRendererState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects); + return syncState(mReadPixelsDirtyBits, mReadPixelsDirtyObjects); } -void Context::syncStateForTexImage() +Error Context::syncStateForTexImage() { - syncRendererState(mTexImageDirtyBits, mTexImageDirtyObjects); + return syncState(mTexImageDirtyBits, mTexImageDirtyObjects); } -void Context::syncStateForClear() +Error Context::syncStateForBlit() { - syncRendererState(mClearDirtyBits, mClearDirtyObjects); -} - -void Context::syncStateForBlit() -{ - syncRendererState(mBlitDirtyBits, mBlitDirtyObjects); + return syncState(mBlitDirtyBits, mBlitDirtyObjects); } void Context::activeShaderProgram(GLuint pipeline, GLuint program) @@ -4009,6 +4534,15 @@ void Context::getVertexAttribiv(GLuint index, GLenum pname, GLint *params) currentValues, pname, params); } +void Context::getVertexAttribivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getVertexAttribiv(index, pname, params); +} + void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params) { const VertexAttribCurrentValueData ¤tValues = @@ -4018,6 +4552,15 @@ void Context::getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params) currentValues, pname, params); } +void Context::getVertexAttribfvRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + getVertexAttribfv(index, pname, params); +} + void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params) { const VertexAttribCurrentValueData ¤tValues = @@ -4027,6 +4570,15 @@ void Context::getVertexAttribIiv(GLuint index, GLenum pname, GLint *params) currentValues, pname, params); } +void Context::getVertexAttribIivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getVertexAttribIiv(index, pname, params); +} + void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params) { const VertexAttribCurrentValueData ¤tValues = @@ -4036,12 +4588,30 @@ void Context::getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params) currentValues, pname, params); } +void Context::getVertexAttribIuivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + getVertexAttribIuiv(index, pname, params); +} + void Context::getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer) { const VertexAttribute &attrib = getGLState().getVertexArray()->getVertexAttribute(index); QueryVertexAttribPointerv(attrib, pname, pointer); } +void Context::getVertexAttribPointervRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **pointer) +{ + getVertexAttribPointerv(index, pname, pointer); +} + void Context::debugMessageControl(GLenum source, GLenum type, GLenum severity, @@ -4200,7 +4770,7 @@ void Context::bindRenderbuffer(GLenum target, GLuint renderbuffer) mGLState.setRenderbufferBinding(this, object); } -void Context::texStorage2DMultisample(GLenum target, +void Context::texStorage2DMultisample(TextureType target, GLsizei samples, GLenum internalformat, GLsizei width, @@ -4217,7 +4787,7 @@ void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val) { // According to spec 3.1 Table 20.49: Framebuffer Dependent Values, // the sample position should be queried by DRAW_FRAMEBUFFER. - mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER); + ANGLE_CONTEXT_TRY(mGLState.syncDirtyObject(this, GL_DRAW_FRAMEBUFFER)); const Framebuffer *framebuffer = mGLState.getDrawFramebuffer(); switch (pname) @@ -4230,6 +4800,15 @@ void Context::getMultisamplefv(GLenum pname, GLuint index, GLfloat *val) } } +void Context::getMultisamplefvRobust(GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val) +{ + UNIMPLEMENTED(); +} + void Context::renderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, @@ -4268,6 +4847,15 @@ void Context::getFramebufferParameteriv(GLenum target, GLenum pname, GLint *para QueryFramebufferParameteriv(framebuffer, pname, params); } +void Context::getFramebufferParameterivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); +} + void Context::framebufferParameteri(GLenum target, GLenum pname, GLint param) { Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); @@ -4296,7 +4884,7 @@ Error Context::getZeroFilledBuffer(size_t requstedSizeBytes, Error Context::prepareForDispatch() { - syncRendererState(mComputeDirtyBits, mComputeDirtyObjects); + ANGLE_TRY(syncState(mComputeDirtyBits, mComputeDirtyObjects)); if (isRobustResourceInitEnabled()) { @@ -4323,7 +4911,7 @@ void Context::dispatchComputeIndirect(GLintptr indirect) handleError(mImplementation->dispatchComputeIndirect(this, indirect)); } -void Context::texStorage2D(GLenum target, +void Context::texStorage2D(TextureType target, GLsizei levels, GLenum internalFormat, GLsizei width, @@ -4334,7 +4922,7 @@ void Context::texStorage2D(GLenum target, handleError(texture->setStorage(this, target, levels, internalFormat, size)); } -void Context::texStorage3D(GLenum target, +void Context::texStorage3D(TextureType target, GLsizei levels, GLenum internalFormat, GLsizei width, @@ -4361,7 +4949,14 @@ GLenum Context::checkFramebufferStatus(GLenum target) Framebuffer *framebuffer = mGLState.getTargetFramebuffer(target); ASSERT(framebuffer); - return framebuffer->checkStatus(this); + GLenum status = GL_NONE; + Error err = framebuffer->checkStatus(this, &status); + if (err.isError()) + { + handleError(err); + return 0; + } + return status; } void Context::compileShader(GLuint shader) @@ -4511,6 +5106,11 @@ void Context::getBooleanv(GLenum pname, GLboolean *params) } } +void Context::getBooleanvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *params) +{ + getBooleanv(pname, params); +} + void Context::getFloatv(GLenum pname, GLfloat *params) { GLenum nativeType; @@ -4527,6 +5127,11 @@ void Context::getFloatv(GLenum pname, GLfloat *params) } } +void Context::getFloatvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params) +{ + getFloatv(pname, params); +} + void Context::getIntegerv(GLenum pname, GLint *params) { GLenum nativeType; @@ -4543,6 +5148,11 @@ void Context::getIntegerv(GLenum pname, GLint *params) } } +void Context::getIntegervRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data) +{ + getIntegerv(pname, data); +} + void Context::getProgramiv(GLuint program, GLenum pname, GLint *params) { Program *programObject = getProgram(program); @@ -4550,6 +5160,15 @@ void Context::getProgramiv(GLuint program, GLenum pname, GLint *params) QueryProgramiv(this, programObject, pname, params); } +void Context::getProgramivRobust(GLuint program, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getProgramiv(program, pname, params); +} + void Context::getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) { UNIMPLEMENTED(); @@ -4577,6 +5196,15 @@ void Context::getShaderiv(GLuint shader, GLenum pname, GLint *params) QueryShaderiv(this, shaderObject, pname, params); } +void Context::getShaderivRobust(GLuint shader, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getShaderiv(shader, pname, params); +} + void Context::getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog) { Shader *shaderObject = getShader(shader); @@ -4671,6 +5299,15 @@ void Context::getUniformfv(GLuint program, GLint location, GLfloat *params) programObject->getUniformfv(this, location, params); } +void Context::getUniformfvRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + getUniformfv(program, location, params); +} + void Context::getUniformiv(GLuint program, GLint location, GLint *params) { Program *programObject = getProgram(program); @@ -4678,6 +5315,15 @@ void Context::getUniformiv(GLuint program, GLint location, GLint *params) programObject->getUniformiv(this, location, params); } +void Context::getUniformivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getUniformiv(program, location, params); +} + GLint Context::getUniformLocation(GLuint program, const GLchar *name) { Program *programObject = getProgram(program); @@ -5240,6 +5886,15 @@ void Context::getUniformuiv(GLuint program, GLint location, GLuint *params) programObject->getUniformuiv(this, location, params); } +void Context::getUniformuivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + getUniformuiv(program, location, params); +} + GLint Context::getFragDataLocation(GLuint program, const GLchar *name) { const Program *programObject = getProgram(program); @@ -5297,6 +5952,16 @@ void Context::getActiveUniformBlockiv(GLuint program, QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params); } +void Context::getActiveUniformBlockivRobust(GLuint program, + GLuint uniformBlockIndex, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getActiveUniformBlockiv(program, uniformBlockIndex, pname, params); +} + void Context::getActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, @@ -5368,12 +6033,26 @@ void Context::getInteger64v(GLenum pname, GLint64 *params) } } +void Context::getInteger64vRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data) +{ + getInteger64v(pname, data); +} + void Context::getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params) { Buffer *buffer = mGLState.getTargetBuffer(target); QueryBufferParameteri64v(buffer, pname, params); } +void Context::getBufferParameteri64vRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params) +{ + getBufferParameteri64v(target, pname, params); +} + void Context::genSamplers(GLsizei count, GLuint *samplers) { for (int i = 0; i < count; i++) @@ -5407,6 +6086,16 @@ void Context::getInternalformativ(GLenum target, QueryInternalFormativ(formatCaps, pname, bufSize, params); } +void Context::getInternalformativRobust(GLenum target, + GLenum internalformat, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + getInternalformativ(target, internalformat, pname, bufSize, params); +} + void Context::programUniform1i(GLuint program, GLint location, GLint v0) { programUniform1iv(program, location, 1, &v0); @@ -5685,6 +6374,15 @@ void Context::onTextureChange(const Texture *texture) mGLState.setObjectDirty(GL_TEXTURE); } +bool Context::isCurrentTransformFeedback(const TransformFeedback *tf) const +{ + return mGLState.isCurrentTransformFeedback(tf); +} +bool Context::isCurrentVertexArray(const VertexArray *va) const +{ + return mGLState.isCurrentVertexArray(va); +} + void Context::genProgramPipelines(GLsizei count, GLuint *pipelines) { for (int i = 0; i < count; i++) @@ -5774,6 +6472,15 @@ void Context::getnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLf programObject->getUniformfv(this, location, params); } +void Context::getnUniformfvRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + UNIMPLEMENTED(); +} + void Context::getnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params) { Program *programObject = getProgram(program); @@ -5782,6 +6489,24 @@ void Context::getnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLi programObject->getUniformiv(this, location, params); } +void Context::getnUniformivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getnUniformuivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); +} + GLboolean Context::isFenceNV(GLuint fence) { FenceNV *fenceObject = getFenceNV(fence); @@ -5836,7 +6561,7 @@ GLboolean Context::testFenceNV(GLuint fence) return result; } -void Context::eGLImageTargetTexture2D(GLenum target, GLeglImageOES image) +void Context::eGLImageTargetTexture2D(TextureType target, GLeglImageOES image) { Texture *texture = getTargetTexture(target); egl::Image *imageObject = reinterpret_cast(image); @@ -5855,510 +6580,771 @@ void Context::texStorage1D(GLenum target, GLsizei levels, GLenum internalformat, UNIMPLEMENTED(); } -void Context::alphaFunc(GLenum func, GLfloat ref) -{ - UNIMPLEMENTED(); -} - -void Context::alphaFuncx(GLenum func, GLfixed ref) -{ - UNIMPLEMENTED(); -} - -void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -{ - UNIMPLEMENTED(); -} - -void Context::clearDepthx(GLfixed depth) -{ - UNIMPLEMENTED(); -} - -void Context::clientActiveTexture(GLenum texture) -{ - UNIMPLEMENTED(); -} - -void Context::clipPlanef(GLenum p, const GLfloat *eqn) -{ - UNIMPLEMENTED(); -} - -void Context::clipPlanex(GLenum plane, const GLfixed *equation) -{ - UNIMPLEMENTED(); -} - -void Context::color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - UNIMPLEMENTED(); -} - -void Context::color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) -{ - UNIMPLEMENTED(); -} - -void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -{ - UNIMPLEMENTED(); -} - -void Context::colorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) -{ - UNIMPLEMENTED(); -} - -void Context::cullFace(GLenum mode) -{ - UNIMPLEMENTED(); -} - -void Context::depthRangex(GLfixed n, GLfixed f) -{ - UNIMPLEMENTED(); -} - -void Context::disableClientState(GLenum array) -{ - UNIMPLEMENTED(); -} - -void Context::enableClientState(GLenum array) -{ - UNIMPLEMENTED(); -} - -void Context::fogf(GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::fogfv(GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::fogx(GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::fogxv(GLenum pname, const GLfixed *param) -{ - UNIMPLEMENTED(); -} - -void Context::frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -{ - UNIMPLEMENTED(); -} - -void Context::frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -{ - UNIMPLEMENTED(); -} - -void Context::getBufferParameteriv(GLenum target, GLenum pname, GLint *params) -{ - UNIMPLEMENTED(); -} - -void Context::getClipPlanef(GLenum plane, GLfloat *equation) -{ - UNIMPLEMENTED(); -} - -void Context::getClipPlanex(GLenum plane, GLfixed *equation) -{ - UNIMPLEMENTED(); -} - -void Context::getFixedv(GLenum pname, GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::getLightfv(GLenum light, GLenum pname, GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::getLightxv(GLenum light, GLenum pname, GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::getMaterialfv(GLenum face, GLenum pname, GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::getMaterialxv(GLenum face, GLenum pname, GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::getTexEnvfv(GLenum target, GLenum pname, GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::getTexEnviv(GLenum target, GLenum pname, GLint *params) -{ - UNIMPLEMENTED(); -} - -void Context::getTexEnvxv(GLenum target, GLenum pname, GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::getTexParameterxv(GLenum target, GLenum pname, GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::lightModelf(GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::lightModelfv(GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::lightModelx(GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::lightModelxv(GLenum pname, const GLfixed *param) -{ - UNIMPLEMENTED(); -} - -void Context::lightf(GLenum light, GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::lightfv(GLenum light, GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::lightx(GLenum light, GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::lightxv(GLenum light, GLenum pname, const GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::lineWidthx(GLfixed width) -{ - UNIMPLEMENTED(); -} - -void Context::loadIdentity() -{ - UNIMPLEMENTED(); -} - -void Context::loadMatrixf(const GLfloat *m) -{ - UNIMPLEMENTED(); -} - -void Context::loadMatrixx(const GLfixed *m) -{ - UNIMPLEMENTED(); -} - -void Context::logicOp(GLenum opcode) -{ - UNIMPLEMENTED(); -} - -void Context::materialf(GLenum face, GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::materialfv(GLenum face, GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::materialx(GLenum face, GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::materialxv(GLenum face, GLenum pname, const GLfixed *param) -{ - UNIMPLEMENTED(); -} - -void Context::matrixMode(GLenum mode) -{ - UNIMPLEMENTED(); -} - -void Context::multMatrixf(const GLfloat *m) -{ - UNIMPLEMENTED(); -} - -void Context::multMatrixx(const GLfixed *m) -{ - UNIMPLEMENTED(); -} - -void Context::multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -{ - UNIMPLEMENTED(); -} - -void Context::multiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -{ - UNIMPLEMENTED(); -} - -void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz) -{ - UNIMPLEMENTED(); -} - -void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz) -{ - UNIMPLEMENTED(); -} - -void Context::normalPointer(GLenum type, GLsizei stride, const void *pointer) -{ - UNIMPLEMENTED(); -} - -void Context::orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -{ - UNIMPLEMENTED(); -} - -void Context::orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -{ - UNIMPLEMENTED(); -} - -void Context::pointParameterf(GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::pointParameterfv(GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::pointParameterx(GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::pointParameterxv(GLenum pname, const GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::pointSize(GLfloat size) -{ - UNIMPLEMENTED(); -} - -void Context::pointSizex(GLfixed size) -{ - UNIMPLEMENTED(); -} - -void Context::polygonOffsetx(GLfixed factor, GLfixed units) -{ - UNIMPLEMENTED(); -} - -void Context::popMatrix() -{ - UNIMPLEMENTED(); -} - -void Context::pushMatrix() -{ - UNIMPLEMENTED(); -} - -void Context::rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) -{ - UNIMPLEMENTED(); -} - -void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -{ - UNIMPLEMENTED(); -} - -void Context::sampleCoveragex(GLclampx value, GLboolean invert) -{ - UNIMPLEMENTED(); -} - -void Context::scalef(GLfloat x, GLfloat y, GLfloat z) -{ - UNIMPLEMENTED(); -} - -void Context::scalex(GLfixed x, GLfixed y, GLfixed z) -{ - UNIMPLEMENTED(); -} - -void Context::shadeModel(GLenum mode) -{ - UNIMPLEMENTED(); -} - -void Context::texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) -{ - UNIMPLEMENTED(); -} - -void Context::texEnvf(GLenum target, GLenum pname, GLfloat param) -{ - UNIMPLEMENTED(); -} - -void Context::texEnvfv(GLenum target, GLenum pname, const GLfloat *params) -{ - UNIMPLEMENTED(); -} - -void Context::texEnvi(GLenum target, GLenum pname, GLint param) -{ - UNIMPLEMENTED(); -} - -void Context::texEnviv(GLenum target, GLenum pname, const GLint *params) -{ - UNIMPLEMENTED(); -} - -void Context::texEnvx(GLenum target, GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::texEnvxv(GLenum target, GLenum pname, const GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::texParameterx(GLenum target, GLenum pname, GLfixed param) -{ - UNIMPLEMENTED(); -} - -void Context::texParameterxv(GLenum target, GLenum pname, const GLfixed *params) -{ - UNIMPLEMENTED(); -} - -void Context::translatef(GLfloat x, GLfloat y, GLfloat z) -{ - UNIMPLEMENTED(); -} - -void Context::translatex(GLfixed x, GLfixed y, GLfixed z) -{ - UNIMPLEMENTED(); -} - -void Context::vertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexfv(const GLfloat *coords) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexiv(const GLint *coords) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) -{ - UNIMPLEMENTED(); -} - -void Context::drawTexsv(const GLshort *coords) -{ - UNIMPLEMENTED(); +bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) +{ + // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation + // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due + // to the fact that it is stored internally as a float, and so would require conversion + // if returned from Context::getIntegerv. Since this conversion is already implemented + // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we + // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling + // application. + switch (pname) + { + case GL_COMPRESSED_TEXTURE_FORMATS: + { + *type = GL_INT; + *numParams = static_cast(getCaps().compressedTextureFormats.size()); + return true; + } + case GL_SHADER_BINARY_FORMATS: + { + *type = GL_INT; + *numParams = static_cast(getCaps().shaderBinaryFormats.size()); + return true; + } + + case GL_MAX_VERTEX_ATTRIBS: + case GL_MAX_VERTEX_UNIFORM_VECTORS: + case GL_MAX_VARYING_VECTORS: + case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: + case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: + case GL_MAX_TEXTURE_IMAGE_UNITS: + case GL_MAX_FRAGMENT_UNIFORM_VECTORS: + case GL_MAX_RENDERBUFFER_SIZE: + case GL_NUM_SHADER_BINARY_FORMATS: + case GL_NUM_COMPRESSED_TEXTURE_FORMATS: + case GL_ARRAY_BUFFER_BINDING: + case GL_FRAMEBUFFER_BINDING: + case GL_RENDERBUFFER_BINDING: + case GL_CURRENT_PROGRAM: + case GL_PACK_ALIGNMENT: + case GL_UNPACK_ALIGNMENT: + case GL_GENERATE_MIPMAP_HINT: + case GL_RED_BITS: + case GL_GREEN_BITS: + case GL_BLUE_BITS: + case GL_ALPHA_BITS: + case GL_DEPTH_BITS: + case GL_STENCIL_BITS: + case GL_ELEMENT_ARRAY_BUFFER_BINDING: + case GL_CULL_FACE_MODE: + case GL_FRONT_FACE: + case GL_ACTIVE_TEXTURE: + case GL_STENCIL_FUNC: + case GL_STENCIL_VALUE_MASK: + case GL_STENCIL_REF: + case GL_STENCIL_FAIL: + case GL_STENCIL_PASS_DEPTH_FAIL: + case GL_STENCIL_PASS_DEPTH_PASS: + case GL_STENCIL_BACK_FUNC: + case GL_STENCIL_BACK_VALUE_MASK: + case GL_STENCIL_BACK_REF: + case GL_STENCIL_BACK_FAIL: + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + case GL_DEPTH_FUNC: + case GL_BLEND_SRC_RGB: + case GL_BLEND_SRC_ALPHA: + case GL_BLEND_DST_RGB: + case GL_BLEND_DST_ALPHA: + case GL_BLEND_EQUATION_RGB: + case GL_BLEND_EQUATION_ALPHA: + case GL_STENCIL_WRITEMASK: + case GL_STENCIL_BACK_WRITEMASK: + case GL_STENCIL_CLEAR_VALUE: + case GL_SUBPIXEL_BITS: + case GL_MAX_TEXTURE_SIZE: + case GL_MAX_CUBE_MAP_TEXTURE_SIZE: + case GL_SAMPLE_BUFFERS: + case GL_SAMPLES: + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + case GL_TEXTURE_BINDING_2D: + case GL_TEXTURE_BINDING_CUBE_MAP: + case GL_RESET_NOTIFICATION_STRATEGY_EXT: + { + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_PACK_REVERSE_ROW_ORDER_ANGLE: + { + if (!getExtensions().packReverseRowOrder) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE: + case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: + { + if (!getExtensions().textureRectangle) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_MAX_DRAW_BUFFERS_EXT: + case GL_MAX_COLOR_ATTACHMENTS_EXT: + { + if ((getClientMajorVersion() < 3) && !getExtensions().drawBuffers) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_MAX_VIEWPORT_DIMS: + { + *type = GL_INT; + *numParams = 2; + return true; + } + case GL_VIEWPORT: + case GL_SCISSOR_BOX: + { + *type = GL_INT; + *numParams = 4; + return true; + } + case GL_SHADER_COMPILER: + case GL_SAMPLE_COVERAGE_INVERT: + case GL_DEPTH_WRITEMASK: + case GL_CULL_FACE: // CULL_FACE through DITHER are natural to IsEnabled, + case GL_POLYGON_OFFSET_FILL: // but can be retrieved through the Get{Type}v queries. + case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as + // bool-natural + case GL_SAMPLE_COVERAGE: + case GL_SCISSOR_TEST: + case GL_STENCIL_TEST: + case GL_DEPTH_TEST: + case GL_BLEND: + case GL_DITHER: + case GL_CONTEXT_ROBUST_ACCESS_EXT: + { + *type = GL_BOOL; + *numParams = 1; + return true; + } + case GL_COLOR_WRITEMASK: + { + *type = GL_BOOL; + *numParams = 4; + return true; + } + case GL_POLYGON_OFFSET_FACTOR: + case GL_POLYGON_OFFSET_UNITS: + case GL_SAMPLE_COVERAGE_VALUE: + case GL_DEPTH_CLEAR_VALUE: + case GL_LINE_WIDTH: + { + *type = GL_FLOAT; + *numParams = 1; + return true; + } + case GL_ALIASED_LINE_WIDTH_RANGE: + case GL_ALIASED_POINT_SIZE_RANGE: + case GL_DEPTH_RANGE: + { + *type = GL_FLOAT; + *numParams = 2; + return true; + } + case GL_COLOR_CLEAR_VALUE: + case GL_BLEND_COLOR: + { + *type = GL_FLOAT; + *numParams = 4; + return true; + } + case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: + if (!getExtensions().textureFilterAnisotropic) + { + return false; + } + *type = GL_FLOAT; + *numParams = 1; + return true; + case GL_TIMESTAMP_EXT: + if (!getExtensions().disjointTimerQuery) + { + return false; + } + *type = GL_INT_64_ANGLEX; + *numParams = 1; + return true; + case GL_GPU_DISJOINT_EXT: + if (!getExtensions().disjointTimerQuery) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_COVERAGE_MODULATION_CHROMIUM: + if (!getExtensions().framebufferMixedSamples) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_TEXTURE_BINDING_EXTERNAL_OES: + if (!getExtensions().eglStreamConsumerExternal && !getExtensions().eglImageExternal) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + + if (getExtensions().debug) + { + switch (pname) + { + case GL_DEBUG_LOGGED_MESSAGES: + case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: + case GL_DEBUG_GROUP_STACK_DEPTH: + case GL_MAX_DEBUG_MESSAGE_LENGTH: + case GL_MAX_DEBUG_LOGGED_MESSAGES: + case GL_MAX_DEBUG_GROUP_STACK_DEPTH: + case GL_MAX_LABEL_LENGTH: + *type = GL_INT; + *numParams = 1; + return true; + + case GL_DEBUG_OUTPUT_SYNCHRONOUS: + case GL_DEBUG_OUTPUT: + *type = GL_BOOL; + *numParams = 1; + return true; + } + } + + if (getExtensions().multisampleCompatibility) + { + switch (pname) + { + case GL_MULTISAMPLE_EXT: + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + *type = GL_BOOL; + *numParams = 1; + return true; + } + } + + if (getExtensions().pathRendering) + { + switch (pname) + { + case GL_PATH_MODELVIEW_MATRIX_CHROMIUM: + case GL_PATH_PROJECTION_MATRIX_CHROMIUM: + *type = GL_FLOAT; + *numParams = 16; + return true; + } + } + + if (getExtensions().bindGeneratesResource) + { + switch (pname) + { + case GL_BIND_GENERATES_RESOURCE_CHROMIUM: + *type = GL_BOOL; + *numParams = 1; + return true; + } + } + + if (getExtensions().clientArrays) + { + switch (pname) + { + case GL_CLIENT_ARRAYS_ANGLE: + *type = GL_BOOL; + *numParams = 1; + return true; + } + } + + if (getExtensions().sRGBWriteControl) + { + switch (pname) + { + case GL_FRAMEBUFFER_SRGB_EXT: + *type = GL_BOOL; + *numParams = 1; + return true; + } + } + + if (getExtensions().robustResourceInitialization && + pname == GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE) + { + *type = GL_BOOL; + *numParams = 1; + return true; + } + + if (getExtensions().programCacheControl && pname == GL_PROGRAM_CACHE_ENABLED_ANGLE) + { + *type = GL_BOOL; + *numParams = 1; + return true; + } + + // Check for ES3.0+ parameter names which are also exposed as ES2 extensions + switch (pname) + { + // case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE // equivalent to FRAMEBUFFER_BINDING + case GL_READ_FRAMEBUFFER_BINDING_ANGLE: + if ((getClientMajorVersion() < 3) && !getExtensions().framebufferBlit) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + + case GL_NUM_PROGRAM_BINARY_FORMATS_OES: + if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + + case GL_PROGRAM_BINARY_FORMATS_OES: + if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary) + { + return false; + } + *type = GL_INT; + *numParams = static_cast(getCaps().programBinaryFormats.size()); + return true; + + case GL_PACK_ROW_LENGTH: + case GL_PACK_SKIP_ROWS: + case GL_PACK_SKIP_PIXELS: + if ((getClientMajorVersion() < 3) && !getExtensions().packSubimage) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_UNPACK_ROW_LENGTH: + case GL_UNPACK_SKIP_ROWS: + case GL_UNPACK_SKIP_PIXELS: + if ((getClientMajorVersion() < 3) && !getExtensions().unpackSubimage) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_VERTEX_ARRAY_BINDING: + if ((getClientMajorVersion() < 3) && !getExtensions().vertexArrayObject) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_PIXEL_PACK_BUFFER_BINDING: + case GL_PIXEL_UNPACK_BUFFER_BINDING: + if ((getClientMajorVersion() < 3) && !getExtensions().pixelBufferObject) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + case GL_MAX_SAMPLES: + { + static_assert(GL_MAX_SAMPLES_ANGLE == GL_MAX_SAMPLES, + "GL_MAX_SAMPLES_ANGLE not equal to GL_MAX_SAMPLES"); + if ((getClientMajorVersion() < 3) && !getExtensions().framebufferMultisample) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: + if ((getClientMajorVersion() < 3) && !getExtensions().standardDerivatives) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + } + + if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT) + { + if ((getClientVersion() < Version(3, 0)) && !getExtensions().drawBuffers) + { + return false; + } + *type = GL_INT; + *numParams = 1; + return true; + } + + if (getExtensions().multiview && pname == GL_MAX_VIEWS_ANGLE) + { + *type = GL_INT; + *numParams = 1; + return true; + } + + if (getClientVersion() < Version(2, 0)) + { + switch (pname) + { + case GL_ALPHA_TEST_FUNC: + case GL_CLIENT_ACTIVE_TEXTURE: + case GL_MATRIX_MODE: + case GL_MAX_TEXTURE_UNITS: + case GL_MAX_MODELVIEW_STACK_DEPTH: + case GL_MAX_PROJECTION_STACK_DEPTH: + case GL_MAX_TEXTURE_STACK_DEPTH: + *type = GL_INT; + *numParams = 1; + return true; + case GL_ALPHA_TEST_REF: + *type = GL_FLOAT; + *numParams = 1; + return true; + case GL_CURRENT_COLOR: + case GL_CURRENT_TEXTURE_COORDS: + *type = GL_FLOAT; + *numParams = 4; + return true; + case GL_CURRENT_NORMAL: + *type = GL_FLOAT; + *numParams = 3; + return true; + case GL_MODELVIEW_MATRIX: + case GL_PROJECTION_MATRIX: + case GL_TEXTURE_MATRIX: + *type = GL_FLOAT; + *numParams = 16; + return true; + } + } + + if (getClientVersion() < Version(3, 0)) + { + return false; + } + + // Check for ES3.0+ parameter names + switch (pname) + { + case GL_MAX_UNIFORM_BUFFER_BINDINGS: + case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: + case GL_UNIFORM_BUFFER_BINDING: + case GL_TRANSFORM_FEEDBACK_BINDING: + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + case GL_COPY_READ_BUFFER_BINDING: + case GL_COPY_WRITE_BUFFER_BINDING: + case GL_SAMPLER_BINDING: + case GL_READ_BUFFER: + case GL_TEXTURE_BINDING_3D: + case GL_TEXTURE_BINDING_2D_ARRAY: + case GL_MAX_3D_TEXTURE_SIZE: + case GL_MAX_ARRAY_TEXTURE_LAYERS: + case GL_MAX_VERTEX_UNIFORM_BLOCKS: + case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: + case GL_MAX_COMBINED_UNIFORM_BLOCKS: + case GL_MAX_VERTEX_OUTPUT_COMPONENTS: + case GL_MAX_FRAGMENT_INPUT_COMPONENTS: + case GL_MAX_VARYING_COMPONENTS: + case GL_MAX_VERTEX_UNIFORM_COMPONENTS: + case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: + case GL_MIN_PROGRAM_TEXEL_OFFSET: + case GL_MAX_PROGRAM_TEXEL_OFFSET: + case GL_NUM_EXTENSIONS: + case GL_MAJOR_VERSION: + case GL_MINOR_VERSION: + case GL_MAX_ELEMENTS_INDICES: + case GL_MAX_ELEMENTS_VERTICES: + case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: + case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: + case GL_UNPACK_IMAGE_HEIGHT: + case GL_UNPACK_SKIP_IMAGES: + { + *type = GL_INT; + *numParams = 1; + return true; + } + + case GL_MAX_ELEMENT_INDEX: + case GL_MAX_UNIFORM_BLOCK_SIZE: + case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: + case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: + case GL_MAX_SERVER_WAIT_TIMEOUT: + { + *type = GL_INT_64_ANGLEX; + *numParams = 1; + return true; + } + + case GL_TRANSFORM_FEEDBACK_ACTIVE: + case GL_TRANSFORM_FEEDBACK_PAUSED: + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + case GL_RASTERIZER_DISCARD: + { + *type = GL_BOOL; + *numParams = 1; + return true; + } + + case GL_MAX_TEXTURE_LOD_BIAS: + { + *type = GL_FLOAT; + *numParams = 1; + return true; + } + } + + if (getExtensions().requestExtension) + { + switch (pname) + { + case GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE: + *type = GL_INT; + *numParams = 1; + return true; + } + } + + if (getClientVersion() < Version(3, 1)) + { + return false; + } + + switch (pname) + { + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + case GL_DRAW_INDIRECT_BUFFER_BINDING: + case GL_DISPATCH_INDIRECT_BUFFER_BINDING: + case GL_MAX_FRAMEBUFFER_WIDTH: + case GL_MAX_FRAMEBUFFER_HEIGHT: + case GL_MAX_FRAMEBUFFER_SAMPLES: + case GL_MAX_SAMPLE_MASK_WORDS: + case GL_MAX_COLOR_TEXTURE_SAMPLES: + case GL_MAX_DEPTH_TEXTURE_SAMPLES: + case GL_MAX_INTEGER_SAMPLES: + case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET: + case GL_MAX_VERTEX_ATTRIB_BINDINGS: + case GL_MAX_VERTEX_ATTRIB_STRIDE: + case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS: + case GL_MAX_VERTEX_ATOMIC_COUNTERS: + case GL_MAX_VERTEX_IMAGE_UNIFORMS: + case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS: + case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS: + case GL_MAX_FRAGMENT_ATOMIC_COUNTERS: + case GL_MAX_FRAGMENT_IMAGE_UNIFORMS: + case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS: + case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET: + case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET: + case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS: + case GL_MAX_COMPUTE_UNIFORM_BLOCKS: + case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS: + case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE: + case GL_MAX_COMPUTE_UNIFORM_COMPONENTS: + case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS: + case GL_MAX_COMPUTE_ATOMIC_COUNTERS: + case GL_MAX_COMPUTE_IMAGE_UNIFORMS: + case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS: + case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS: + case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES: + case GL_MAX_UNIFORM_LOCATIONS: + case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS: + case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE: + case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS: + case GL_MAX_COMBINED_ATOMIC_COUNTERS: + case GL_MAX_IMAGE_UNITS: + case GL_MAX_COMBINED_IMAGE_UNIFORMS: + case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS: + case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS: + case GL_SHADER_STORAGE_BUFFER_BINDING: + case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT: + case GL_TEXTURE_BINDING_2D_MULTISAMPLE: + *type = GL_INT; + *numParams = 1; + return true; + case GL_MAX_SHADER_STORAGE_BLOCK_SIZE: + *type = GL_INT_64_ANGLEX; + *numParams = 1; + return true; + case GL_SAMPLE_MASK: + *type = GL_BOOL; + *numParams = 1; + return true; + } + + if (getExtensions().geometryShader) + { + switch (pname) + { + case GL_MAX_FRAMEBUFFER_LAYERS_EXT: + case GL_LAYER_PROVOKING_VERTEX_EXT: + case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT: + case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT: + case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT: + case GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT: + case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT: + case GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT: + case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT: + case GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT: + case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT: + case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT: + case GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT: + case GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT: + case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT: + *type = GL_INT; + *numParams = 1; + return true; + } + } + + return false; +} + +bool Context::getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams) +{ + if (getClientVersion() < Version(3, 0)) + { + return false; + } + + switch (target) + { + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + case GL_UNIFORM_BUFFER_BINDING: + { + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + case GL_UNIFORM_BUFFER_START: + case GL_UNIFORM_BUFFER_SIZE: + { + *type = GL_INT_64_ANGLEX; + *numParams = 1; + return true; + } + } + + if (getClientVersion() < Version(3, 1)) + { + return false; + } + + switch (target) + { + case GL_IMAGE_BINDING_LAYERED: + { + *type = GL_BOOL; + *numParams = 1; + return true; + } + case GL_MAX_COMPUTE_WORK_GROUP_COUNT: + case GL_MAX_COMPUTE_WORK_GROUP_SIZE: + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + case GL_SHADER_STORAGE_BUFFER_BINDING: + case GL_VERTEX_BINDING_BUFFER: + case GL_VERTEX_BINDING_DIVISOR: + case GL_VERTEX_BINDING_OFFSET: + case GL_VERTEX_BINDING_STRIDE: + case GL_SAMPLE_MASK_VALUE: + case GL_IMAGE_BINDING_NAME: + case GL_IMAGE_BINDING_LEVEL: + case GL_IMAGE_BINDING_LAYER: + case GL_IMAGE_BINDING_ACCESS: + case GL_IMAGE_BINDING_FORMAT: + { + *type = GL_INT; + *numParams = 1; + return true; + } + case GL_ATOMIC_COUNTER_BUFFER_START: + case GL_ATOMIC_COUNTER_BUFFER_SIZE: + case GL_SHADER_STORAGE_BUFFER_START: + case GL_SHADER_STORAGE_BUFFER_SIZE: + { + *type = GL_INT_64_ANGLEX; + *numParams = 1; + return true; + } + } + + return false; +} + +Program *Context::getProgram(GLuint handle) const +{ + return mState.mShaderPrograms->getProgram(handle); } -void Context::drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) +Shader *Context::getShader(GLuint handle) const { - UNIMPLEMENTED(); + return mState.mShaderPrograms->getShader(handle); } -void Context::drawTexxv(const GLfixed *coords) +bool Context::isTextureGenerated(GLuint texture) const { - UNIMPLEMENTED(); + return mState.mTextures->isHandleGenerated(texture); } -void Context::currentPaletteMatrix(GLuint matrixpaletteindex) +bool Context::isBufferGenerated(GLuint buffer) const { - UNIMPLEMENTED(); + return mState.mBuffers->isHandleGenerated(buffer); } -void Context::loadPaletteFromModelViewMatrix() +bool Context::isRenderbufferGenerated(GLuint renderbuffer) const { - UNIMPLEMENTED(); + return mState.mRenderbuffers->isHandleGenerated(renderbuffer); } -void Context::matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) +bool Context::isFramebufferGenerated(GLuint framebuffer) const { - UNIMPLEMENTED(); + return mState.mFramebuffers->isHandleGenerated(framebuffer); } -void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) +bool Context::isProgramPipelineGenerated(GLuint pipeline) const { - UNIMPLEMENTED(); + return mState.mPipelines->isHandleGenerated(pipeline); } -void Context::pointSizePointer(GLenum type, GLsizei stride, const void *pointer) +bool Context::usingDisplayTextureShareGroup() const { - UNIMPLEMENTED(); + return mDisplayTextureShareGroup; } -GLbitfield Context::queryMatrixx(GLfixed *mantissa, GLint *exponent) +GLenum Context::getConvertedRenderbufferFormat(GLenum internalformat) const { - UNIMPLEMENTED(); - return 0; + return mState.mExtensions.webglCompatibility && mState.mClientVersion.major == 2 && + internalformat == GL_DEPTH_STENCIL + ? GL_DEPTH24_STENCIL8 + : internalformat; } } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/Context.h b/gfx/angle/checkout/src/libANGLE/Context.h index adb564e3f75b..e011652bce1e 100644 --- a/gfx/angle/checkout/src/libANGLE/Context.h +++ b/gfx/angle/checkout/src/libANGLE/Context.h @@ -19,6 +19,7 @@ #include "libANGLE/Caps.h" #include "libANGLE/Constants.h" #include "libANGLE/ContextState.h" +#include "libANGLE/Context_gles_1_0_autogen.h" #include "libANGLE/Error.h" #include "libANGLE/HandleAllocator.h" #include "libANGLE/PackedGLEnums.h" @@ -61,7 +62,7 @@ class VertexArray; struct VertexAttribute; class ProgramPipeline; -class Context final : public ValidationContext +class Context final : angle::NonCopyable { public: Context(rx::EGLImplFactory *implFactory, @@ -73,7 +74,7 @@ class Context final : public ValidationContext const egl::DisplayExtensions &displayExtensions); egl::Error onDestroy(const egl::Display *display); - ~Context() override; + ~Context(); egl::Error makeCurrent(egl::Display *display, egl::Surface *surface); egl::Error releaseSurface(const egl::Display *display); @@ -81,13 +82,13 @@ class Context final : public ValidationContext // These create and destroy methods are merely pass-throughs to // ResourceManager, which owns these object types GLuint createBuffer(); - GLuint createShader(GLenum type); + GLuint createShader(ShaderType type); GLuint createProgram(); GLuint createTexture(); GLuint createRenderbuffer(); - GLuint createPaths(GLsizei range); + GLuint genPaths(GLsizei range); GLuint createProgramPipeline(); - GLuint createShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings); + GLuint createShaderProgramv(ShaderType type, GLsizei count, const GLchar *const *strings); void deleteBuffer(GLuint buffer); void deleteShader(GLuint shader); @@ -98,19 +99,19 @@ class Context final : public ValidationContext void deleteProgramPipeline(GLuint pipeline); // CHROMIUM_path_rendering - bool hasPathData(GLuint path) const; - bool hasPath(GLuint path) const; - void setPathCommands(GLuint path, - GLsizei numCommands, - const GLubyte *commands, - GLsizei numCoords, - GLenum coordType, - const void *coords); + bool isPath(GLuint path) const; + bool isPathGenerated(GLuint path) const; + void pathCommands(GLuint path, + GLsizei numCommands, + const GLubyte *commands, + GLsizei numCoords, + GLenum coordType, + const void *coords); void pathParameterf(GLuint path, GLenum pname, GLfloat value); void pathParameteri(GLuint path, GLenum pname, GLint value); void getPathParameterfv(GLuint path, GLenum pname, GLfloat *value); void getPathParameteriv(GLuint path, GLenum pname, GLint *value); - void setPathStencilFunc(GLenum func, GLint ref, GLuint mask); + void pathStencilFunc(GLenum func, GLint ref, GLuint mask); // Framebuffers are owned by the Context, so these methods do not pass through GLuint createFramebuffer(); @@ -125,119 +126,11 @@ class Context final : public ValidationContext void setFenceNV(GLuint fence, GLenum condition); GLboolean testFenceNV(GLuint fence); - // OpenGL ES 1 - void alphaFunc(GLenum func, GLfloat ref); - void alphaFuncx(GLenum func, GLfixed ref); - void clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); - void clearDepthx(GLfixed depth); - void clientActiveTexture(GLenum texture); - void clipPlanef(GLenum p, const GLfloat *eqn); - void clipPlanex(GLenum plane, const GLfixed *equation); - void color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); - void color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); - void color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); - void colorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); - void cullFace(GLenum mode); - void depthRangex(GLfixed n, GLfixed f); - void disableClientState(GLenum array); - void enableClientState(GLenum array); - void fogf(GLenum pname, GLfloat param); - void fogfv(GLenum pname, const GLfloat *params); - void fogx(GLenum pname, GLfixed param); - void fogxv(GLenum pname, const GLfixed *param); - void frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); - void frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); - void getBufferParameteriv(GLenum target, GLenum pname, GLint *params); - void getClipPlanef(GLenum plane, GLfloat *equation); - void getClipPlanex(GLenum plane, GLfixed *equation); - void getFixedv(GLenum pname, GLfixed *params); - void getLightfv(GLenum light, GLenum pname, GLfloat *params); - void getLightxv(GLenum light, GLenum pname, GLfixed *params); - void getMaterialfv(GLenum face, GLenum pname, GLfloat *params); - void getMaterialxv(GLenum face, GLenum pname, GLfixed *params); - void getTexEnvfv(GLenum target, GLenum pname, GLfloat *params); - void getTexEnviv(GLenum target, GLenum pname, GLint *params); - void getTexEnvxv(GLenum target, GLenum pname, GLfixed *params); - void getTexParameterxv(GLenum target, GLenum pname, GLfixed *params); - void lightModelf(GLenum pname, GLfloat param); - void lightModelfv(GLenum pname, const GLfloat *params); - void lightModelx(GLenum pname, GLfixed param); - void lightModelxv(GLenum pname, const GLfixed *param); - void lightf(GLenum light, GLenum pname, GLfloat param); - void lightfv(GLenum light, GLenum pname, const GLfloat *params); - void lightx(GLenum light, GLenum pname, GLfixed param); - void lightxv(GLenum light, GLenum pname, const GLfixed *params); - void lineWidthx(GLfixed width); - void loadIdentity(); - void loadMatrixf(const GLfloat *m); - void loadMatrixx(const GLfixed *m); - void logicOp(GLenum opcode); - void materialf(GLenum face, GLenum pname, GLfloat param); - void materialfv(GLenum face, GLenum pname, const GLfloat *params); - void materialx(GLenum face, GLenum pname, GLfixed param); - void materialxv(GLenum face, GLenum pname, const GLfixed *param); - void matrixMode(GLenum mode); - void multMatrixf(const GLfloat *m); - void multMatrixx(const GLfixed *m); - void multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); - void multiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); - void normal3f(GLfloat nx, GLfloat ny, GLfloat nz); - void normal3x(GLfixed nx, GLfixed ny, GLfixed nz); - void normalPointer(GLenum type, GLsizei stride, const void *pointer); - void orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); - void orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); - void pointParameterf(GLenum pname, GLfloat param); - void pointParameterfv(GLenum pname, const GLfloat *params); - void pointParameterx(GLenum pname, GLfixed param); - void pointParameterxv(GLenum pname, const GLfixed *params); - void pointSize(GLfloat size); - void pointSizex(GLfixed size); - void polygonOffsetx(GLfixed factor, GLfixed units); - void popMatrix(); - void pushMatrix(); - void rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); - void rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); - void sampleCoveragex(GLclampx value, GLboolean invert); - void scalef(GLfloat x, GLfloat y, GLfloat z); - void scalex(GLfixed x, GLfixed y, GLfixed z); - void shadeModel(GLenum mode); - void texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); - void texEnvf(GLenum target, GLenum pname, GLfloat param); - void texEnvfv(GLenum target, GLenum pname, const GLfloat *params); - void texEnvi(GLenum target, GLenum pname, GLint param); - void texEnviv(GLenum target, GLenum pname, const GLint *params); - void texEnvx(GLenum target, GLenum pname, GLfixed param); - void texEnvxv(GLenum target, GLenum pname, const GLfixed *params); - void texParameterx(GLenum target, GLenum pname, GLfixed param); - void texParameterxv(GLenum target, GLenum pname, const GLfixed *params); - void translatef(GLfloat x, GLfloat y, GLfloat z); - void translatex(GLfixed x, GLfixed y, GLfixed z); - void vertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); - - // GL_OES_draw_texture - void drawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); - void drawTexfv(const GLfloat *coords); - void drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); - void drawTexiv(const GLint *coords); - void drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); - void drawTexsv(const GLshort *coords); - void drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); - void drawTexxv(const GLfixed *coords); - - // GL_OES_matrix_palette - void currentPaletteMatrix(GLuint matrixpaletteindex); - void loadPaletteFromModelViewMatrix(); - void matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); - void weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); - - // GL_OES_point_size_array - void pointSizePointer(GLenum type, GLsizei stride, const void *pointer); - - // GL_OES_query_matrix - GLbitfield queryMatrixx(GLfixed *mantissa, GLint *exponent); + // GLES1 emulation: Interface to entry points + ANGLE_GLES1_CONTEXT_API // OpenGL ES 2+ - void bindTexture(GLenum target, GLuint handle); + void bindTexture(TextureType target, GLuint handle); void bindReadFramebuffer(GLuint framebufferHandle); void bindDrawFramebuffer(GLuint framebufferHandle); void bindVertexArray(GLuint vertexArrayHandle); @@ -262,37 +155,164 @@ class Context final : public ValidationContext void endQuery(GLenum target); void queryCounter(GLuint id, GLenum target); void getQueryiv(GLenum target, GLenum pname, GLint *params); + void getQueryivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getQueryObjectiv(GLuint id, GLenum pname, GLint *params); + void getQueryObjectivRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getQueryObjectuiv(GLuint id, GLenum pname, GLuint *params); + void getQueryObjectuivRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); void getQueryObjecti64v(GLuint id, GLenum pname, GLint64 *params); + void getQueryObjecti64vRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params); void getQueryObjectui64v(GLuint id, GLenum pname, GLuint64 *params); + void getQueryObjectui64vRobust(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint64 *params); void vertexAttribDivisor(GLuint index, GLuint divisor); void vertexBindingDivisor(GLuint bindingIndex, GLuint divisor); void getBufferParameteriv(BufferBinding target, GLenum pname, GLint *params); + void getBufferParameterivRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params); + void getFramebufferAttachmentParameterivRobust(GLenum target, + GLenum attachment, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getRenderbufferParameteriv(GLenum target, GLenum pname, GLint *params); + void getRenderbufferParameterivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); - void getTexParameterfv(GLenum target, GLenum pname, GLfloat *params); - void getTexParameteriv(GLenum target, GLenum pname, GLint *params); - void getTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params); - void getTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params); - void texParameterf(GLenum target, GLenum pname, GLfloat param); - void texParameterfv(GLenum target, GLenum pname, const GLfloat *params); - void texParameteri(GLenum target, GLenum pname, GLint param); - void texParameteriv(GLenum target, GLenum pname, const GLint *params); + void getTexParameterfv(TextureType target, GLenum pname, GLfloat *params); + void getTexParameterfvRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); + void getTexParameteriv(TextureType target, GLenum pname, GLint *params); + void getTexParameterivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getTexParameterIivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getTexParameterIuivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); + void getTexLevelParameteriv(TextureTarget target, GLint level, GLenum pname, GLint *params); + void getTexLevelParameterivRobust(TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getTexLevelParameterfv(TextureTarget target, GLint level, GLenum pname, GLfloat *params); + void getTexLevelParameterfvRobust(TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); + void texParameterf(TextureType target, GLenum pname, GLfloat param); + void texParameterfv(TextureType target, GLenum pname, const GLfloat *params); + void texParameterfvRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLfloat *params); + void texParameteri(TextureType target, GLenum pname, GLint param); + void texParameteriv(TextureType target, GLenum pname, const GLint *params); + void texParameterivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params); + void texParameterIivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params); + void texParameterIuivRobust(TextureType target, + GLenum pname, + GLsizei bufSize, + const GLuint *params); void samplerParameteri(GLuint sampler, GLenum pname, GLint param); void samplerParameteriv(GLuint sampler, GLenum pname, const GLint *param); + void samplerParameterivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param); + void samplerParameterIivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param); + void samplerParameterIuivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param); void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param); void samplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param); + void samplerParameterfvRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLfloat *param); void getSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params); + void getSamplerParameterivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getSamplerParameterIivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getSamplerParameterIuivRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); void getSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params); + void getSamplerParameterfvRobust(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); void programParameteri(GLuint program, GLenum pname, GLint value); @@ -317,6 +337,12 @@ class Context final : public ValidationContext GLenum programInterface, GLenum pname, GLint *params); + void getProgramInterfaceivRobust(GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); Buffer *getBuffer(GLuint handle) const; FenceNV *getFenceNV(GLuint handle); @@ -340,8 +366,8 @@ class Context final : public ValidationContext GLchar *label) const; void getObjectPtrLabel(const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label) const; - Texture *getTargetTexture(GLenum target) const; - Texture *getSamplerTexture(unsigned int sampler, GLenum type) const; + Texture *getTargetTexture(TextureType type) const; + Texture *getSamplerTexture(unsigned int sampler, TextureType type) const; Compiler *getCompiler() const; @@ -351,16 +377,38 @@ class Context final : public ValidationContext bool isTransformFeedbackGenerated(GLuint vertexArray); void getBooleanv(GLenum pname, GLboolean *params); + void getBooleanvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLboolean *params); void getBooleanvImpl(GLenum pname, GLboolean *params); void getFloatv(GLenum pname, GLfloat *params); + void getFloatvRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params); void getFloatvImpl(GLenum pname, GLfloat *params); void getIntegerv(GLenum pname, GLint *params); + void getIntegervRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint *data); void getIntegervImpl(GLenum pname, GLint *params); void getInteger64vImpl(GLenum pname, GLint64 *params); void getPointerv(GLenum pname, void **params) const; + void getPointervRobustANGLERobust(GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params); void getBooleani_v(GLenum target, GLuint index, GLboolean *data); + void getBooleani_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLboolean *data); void getIntegeri_v(GLenum target, GLuint index, GLint *data); + void getIntegeri_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint *data); void getInteger64i_v(GLenum target, GLuint index, GLint64 *data); + void getInteger64i_vRobust(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint64 *data); void activeShaderProgram(GLuint pipeline, GLuint program); void activeTexture(GLenum texture); @@ -425,10 +473,35 @@ class Context final : public ValidationContext void vertexAttribI4iv(GLuint index, const GLint *v); void vertexAttribI4uiv(GLuint index, const GLuint *v); void getVertexAttribiv(GLuint index, GLenum pname, GLint *params); + void getVertexAttribivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); + void getVertexAttribfvRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); void getVertexAttribIiv(GLuint index, GLenum pname, GLint *params); + void getVertexAttribIivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params); + void getVertexAttribIuivRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); void getVertexAttribPointerv(GLuint index, GLenum pname, void **pointer); + void getVertexAttribPointervRobust(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **pointer); void debugMessageControl(GLenum source, GLenum type, @@ -496,8 +569,30 @@ class Context final : public ValidationContext GLenum format, GLenum type, void *pixels); + void readPixelsRobust(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + GLsizei *columns, + GLsizei *rows, + void *pixels); + void readnPixelsRobust(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + GLsizei *columns, + GLsizei *rows, + void *data); - void copyTexImage2D(GLenum target, + void copyTexImage2D(TextureTarget target, GLint level, GLenum internalformat, GLint x, @@ -506,7 +601,7 @@ class Context final : public ValidationContext GLsizei height, GLint border); - void copyTexSubImage2D(GLenum target, + void copyTexSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -515,7 +610,7 @@ class Context final : public ValidationContext GLsizei width, GLsizei height); - void copyTexSubImage3D(GLenum target, + void copyTexSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -527,7 +622,7 @@ class Context final : public ValidationContext void framebufferTexture2D(GLenum target, GLenum attachment, - GLenum textarget, + TextureTarget textarget, GLuint texture, GLint level); @@ -541,18 +636,18 @@ class Context final : public ValidationContext GLuint texture, GLint level, GLint layer); - void framebufferTextureMultiviewLayeredANGLE(GLenum target, - GLenum attachment, - GLuint texture, - GLint level, - GLint baseViewIndex, - GLsizei numViews); - void framebufferTextureMultiviewSideBySideANGLE(GLenum target, - GLenum attachment, - GLuint texture, - GLint level, - GLsizei numViews, - const GLint *viewportOffsets); + void framebufferTextureMultiviewLayered(GLenum target, + GLenum attachment, + GLuint texture, + GLint level, + GLint baseViewIndex, + GLsizei numViews); + void framebufferTextureMultiviewSideBySide(GLenum target, + GLenum attachment, + GLuint texture, + GLint level, + GLsizei numViews, + const GLint *viewportOffsets); void drawBuffers(GLsizei n, const GLenum *bufs); void readBuffer(GLenum mode); @@ -567,7 +662,7 @@ class Context final : public ValidationContext GLsizei width, GLsizei height); - void texImage2D(GLenum target, + void texImage2D(TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -576,7 +671,17 @@ class Context final : public ValidationContext GLenum format, GLenum type, const void *pixels); - void texImage3D(GLenum target, + void texImage2DRobust(TextureTarget target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); + void texImage3D(TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -586,7 +691,18 @@ class Context final : public ValidationContext GLenum format, GLenum type, const void *pixels); - void texSubImage2D(GLenum target, + void texImage3DRobust(TextureType target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); + void texSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -595,7 +711,17 @@ class Context final : public ValidationContext GLenum format, GLenum type, const void *pixels); - void texSubImage3D(GLenum target, + void texSubImage2DRobust(TextureTarget target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); + void texSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -606,7 +732,19 @@ class Context final : public ValidationContext GLenum format, GLenum type, const void *pixels); - void compressedTexImage2D(GLenum target, + void texSubImage3DRobust(TextureType target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); + void compressedTexImage2D(TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -614,7 +752,16 @@ class Context final : public ValidationContext GLint border, GLsizei imageSize, const void *data); - void compressedTexImage3D(GLenum target, + void compressedTexImage2DRobust(TextureTarget target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data); + void compressedTexImage3D(TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -623,7 +770,17 @@ class Context final : public ValidationContext GLint border, GLsizei imageSize, const void *data); - void compressedTexSubImage2D(GLenum target, + void compressedTexImage3DRobust(TextureType target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data); + void compressedTexSubImage2D(TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -632,7 +789,17 @@ class Context final : public ValidationContext GLenum format, GLsizei imageSize, const void *data); - void compressedTexSubImage3D(GLenum target, + void compressedTexSubImage2DRobust(TextureTarget target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data); + void compressedTexSubImage3D(TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -643,9 +810,21 @@ class Context final : public ValidationContext GLenum format, GLsizei imageSize, const void *data); + void compressedTexSubImage3DRobust(TextureType target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLsizei imageSize, + GLsizei dataSize, + const GLvoid *data); void copyTexture(GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint internalFormat, @@ -655,7 +834,7 @@ class Context final : public ValidationContext GLboolean unpackUnmultiplyAlpha); void copySubTexture(GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint xoffset, @@ -669,12 +848,17 @@ class Context final : public ValidationContext GLboolean unpackUnmultiplyAlpha); void compressedCopyTexture(GLuint sourceId, GLuint destId); - void generateMipmap(GLenum target); + void generateMipmap(TextureType target); void flush(); void finish(); void getBufferPointerv(BufferBinding target, GLenum pname, void **params); + void getBufferPointervRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params); void *mapBuffer(BufferBinding target, GLenum access); GLboolean unmapBuffer(BufferBinding target); void *mapBufferRange(BufferBinding target, @@ -702,11 +886,11 @@ class Context final : public ValidationContext void getSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); // CHROMIUM_framebuffer_mixed_samples - void setCoverageModulation(GLenum components); + void coverageModulation(GLenum components); // CHROMIUM_path_rendering - void loadPathRenderingMatrix(GLenum matrixMode, const GLfloat *matrix); - void loadPathRenderingIdentityMatrix(GLenum matrixMode); + void matrixLoadf(GLenum matrixMode, const GLfloat *matrix); + void matrixLoadIdentity(GLenum matrixMode); void stencilFillPath(GLuint path, GLenum fillMode, GLuint mask); void stencilStrokePath(GLuint path, GLint reference, GLuint mask); void coverFillPath(GLuint path, GLenum coverMode); @@ -782,7 +966,7 @@ class Context final : public ValidationContext void bindFramebuffer(GLenum target, GLuint framebuffer); void bindRenderbuffer(GLenum target, GLuint renderbuffer); - void texStorage2DMultisample(GLenum target, + void texStorage2DMultisample(TextureType target, GLsizei samples, GLenum internalformat, GLsizei width, @@ -790,6 +974,11 @@ class Context final : public ValidationContext GLboolean fixedsamplelocations); void getMultisamplefv(GLenum pname, GLuint index, GLfloat *val); + void getMultisamplefvRobust(GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val); void copyBufferSubData(BufferBinding readTarget, BufferBinding writeTarget, @@ -825,6 +1014,11 @@ class Context final : public ValidationContext void getAttachedShaders(GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders); GLint getAttribLocation(GLuint program, const GLchar *name); void getProgramiv(GLuint program, GLenum pname, GLint *params); + void getProgramivRobust(GLuint program, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params); void getProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog); void getProgramPipelineInfoLog(GLuint pipeline, @@ -832,6 +1026,12 @@ class Context final : public ValidationContext GLsizei *length, GLchar *infoLog); void getShaderiv(GLuint shader, GLenum pname, GLint *params); + void getShaderivRobust(GLuint shader, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog); void getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, @@ -839,7 +1039,17 @@ class Context final : public ValidationContext GLint *precision); void getShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); void getUniformfv(GLuint program, GLint location, GLfloat *params); + void getUniformfvRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); void getUniformiv(GLuint program, GLint location, GLint *params); + void getUniformivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params); GLint getUniformLocation(GLuint program, const GLchar *name); GLboolean isBuffer(GLuint buffer); GLboolean isEnabled(GLenum cap); @@ -953,6 +1163,11 @@ class Context final : public ValidationContext void programBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); void getUniformuiv(GLuint program, GLint location, GLuint *params); + void getUniformuivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params); GLint getFragDataLocation(GLuint program, const GLchar *name); void getUniformIndices(GLuint program, GLsizei uniformCount, @@ -968,6 +1183,12 @@ class Context final : public ValidationContext GLuint uniformBlockIndex, GLenum pname, GLint *params); + void getActiveUniformBlockivRobust(GLuint program, + GLuint uniformBlockIndex, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void getActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, @@ -981,8 +1202,14 @@ class Context final : public ValidationContext GLenum clientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); void waitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); void getInteger64v(GLenum pname, GLint64 *params); + void getInteger64vRobust(GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *data); void getBufferParameteri64v(BufferBinding target, GLenum pname, GLint64 *params); + void getBufferParameteri64vRobust(BufferBinding target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params); void genSamplers(GLsizei count, GLuint *samplers); void deleteSamplers(GLsizei count, const GLuint *samplers); void getInternalformativ(GLenum target, @@ -990,6 +1217,12 @@ class Context final : public ValidationContext GLenum pname, GLsizei bufSize, GLint *params); + void getInternalformativRobust(GLenum target, + GLenum internalformat, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void programUniform1i(GLuint program, GLint location, GLint v0); void programUniform2i(GLuint program, GLint location, GLint v0, GLint v1); @@ -1086,7 +1319,22 @@ class Context final : public ValidationContext void getTranslatedShaderSource(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); void getnUniformfv(GLuint program, GLint location, GLsizei bufSize, GLfloat *params); + void getnUniformfvRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); void getnUniformiv(GLuint program, GLint location, GLsizei bufSize, GLint *params); + void getnUniformivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params); + void getnUniformuivRobust(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params); void readnPixels(GLint x, GLint y, GLsizei width, @@ -1095,22 +1343,27 @@ class Context final : public ValidationContext GLenum type, GLsizei bufSize, void *data); - void eGLImageTargetTexture2D(GLenum target, GLeglImageOES image); + void eGLImageTargetTexture2D(TextureType target, GLeglImageOES image); void eGLImageTargetRenderbufferStorage(GLenum target, GLeglImageOES image); void getFramebufferParameteriv(GLenum target, GLenum pname, GLint *params); + void getFramebufferParameterivRobust(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); void framebufferParameteri(GLenum target, GLenum pname, GLint param); void dispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ); void dispatchComputeIndirect(GLintptr indirect); void texStorage1D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); - void texStorage2D(GLenum target, + void texStorage2D(TextureType target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height); - void texStorage3D(GLenum target, + void texStorage3D(TextureType target, GLsizei levels, GLenum internalFormat, GLsizei width, @@ -1121,7 +1374,7 @@ class Context final : public ValidationContext void memoryBarrierByRegion(GLbitfield barriers); // Consumes the error. - void handleError(const Error &error) override; + void handleError(const Error &error); GLenum getError(); void markContextLost(); @@ -1164,18 +1417,64 @@ class Context final : public ValidationContext bool isRobustResourceInitEnabled() const { return mGLState.isRobustResourceInitEnabled(); } + bool isCurrentTransformFeedback(const TransformFeedback *tf) const; + bool isCurrentVertexArray(const VertexArray *va) const; + + const ContextState &getContextState() const { return mState; } + GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); } + GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); } + const Version &getClientVersion() const { return mState.getClientVersion(); } + const State &getGLState() const { return mState.getState(); } + const Caps &getCaps() const { return mState.getCaps(); } + const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); } + const Extensions &getExtensions() const { return mState.getExtensions(); } + const Limitations &getLimitations() const { return mState.getLimitations(); } + bool skipValidation() const { return mSkipValidation; } + + // Specific methods needed for validation. + bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams); + bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams); + + Program *getProgram(GLuint handle) const; + Shader *getShader(GLuint handle) const; + + bool isTextureGenerated(GLuint texture) const; + bool isBufferGenerated(GLuint buffer) const; + bool isRenderbufferGenerated(GLuint renderbuffer) const; + bool isFramebufferGenerated(GLuint framebuffer) const; + bool isProgramPipelineGenerated(GLuint pipeline) const; + + bool usingDisplayTextureShareGroup() const; + + // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format. + GLenum getConvertedRenderbufferFormat(GLenum internalformat) const; + + bool isWebGL() const { return mState.isWebGL(); } + bool isWebGL1() const { return mState.isWebGL1(); } + + template + const T &getParams() const; + + bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; } + private: Error prepareForDraw(); - void syncRendererState(); - void syncRendererState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask); - void syncStateForReadPixels(); - void syncStateForTexImage(); - void syncStateForClear(); - void syncStateForBlit(); + Error prepareForClear(GLbitfield mask); + Error prepareForClearBuffer(GLenum buffer, GLint drawbuffer); + Error syncState(); + Error syncState(const State::DirtyBits &bitMask, const State::DirtyObjects &objectMask); + Error syncDirtyBits(); + Error syncDirtyBits(const State::DirtyBits &bitMask); + Error syncDirtyObjects(); + Error syncDirtyObjects(const State::DirtyObjects &objectMask); + Error syncStateForReadPixels(); + Error syncStateForTexImage(); + Error syncStateForBlit(); + VertexArray *checkVertexArrayAllocation(GLuint vertexArrayHandle); TransformFeedback *checkTransformFeedbackAllocation(GLuint transformFeedback); - void detachBuffer(GLuint buffer); + void detachBuffer(Buffer *buffer); void detachTexture(GLuint texture); void detachFramebuffer(GLuint framebuffer); void detachRenderbuffer(GLuint renderbuffer); @@ -1195,6 +1494,18 @@ class Context final : public ValidationContext LabeledObject *getLabeledObject(GLenum identifier, GLuint name) const; LabeledObject *getLabeledObjectFromPtr(const void *ptr) const; + ContextState mState; + bool mSkipValidation; + bool mDisplayTextureShareGroup; + + // Stores for each buffer binding type whether is it allowed to be used in this context. + angle::PackedEnumBitSet mValidBufferBindings; + + // Caches entry point parameters and values re-used between layers. + mutable const ParamTypeInfo *mSavedArgsType; + static constexpr size_t kParamsBufferSize = 128u; + mutable std::array mParamsBuffer; + std::unique_ptr mImplementation; // Caps to use for validation @@ -1248,6 +1559,7 @@ class Context final : public ValidationContext egl::Display *mCurrentDisplay; Framebuffer *mSurfacelessFramebuffer; bool mWebGLContext; + bool mExtensionsEnabled; MemoryProgramCache *mMemoryProgramCache; State::DirtyBits mTexImageDirtyBits; @@ -1268,6 +1580,14 @@ class Context final : public ValidationContext mutable angle::ScratchBuffer mZeroFilledBuffer; }; +template +const T &Context::getParams() const +{ + const T *params = reinterpret_cast(mParamsBuffer.data()); + ASSERT(mSavedArgsType->hasDynamicType(T::TypeInfo)); + return *params; +} + template ANGLE_INLINE void Context::gatherParams(ArgsT &&... args) { diff --git a/gfx/angle/checkout/src/libANGLE/ContextState.cpp b/gfx/angle/checkout/src/libANGLE/ContextState.cpp index e9367507d3a0..edf95263b50c 100644 --- a/gfx/angle/checkout/src/libANGLE/ContextState.cpp +++ b/gfx/angle/checkout/src/libANGLE/ContextState.cpp @@ -113,764 +113,4 @@ const TextureCaps &ContextState::getTextureCap(GLenum internalFormat) const return mTextureCaps.get(internalFormat); } -ValidationContext::ValidationContext(const ValidationContext *shareContext, - TextureManager *shareTextures, - const Version &clientVersion, - State *state, - const Caps &caps, - const TextureCapsMap &textureCaps, - const Extensions &extensions, - const Limitations &limitations, - bool skipValidation) - : mState(reinterpret_cast(this), - shareContext ? &shareContext->mState : nullptr, - shareTextures, - clientVersion, - state, - caps, - textureCaps, - extensions, - limitations), - mSkipValidation(skipValidation), - mDisplayTextureShareGroup(shareTextures != nullptr) -{ -} - -ValidationContext::~ValidationContext() -{ -} - -bool ValidationContext::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) -{ - // Please note: the query type returned for DEPTH_CLEAR_VALUE in this implementation - // is FLOAT rather than INT, as would be suggested by the GL ES 2.0 spec. This is due - // to the fact that it is stored internally as a float, and so would require conversion - // if returned from Context::getIntegerv. Since this conversion is already implemented - // in the case that one calls glGetIntegerv to retrieve a float-typed state variable, we - // place DEPTH_CLEAR_VALUE with the floats. This should make no difference to the calling - // application. - switch (pname) - { - case GL_COMPRESSED_TEXTURE_FORMATS: - { - *type = GL_INT; - *numParams = static_cast(getCaps().compressedTextureFormats.size()); - return true; - } - case GL_SHADER_BINARY_FORMATS: - { - *type = GL_INT; - *numParams = static_cast(getCaps().shaderBinaryFormats.size()); - return true; - } - - case GL_MAX_VERTEX_ATTRIBS: - case GL_MAX_VERTEX_UNIFORM_VECTORS: - case GL_MAX_VARYING_VECTORS: - case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: - case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: - case GL_MAX_TEXTURE_IMAGE_UNITS: - case GL_MAX_FRAGMENT_UNIFORM_VECTORS: - case GL_MAX_RENDERBUFFER_SIZE: - case GL_NUM_SHADER_BINARY_FORMATS: - case GL_NUM_COMPRESSED_TEXTURE_FORMATS: - case GL_ARRAY_BUFFER_BINDING: - case GL_FRAMEBUFFER_BINDING: - case GL_RENDERBUFFER_BINDING: - case GL_CURRENT_PROGRAM: - case GL_PACK_ALIGNMENT: - case GL_UNPACK_ALIGNMENT: - case GL_GENERATE_MIPMAP_HINT: - case GL_RED_BITS: - case GL_GREEN_BITS: - case GL_BLUE_BITS: - case GL_ALPHA_BITS: - case GL_DEPTH_BITS: - case GL_STENCIL_BITS: - case GL_ELEMENT_ARRAY_BUFFER_BINDING: - case GL_CULL_FACE_MODE: - case GL_FRONT_FACE: - case GL_ACTIVE_TEXTURE: - case GL_STENCIL_FUNC: - case GL_STENCIL_VALUE_MASK: - case GL_STENCIL_REF: - case GL_STENCIL_FAIL: - case GL_STENCIL_PASS_DEPTH_FAIL: - case GL_STENCIL_PASS_DEPTH_PASS: - case GL_STENCIL_BACK_FUNC: - case GL_STENCIL_BACK_VALUE_MASK: - case GL_STENCIL_BACK_REF: - case GL_STENCIL_BACK_FAIL: - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: - case GL_STENCIL_BACK_PASS_DEPTH_PASS: - case GL_DEPTH_FUNC: - case GL_BLEND_SRC_RGB: - case GL_BLEND_SRC_ALPHA: - case GL_BLEND_DST_RGB: - case GL_BLEND_DST_ALPHA: - case GL_BLEND_EQUATION_RGB: - case GL_BLEND_EQUATION_ALPHA: - case GL_STENCIL_WRITEMASK: - case GL_STENCIL_BACK_WRITEMASK: - case GL_STENCIL_CLEAR_VALUE: - case GL_SUBPIXEL_BITS: - case GL_MAX_TEXTURE_SIZE: - case GL_MAX_CUBE_MAP_TEXTURE_SIZE: - case GL_SAMPLE_BUFFERS: - case GL_SAMPLES: - case GL_IMPLEMENTATION_COLOR_READ_TYPE: - case GL_IMPLEMENTATION_COLOR_READ_FORMAT: - case GL_TEXTURE_BINDING_2D: - case GL_TEXTURE_BINDING_CUBE_MAP: - case GL_RESET_NOTIFICATION_STRATEGY_EXT: - { - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_PACK_REVERSE_ROW_ORDER_ANGLE: - { - if (!getExtensions().packReverseRowOrder) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_MAX_RECTANGLE_TEXTURE_SIZE_ANGLE: - case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: - { - if (!getExtensions().textureRectangle) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_MAX_DRAW_BUFFERS_EXT: - case GL_MAX_COLOR_ATTACHMENTS_EXT: - { - if ((getClientMajorVersion() < 3) && !getExtensions().drawBuffers) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_MAX_VIEWPORT_DIMS: - { - *type = GL_INT; - *numParams = 2; - return true; - } - case GL_VIEWPORT: - case GL_SCISSOR_BOX: - { - *type = GL_INT; - *numParams = 4; - return true; - } - case GL_SHADER_COMPILER: - case GL_SAMPLE_COVERAGE_INVERT: - case GL_DEPTH_WRITEMASK: - case GL_CULL_FACE: // CULL_FACE through DITHER are natural to IsEnabled, - case GL_POLYGON_OFFSET_FILL: // but can be retrieved through the Get{Type}v queries. - case GL_SAMPLE_ALPHA_TO_COVERAGE: // For this purpose, they are treated here as - // bool-natural - case GL_SAMPLE_COVERAGE: - case GL_SCISSOR_TEST: - case GL_STENCIL_TEST: - case GL_DEPTH_TEST: - case GL_BLEND: - case GL_DITHER: - case GL_CONTEXT_ROBUST_ACCESS_EXT: - { - *type = GL_BOOL; - *numParams = 1; - return true; - } - case GL_COLOR_WRITEMASK: - { - *type = GL_BOOL; - *numParams = 4; - return true; - } - case GL_POLYGON_OFFSET_FACTOR: - case GL_POLYGON_OFFSET_UNITS: - case GL_SAMPLE_COVERAGE_VALUE: - case GL_DEPTH_CLEAR_VALUE: - case GL_LINE_WIDTH: - { - *type = GL_FLOAT; - *numParams = 1; - return true; - } - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_ALIASED_POINT_SIZE_RANGE: - case GL_DEPTH_RANGE: - { - *type = GL_FLOAT; - *numParams = 2; - return true; - } - case GL_COLOR_CLEAR_VALUE: - case GL_BLEND_COLOR: - { - *type = GL_FLOAT; - *numParams = 4; - return true; - } - case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: - if (!getExtensions().textureFilterAnisotropic) - { - return false; - } - *type = GL_FLOAT; - *numParams = 1; - return true; - case GL_TIMESTAMP_EXT: - if (!getExtensions().disjointTimerQuery) - { - return false; - } - *type = GL_INT_64_ANGLEX; - *numParams = 1; - return true; - case GL_GPU_DISJOINT_EXT: - if (!getExtensions().disjointTimerQuery) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_COVERAGE_MODULATION_CHROMIUM: - if (!getExtensions().framebufferMixedSamples) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_TEXTURE_BINDING_EXTERNAL_OES: - if (!getExtensions().eglStreamConsumerExternal && !getExtensions().eglImageExternal) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - - if (getExtensions().debug) - { - switch (pname) - { - case GL_DEBUG_LOGGED_MESSAGES: - case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: - case GL_DEBUG_GROUP_STACK_DEPTH: - case GL_MAX_DEBUG_MESSAGE_LENGTH: - case GL_MAX_DEBUG_LOGGED_MESSAGES: - case GL_MAX_DEBUG_GROUP_STACK_DEPTH: - case GL_MAX_LABEL_LENGTH: - *type = GL_INT; - *numParams = 1; - return true; - - case GL_DEBUG_OUTPUT_SYNCHRONOUS: - case GL_DEBUG_OUTPUT: - *type = GL_BOOL; - *numParams = 1; - return true; - } - } - - if (getExtensions().multisampleCompatibility) - { - switch (pname) - { - case GL_MULTISAMPLE_EXT: - case GL_SAMPLE_ALPHA_TO_ONE_EXT: - *type = GL_BOOL; - *numParams = 1; - return true; - } - } - - if (getExtensions().pathRendering) - { - switch (pname) - { - case GL_PATH_MODELVIEW_MATRIX_CHROMIUM: - case GL_PATH_PROJECTION_MATRIX_CHROMIUM: - *type = GL_FLOAT; - *numParams = 16; - return true; - } - } - - if (getExtensions().bindGeneratesResource) - { - switch (pname) - { - case GL_BIND_GENERATES_RESOURCE_CHROMIUM: - *type = GL_BOOL; - *numParams = 1; - return true; - } - } - - if (getExtensions().clientArrays) - { - switch (pname) - { - case GL_CLIENT_ARRAYS_ANGLE: - *type = GL_BOOL; - *numParams = 1; - return true; - } - } - - if (getExtensions().sRGBWriteControl) - { - switch (pname) - { - case GL_FRAMEBUFFER_SRGB_EXT: - *type = GL_BOOL; - *numParams = 1; - return true; - } - } - - if (getExtensions().robustResourceInitialization && - pname == GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE) - { - *type = GL_BOOL; - *numParams = 1; - return true; - } - - if (getExtensions().programCacheControl && pname == GL_PROGRAM_CACHE_ENABLED_ANGLE) - { - *type = GL_BOOL; - *numParams = 1; - return true; - } - - // Check for ES3.0+ parameter names which are also exposed as ES2 extensions - switch (pname) - { - // case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE // equivalent to FRAMEBUFFER_BINDING - case GL_READ_FRAMEBUFFER_BINDING_ANGLE: - if ((getClientMajorVersion() < 3) && !getExtensions().framebufferBlit) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - - case GL_NUM_PROGRAM_BINARY_FORMATS_OES: - if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - - case GL_PROGRAM_BINARY_FORMATS_OES: - if ((getClientMajorVersion() < 3) && !getExtensions().getProgramBinary) - { - return false; - } - *type = GL_INT; - *numParams = static_cast(getCaps().programBinaryFormats.size()); - return true; - - case GL_PACK_ROW_LENGTH: - case GL_PACK_SKIP_ROWS: - case GL_PACK_SKIP_PIXELS: - if ((getClientMajorVersion() < 3) && !getExtensions().packSubimage) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_UNPACK_ROW_LENGTH: - case GL_UNPACK_SKIP_ROWS: - case GL_UNPACK_SKIP_PIXELS: - if ((getClientMajorVersion() < 3) && !getExtensions().unpackSubimage) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_VERTEX_ARRAY_BINDING: - if ((getClientMajorVersion() < 3) && !getExtensions().vertexArrayObject) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_PIXEL_PACK_BUFFER_BINDING: - case GL_PIXEL_UNPACK_BUFFER_BINDING: - if ((getClientMajorVersion() < 3) && !getExtensions().pixelBufferObject) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - case GL_MAX_SAMPLES: - { - static_assert(GL_MAX_SAMPLES_ANGLE == GL_MAX_SAMPLES, - "GL_MAX_SAMPLES_ANGLE not equal to GL_MAX_SAMPLES"); - if ((getClientMajorVersion() < 3) && !getExtensions().framebufferMultisample) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT: - if ((getClientMajorVersion() < 3) && !getExtensions().standardDerivatives) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - } - - if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT) - { - if ((getClientVersion() < Version(3, 0)) && !getExtensions().drawBuffers) - { - return false; - } - *type = GL_INT; - *numParams = 1; - return true; - } - - if (getExtensions().multiview && pname == GL_MAX_VIEWS_ANGLE) - { - *type = GL_INT; - *numParams = 1; - return true; - } - - if (getClientVersion() < Version(3, 0)) - { - return false; - } - - // Check for ES3.0+ parameter names - switch (pname) - { - case GL_MAX_UNIFORM_BUFFER_BINDINGS: - case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT: - case GL_UNIFORM_BUFFER_BINDING: - case GL_TRANSFORM_FEEDBACK_BINDING: - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - case GL_COPY_READ_BUFFER_BINDING: - case GL_COPY_WRITE_BUFFER_BINDING: - case GL_SAMPLER_BINDING: - case GL_READ_BUFFER: - case GL_TEXTURE_BINDING_3D: - case GL_TEXTURE_BINDING_2D_ARRAY: - case GL_MAX_3D_TEXTURE_SIZE: - case GL_MAX_ARRAY_TEXTURE_LAYERS: - case GL_MAX_VERTEX_UNIFORM_BLOCKS: - case GL_MAX_FRAGMENT_UNIFORM_BLOCKS: - case GL_MAX_COMBINED_UNIFORM_BLOCKS: - case GL_MAX_VERTEX_OUTPUT_COMPONENTS: - case GL_MAX_FRAGMENT_INPUT_COMPONENTS: - case GL_MAX_VARYING_COMPONENTS: - case GL_MAX_VERTEX_UNIFORM_COMPONENTS: - case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS: - case GL_MIN_PROGRAM_TEXEL_OFFSET: - case GL_MAX_PROGRAM_TEXEL_OFFSET: - case GL_NUM_EXTENSIONS: - case GL_MAJOR_VERSION: - case GL_MINOR_VERSION: - case GL_MAX_ELEMENTS_INDICES: - case GL_MAX_ELEMENTS_VERTICES: - case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: - case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: - case GL_UNPACK_IMAGE_HEIGHT: - case GL_UNPACK_SKIP_IMAGES: - { - *type = GL_INT; - *numParams = 1; - return true; - } - - case GL_MAX_ELEMENT_INDEX: - case GL_MAX_UNIFORM_BLOCK_SIZE: - case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: - case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: - case GL_MAX_SERVER_WAIT_TIMEOUT: - { - *type = GL_INT_64_ANGLEX; - *numParams = 1; - return true; - } - - case GL_TRANSFORM_FEEDBACK_ACTIVE: - case GL_TRANSFORM_FEEDBACK_PAUSED: - case GL_PRIMITIVE_RESTART_FIXED_INDEX: - case GL_RASTERIZER_DISCARD: - { - *type = GL_BOOL; - *numParams = 1; - return true; - } - - case GL_MAX_TEXTURE_LOD_BIAS: - { - *type = GL_FLOAT; - *numParams = 1; - return true; - } - } - - if (getExtensions().requestExtension) - { - switch (pname) - { - case GL_NUM_REQUESTABLE_EXTENSIONS_ANGLE: - *type = GL_INT; - *numParams = 1; - return true; - } - } - - if (getClientVersion() < Version(3, 1)) - { - return false; - } - - switch (pname) - { - case GL_ATOMIC_COUNTER_BUFFER_BINDING: - case GL_DRAW_INDIRECT_BUFFER_BINDING: - case GL_DISPATCH_INDIRECT_BUFFER_BINDING: - case GL_MAX_FRAMEBUFFER_WIDTH: - case GL_MAX_FRAMEBUFFER_HEIGHT: - case GL_MAX_FRAMEBUFFER_SAMPLES: - case GL_MAX_SAMPLE_MASK_WORDS: - case GL_MAX_COLOR_TEXTURE_SAMPLES: - case GL_MAX_DEPTH_TEXTURE_SAMPLES: - case GL_MAX_INTEGER_SAMPLES: - case GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET: - case GL_MAX_VERTEX_ATTRIB_BINDINGS: - case GL_MAX_VERTEX_ATTRIB_STRIDE: - case GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS: - case GL_MAX_VERTEX_ATOMIC_COUNTERS: - case GL_MAX_VERTEX_IMAGE_UNIFORMS: - case GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS: - case GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS: - case GL_MAX_FRAGMENT_ATOMIC_COUNTERS: - case GL_MAX_FRAGMENT_IMAGE_UNIFORMS: - case GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS: - case GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET: - case GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET: - case GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS: - case GL_MAX_COMPUTE_UNIFORM_BLOCKS: - case GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS: - case GL_MAX_COMPUTE_SHARED_MEMORY_SIZE: - case GL_MAX_COMPUTE_UNIFORM_COMPONENTS: - case GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS: - case GL_MAX_COMPUTE_ATOMIC_COUNTERS: - case GL_MAX_COMPUTE_IMAGE_UNIFORMS: - case GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS: - case GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS: - case GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES: - case GL_MAX_UNIFORM_LOCATIONS: - case GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS: - case GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE: - case GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS: - case GL_MAX_COMBINED_ATOMIC_COUNTERS: - case GL_MAX_IMAGE_UNITS: - case GL_MAX_COMBINED_IMAGE_UNIFORMS: - case GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS: - case GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS: - case GL_SHADER_STORAGE_BUFFER_BINDING: - case GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT: - case GL_TEXTURE_BINDING_2D_MULTISAMPLE: - *type = GL_INT; - *numParams = 1; - return true; - case GL_MAX_SHADER_STORAGE_BLOCK_SIZE: - *type = GL_INT_64_ANGLEX; - *numParams = 1; - return true; - case GL_SAMPLE_MASK: - *type = GL_BOOL; - *numParams = 1; - return true; - } - - if (getExtensions().geometryShader) - { - switch (pname) - { - case GL_MAX_FRAMEBUFFER_LAYERS_EXT: - case GL_LAYER_PROVOKING_VERTEX_EXT: - case GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT: - case GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT: - case GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT: - case GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT: - case GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT: - case GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT: - case GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT: - case GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT: - case GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT: - case GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT: - case GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT: - case GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT: - case GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT: - *type = GL_INT; - *numParams = 1; - return true; - } - } - - return false; -} - -bool ValidationContext::getIndexedQueryParameterInfo(GLenum target, - GLenum *type, - unsigned int *numParams) -{ - if (getClientVersion() < Version(3, 0)) - { - return false; - } - - switch (target) - { - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - case GL_UNIFORM_BUFFER_BINDING: - { - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_TRANSFORM_FEEDBACK_BUFFER_START: - case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: - case GL_UNIFORM_BUFFER_START: - case GL_UNIFORM_BUFFER_SIZE: - { - *type = GL_INT_64_ANGLEX; - *numParams = 1; - return true; - } - } - - if (getClientVersion() < Version(3, 1)) - { - return false; - } - - switch (target) - { - case GL_IMAGE_BINDING_LAYERED: - { - *type = GL_BOOL; - *numParams = 1; - return true; - } - case GL_MAX_COMPUTE_WORK_GROUP_COUNT: - case GL_MAX_COMPUTE_WORK_GROUP_SIZE: - case GL_ATOMIC_COUNTER_BUFFER_BINDING: - case GL_SHADER_STORAGE_BUFFER_BINDING: - case GL_VERTEX_BINDING_BUFFER: - case GL_VERTEX_BINDING_DIVISOR: - case GL_VERTEX_BINDING_OFFSET: - case GL_VERTEX_BINDING_STRIDE: - case GL_SAMPLE_MASK_VALUE: - case GL_IMAGE_BINDING_NAME: - case GL_IMAGE_BINDING_LEVEL: - case GL_IMAGE_BINDING_LAYER: - case GL_IMAGE_BINDING_ACCESS: - case GL_IMAGE_BINDING_FORMAT: - { - *type = GL_INT; - *numParams = 1; - return true; - } - case GL_ATOMIC_COUNTER_BUFFER_START: - case GL_ATOMIC_COUNTER_BUFFER_SIZE: - case GL_SHADER_STORAGE_BUFFER_START: - case GL_SHADER_STORAGE_BUFFER_SIZE: - { - *type = GL_INT_64_ANGLEX; - *numParams = 1; - return true; - } - } - - return false; -} - -Program *ValidationContext::getProgram(GLuint handle) const -{ - return mState.mShaderPrograms->getProgram(handle); -} - -Shader *ValidationContext::getShader(GLuint handle) const -{ - return mState.mShaderPrograms->getShader(handle); -} - -bool ValidationContext::isTextureGenerated(GLuint texture) const -{ - return mState.mTextures->isHandleGenerated(texture); -} - -bool ValidationContext::isBufferGenerated(GLuint buffer) const -{ - return mState.mBuffers->isHandleGenerated(buffer); -} - -bool ValidationContext::isRenderbufferGenerated(GLuint renderbuffer) const -{ - return mState.mRenderbuffers->isHandleGenerated(renderbuffer); -} - -bool ValidationContext::isFramebufferGenerated(GLuint framebuffer) const -{ - return mState.mFramebuffers->isHandleGenerated(framebuffer); -} - -bool ValidationContext::isProgramPipelineGenerated(GLuint pipeline) const -{ - return mState.mPipelines->isHandleGenerated(pipeline); -} - -bool ValidationContext::usingDisplayTextureShareGroup() const -{ - return mDisplayTextureShareGroup; -} - -GLenum ValidationContext::getConvertedRenderbufferFormat(GLenum internalformat) const -{ - return mState.mExtensions.webglCompatibility && mState.mClientVersion.major == 2 && - internalformat == GL_DEPTH_STENCIL - ? GL_DEPTH24_STENCIL8 - : internalformat; -} - } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/ContextState.h b/gfx/angle/checkout/src/libANGLE/ContextState.h index 86fbd058d336..1f2dacd75751 100644 --- a/gfx/angle/checkout/src/libANGLE/ContextState.h +++ b/gfx/angle/checkout/src/libANGLE/ContextState.h @@ -27,7 +27,6 @@ class SamplerManager; class ShaderProgramManager; class SyncManager; class TextureManager; -class ValidationContext; static constexpr Version ES_2_0 = Version(2, 0); static constexpr Version ES_3_0 = Version(3, 0); @@ -61,14 +60,11 @@ class ContextState final : angle::NonCopyable const TextureCaps &getTextureCap(GLenum internalFormat) const; - bool usingDisplayTextureShareGroup() const; - bool isWebGL() const; bool isWebGL1() const; private: friend class Context; - friend class ValidationContext; Version mClientVersion; ContextID mContext; @@ -89,81 +85,6 @@ class ContextState final : angle::NonCopyable ProgramPipelineManager *mPipelines; }; -class ValidationContext : angle::NonCopyable -{ - public: - ValidationContext(const ValidationContext *shareContext, - TextureManager *shareTextures, - const Version &clientVersion, - State *state, - const Caps &caps, - const TextureCapsMap &textureCaps, - const Extensions &extensions, - const Limitations &limitations, - bool skipValidation); - virtual ~ValidationContext(); - - virtual void handleError(const Error &error) = 0; - - const ContextState &getContextState() const { return mState; } - GLint getClientMajorVersion() const { return mState.getClientMajorVersion(); } - GLint getClientMinorVersion() const { return mState.getClientMinorVersion(); } - const Version &getClientVersion() const { return mState.getClientVersion(); } - const State &getGLState() const { return mState.getState(); } - const Caps &getCaps() const { return mState.getCaps(); } - const TextureCapsMap &getTextureCaps() const { return mState.getTextureCaps(); } - const Extensions &getExtensions() const { return mState.getExtensions(); } - const Limitations &getLimitations() const { return mState.getLimitations(); } - bool skipValidation() const { return mSkipValidation; } - - // Specific methods needed for validation. - bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams); - bool getIndexedQueryParameterInfo(GLenum target, GLenum *type, unsigned int *numParams); - - Program *getProgram(GLuint handle) const; - Shader *getShader(GLuint handle) const; - - bool isTextureGenerated(GLuint texture) const; - bool isBufferGenerated(GLuint buffer) const; - bool isRenderbufferGenerated(GLuint renderbuffer) const; - bool isFramebufferGenerated(GLuint framebuffer) const; - bool isProgramPipelineGenerated(GLuint pipeline) const; - - bool usingDisplayTextureShareGroup() const; - - // Hack for the special WebGL 1 "DEPTH_STENCIL" internal format. - GLenum getConvertedRenderbufferFormat(GLenum internalformat) const; - - bool isWebGL() const { return mState.isWebGL(); } - bool isWebGL1() const { return mState.isWebGL1(); } - - template - const T &getParams() const; - - bool isValidBufferBinding(BufferBinding binding) const { return mValidBufferBindings[binding]; } - - protected: - ContextState mState; - bool mSkipValidation; - bool mDisplayTextureShareGroup; - - // Stores for each buffer binding type whether is it allowed to be used in this context. - angle::PackedEnumBitSet mValidBufferBindings; - - // Caches entry point parameters and values re-used between layers. - mutable const ParamTypeInfo *mSavedArgsType; - static constexpr size_t kParamsBufferSize = 64u; - mutable std::array mParamsBuffer; -}; - -template -const T &ValidationContext::getParams() const -{ - const T *params = reinterpret_cast(mParamsBuffer.data()); - ASSERT(mSavedArgsType->hasDynamicType(T::TypeInfo)); - return *params; -} - } // namespace gl #endif // LIBANGLE_CONTEXTSTATE_H_ diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp new file mode 100644 index 000000000000..970d8cd293bf --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0.cpp @@ -0,0 +1,599 @@ +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// Context_gles_1_0.cpp: Implements the GLES1-specific parts of Context. + +#include "libANGLE/Context.h" + +#include "common/mathutil.h" +#include "common/utilities.h" + +namespace +{ + +angle::Mat4 FixedMatrixToMat4(const GLfixed *m) +{ + angle::Mat4 matrixAsFloat; + GLfloat *floatData = matrixAsFloat.data(); + + for (int i = 0; i < 16; i++) + { + floatData[i] = gl::FixedToFloat(m[i]); + } + + return matrixAsFloat; +} + +} // namespace + +namespace gl +{ + +void Context::alphaFunc(AlphaTestFunc func, GLfloat ref) +{ + mGLState.gles1().setAlphaFunc(func, ref); +} + +void Context::alphaFuncx(AlphaTestFunc func, GLfixed ref) +{ + mGLState.gles1().setAlphaFunc(func, FixedToFloat(ref)); +} + +void Context::clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) +{ + UNIMPLEMENTED(); +} + +void Context::clearDepthx(GLfixed depth) +{ + UNIMPLEMENTED(); +} + +void Context::clientActiveTexture(GLenum texture) +{ + mGLState.gles1().setClientTextureUnit(texture - GL_TEXTURE0); +} + +void Context::clipPlanef(GLenum p, const GLfloat *eqn) +{ + UNIMPLEMENTED(); +} + +void Context::clipPlanex(GLenum plane, const GLfixed *equation) +{ + UNIMPLEMENTED(); +} + +void Context::color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + mGLState.gles1().setCurrentColor({red, green, blue, alpha}); +} + +void Context::color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) +{ + mGLState.gles1().setCurrentColor( + {normalizedToFloat(red), normalizedToFloat(green), + normalizedToFloat(blue), normalizedToFloat(alpha)}); +} + +void Context::color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) +{ + mGLState.gles1().setCurrentColor( + {FixedToFloat(red), FixedToFloat(green), FixedToFloat(blue), FixedToFloat(alpha)}); +} + +void Context::colorPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) +{ + UNIMPLEMENTED(); +} + +void Context::depthRangex(GLfixed n, GLfixed f) +{ + UNIMPLEMENTED(); +} + +void Context::disableClientState(GLenum clientState) +{ + UNIMPLEMENTED(); +} + +void Context::enableClientState(GLenum clientState) +{ + UNIMPLEMENTED(); +} + +void Context::fogf(GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::fogfv(GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::fogx(GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::fogxv(GLenum pname, const GLfixed *param) +{ + UNIMPLEMENTED(); +} + +void Context::frustumf(GLfloat left, + GLfloat right, + GLfloat bottom, + GLfloat top, + GLfloat zNear, + GLfloat zFar) +{ + UNIMPLEMENTED(); +} + +void Context::frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) +{ + UNIMPLEMENTED(); +} + +void Context::getClipPlanef(GLenum plane, GLfloat *equation) +{ + UNIMPLEMENTED(); +} + +void Context::getClipPlanex(GLenum plane, GLfixed *equation) +{ + UNIMPLEMENTED(); +} + +void Context::getFixedv(GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::getLightfv(GLenum light, GLenum pname, GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::getLightxv(GLenum light, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::getMaterialfv(GLenum face, GLenum pname, GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::getMaterialxv(GLenum face, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexEnvfv(GLenum env, GLenum pname, GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexEnviv(GLenum env, GLenum pname, GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexEnvxv(GLenum target, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexParameterxv(TextureType target, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::lightModelf(GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::lightModelfv(GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::lightModelx(GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::lightModelxv(GLenum pname, const GLfixed *param) +{ + UNIMPLEMENTED(); +} + +void Context::lightf(GLenum light, GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::lightfv(GLenum light, GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::lightx(GLenum light, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::lightxv(GLenum light, GLenum pname, const GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::lineWidthx(GLfixed width) +{ + UNIMPLEMENTED(); +} + +void Context::loadIdentity() +{ + mGLState.gles1().loadMatrix(angle::Mat4()); +} + +void Context::loadMatrixf(const GLfloat *m) +{ + mGLState.gles1().loadMatrix(angle::Mat4(m)); +} + +void Context::loadMatrixx(const GLfixed *m) +{ + mGLState.gles1().loadMatrix(FixedMatrixToMat4(m)); +} + +void Context::logicOp(GLenum opcode) +{ + UNIMPLEMENTED(); +} + +void Context::materialf(GLenum face, GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::materialfv(GLenum face, GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::materialx(GLenum face, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::materialxv(GLenum face, GLenum pname, const GLfixed *param) +{ + UNIMPLEMENTED(); +} + +void Context::matrixMode(MatrixType mode) +{ + mGLState.gles1().setMatrixMode(mode); +} + +void Context::multMatrixf(const GLfloat *m) +{ + mGLState.gles1().multMatrix(angle::Mat4(m)); +} + +void Context::multMatrixx(const GLfixed *m) +{ + mGLState.gles1().multMatrix(FixedMatrixToMat4(m)); +} + +void Context::multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) +{ + unsigned int unit = target - GL_TEXTURE0; + ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits); + mGLState.gles1().setCurrentTextureCoords(unit, {s, t, r, q}); +} + +void Context::multiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) +{ + unsigned int unit = target - GL_TEXTURE0; + ASSERT(target >= GL_TEXTURE0 && unit < getCaps().maxMultitextureUnits); + mGLState.gles1().setCurrentTextureCoords( + unit, {FixedToFloat(s), FixedToFloat(t), FixedToFloat(r), FixedToFloat(q)}); +} + +void Context::normal3f(GLfloat nx, GLfloat ny, GLfloat nz) +{ + mGLState.gles1().setCurrentNormal({nx, ny, nz}); +} + +void Context::normal3x(GLfixed nx, GLfixed ny, GLfixed nz) +{ + mGLState.gles1().setCurrentNormal({FixedToFloat(nx), FixedToFloat(ny), FixedToFloat(nz)}); +} + +void Context::normalPointer(GLenum type, GLsizei stride, const void *ptr) +{ + UNIMPLEMENTED(); +} + +void Context::orthof(GLfloat left, + GLfloat right, + GLfloat bottom, + GLfloat top, + GLfloat zNear, + GLfloat zFar) +{ + UNIMPLEMENTED(); +} + +void Context::orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) +{ + UNIMPLEMENTED(); +} + +void Context::pointParameterf(GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::pointParameterfv(GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::pointParameterx(GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::pointParameterxv(GLenum pname, const GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::pointSize(GLfloat size) +{ + UNIMPLEMENTED(); +} + +void Context::pointSizex(GLfixed size) +{ + UNIMPLEMENTED(); +} + +void Context::polygonOffsetx(GLfixed factor, GLfixed units) +{ + UNIMPLEMENTED(); +} + +void Context::popMatrix() +{ + mGLState.gles1().popMatrix(); +} + +void Context::pushMatrix() +{ + mGLState.gles1().pushMatrix(); +} + +void Context::rotatef(float angle, float x, float y, float z) +{ + UNIMPLEMENTED(); +} + +void Context::rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) +{ + UNIMPLEMENTED(); +} + +void Context::sampleCoveragex(GLclampx value, GLboolean invert) +{ + UNIMPLEMENTED(); +} + +void Context::scalef(float x, float y, float z) +{ + UNIMPLEMENTED(); +} + +void Context::scalex(GLfixed x, GLfixed y, GLfixed z) +{ + UNIMPLEMENTED(); +} + +void Context::shadeModel(GLenum mode) +{ + UNIMPLEMENTED(); +} + +void Context::texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) +{ + UNIMPLEMENTED(); +} + +void Context::texEnvf(GLenum target, GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::texEnvfv(GLenum target, GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::texEnvi(GLenum target, GLenum pname, GLint param) +{ + UNIMPLEMENTED(); +} + +void Context::texEnviv(GLenum target, GLenum pname, const GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::texEnvx(GLenum target, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::texEnvxv(GLenum target, GLenum pname, const GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::texParameterx(TextureType target, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::texParameterxv(TextureType target, GLenum pname, const GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::translatef(float x, float y, float z) +{ + UNIMPLEMENTED(); +} + +void Context::translatex(GLfixed x, GLfixed y, GLfixed z) +{ + UNIMPLEMENTED(); +} + +void Context::vertexPointer(GLint size, GLenum type, GLsizei stride, const void *ptr) +{ + UNIMPLEMENTED(); +} + +// GL_OES_draw_texture +void Context::drawTexf(float x, float y, float z, float width, float height) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexfv(const GLfloat *coords) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexiv(const GLint *coords) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexsv(const GLshort *coords) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) +{ + UNIMPLEMENTED(); +} + +void Context::drawTexxv(const GLfixed *coords) +{ + UNIMPLEMENTED(); +} + +// GL_OES_matrix_palette +void Context::currentPaletteMatrix(GLuint matrixpaletteindex) +{ + UNIMPLEMENTED(); +} + +void Context::loadPaletteFromModelViewMatrix() +{ + UNIMPLEMENTED(); +} + +void Context::matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) +{ + UNIMPLEMENTED(); +} + +void Context::weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) +{ + UNIMPLEMENTED(); +} + +// GL_OES_point_size_array +void Context::pointSizePointer(GLenum type, GLsizei stride, const void *ptr) +{ + UNIMPLEMENTED(); +} + +// GL_OES_query_matrix +GLbitfield Context::queryMatrixx(GLfixed *mantissa, GLint *exponent) +{ + UNIMPLEMENTED(); + return 0; +} + +// GL_OES_texture_cube_map +void Context::getTexGenfv(GLenum coord, GLenum pname, GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexGeniv(GLenum coord, GLenum pname, GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::getTexGenxv(GLenum coord, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); +} + +void Context::texGenf(GLenum coord, GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); +} + +void Context::texGenfv(GLenum coord, GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); +} + +void Context::texGeni(GLenum coord, GLenum pname, GLint param) +{ + UNIMPLEMENTED(); +} + +void Context::texGeniv(GLenum coord, GLenum pname, const GLint *params) +{ + UNIMPLEMENTED(); +} + +void Context::texGenx(GLenum coord, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); +} + +void Context::texGenxv(GLenum coord, GLenum pname, const GLint *params) +{ + UNIMPLEMENTED(); +} + +} // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h new file mode 100644 index 000000000000..8dd4ab4b8126 --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/Context_gles_1_0_autogen.h @@ -0,0 +1,129 @@ +// GENERATED FILE - DO NOT EDIT. +// Generated by generate_entry_points.py using data from gl.xml. +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Context_gles_1_0_autogen.h: Creates a macro for interfaces in Context. + +#ifndef ANGLE_CONTEXT_GLES_1_0_AUTOGEN_H_ +#define ANGLE_CONTEXT_GLES_1_0_AUTOGEN_H_ + +#define ANGLE_GLES1_CONTEXT_API \ + void alphaFunc(AlphaTestFunc funcPacked, GLfloat ref); \ + void alphaFuncx(AlphaTestFunc funcPacked, GLfixed ref); \ + void clearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); \ + void clearDepthx(GLfixed depth); \ + void clientActiveTexture(GLenum texture); \ + void clipPlanef(GLenum p, const GLfloat *eqn); \ + void clipPlanex(GLenum plane, const GLfixed *equation); \ + void color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); \ + void color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); \ + void color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); \ + void colorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \ + void depthRangex(GLfixed n, GLfixed f); \ + void disableClientState(GLenum array); \ + void enableClientState(GLenum array); \ + void fogf(GLenum pname, GLfloat param); \ + void fogfv(GLenum pname, const GLfloat *params); \ + void fogx(GLenum pname, GLfixed param); \ + void fogxv(GLenum pname, const GLfixed *param); \ + void frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); \ + void frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); \ + void getClipPlanef(GLenum plane, GLfloat *equation); \ + void getClipPlanex(GLenum plane, GLfixed *equation); \ + void getFixedv(GLenum pname, GLfixed *params); \ + void getLightfv(GLenum light, GLenum pname, GLfloat *params); \ + void getLightxv(GLenum light, GLenum pname, GLfixed *params); \ + void getMaterialfv(GLenum face, GLenum pname, GLfloat *params); \ + void getMaterialxv(GLenum face, GLenum pname, GLfixed *params); \ + void getTexEnvfv(GLenum target, GLenum pname, GLfloat *params); \ + void getTexEnviv(GLenum target, GLenum pname, GLint *params); \ + void getTexEnvxv(GLenum target, GLenum pname, GLfixed *params); \ + void getTexParameterxv(TextureType targetPacked, GLenum pname, GLfixed *params); \ + void lightModelf(GLenum pname, GLfloat param); \ + void lightModelfv(GLenum pname, const GLfloat *params); \ + void lightModelx(GLenum pname, GLfixed param); \ + void lightModelxv(GLenum pname, const GLfixed *param); \ + void lightf(GLenum light, GLenum pname, GLfloat param); \ + void lightfv(GLenum light, GLenum pname, const GLfloat *params); \ + void lightx(GLenum light, GLenum pname, GLfixed param); \ + void lightxv(GLenum light, GLenum pname, const GLfixed *params); \ + void lineWidthx(GLfixed width); \ + void loadIdentity(); \ + void loadMatrixf(const GLfloat *m); \ + void loadMatrixx(const GLfixed *m); \ + void logicOp(GLenum opcode); \ + void materialf(GLenum face, GLenum pname, GLfloat param); \ + void materialfv(GLenum face, GLenum pname, const GLfloat *params); \ + void materialx(GLenum face, GLenum pname, GLfixed param); \ + void materialxv(GLenum face, GLenum pname, const GLfixed *param); \ + void matrixMode(MatrixType modePacked); \ + void multMatrixf(const GLfloat *m); \ + void multMatrixx(const GLfixed *m); \ + void multiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); \ + void multiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); \ + void normal3f(GLfloat nx, GLfloat ny, GLfloat nz); \ + void normal3x(GLfixed nx, GLfixed ny, GLfixed nz); \ + void normalPointer(GLenum type, GLsizei stride, const void *pointer); \ + void orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); \ + void orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); \ + void pointParameterf(GLenum pname, GLfloat param); \ + void pointParameterfv(GLenum pname, const GLfloat *params); \ + void pointParameterx(GLenum pname, GLfixed param); \ + void pointParameterxv(GLenum pname, const GLfixed *params); \ + void pointSize(GLfloat size); \ + void pointSizex(GLfixed size); \ + void polygonOffsetx(GLfixed factor, GLfixed units); \ + void popMatrix(); \ + void pushMatrix(); \ + void rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); \ + void rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); \ + void sampleCoveragex(GLclampx value, GLboolean invert); \ + void scalef(GLfloat x, GLfloat y, GLfloat z); \ + void scalex(GLfixed x, GLfixed y, GLfixed z); \ + void shadeModel(GLenum mode); \ + void texCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \ + void texEnvf(GLenum target, GLenum pname, GLfloat param); \ + void texEnvfv(GLenum target, GLenum pname, const GLfloat *params); \ + void texEnvi(GLenum target, GLenum pname, GLint param); \ + void texEnviv(GLenum target, GLenum pname, const GLint *params); \ + void texEnvx(GLenum target, GLenum pname, GLfixed param); \ + void texEnvxv(GLenum target, GLenum pname, const GLfixed *params); \ + void texParameterx(TextureType targetPacked, GLenum pname, GLfixed param); \ + void texParameterxv(TextureType targetPacked, GLenum pname, const GLfixed *params); \ + void translatef(GLfloat x, GLfloat y, GLfloat z); \ + void translatex(GLfixed x, GLfixed y, GLfixed z); \ + void vertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \ + /* GL_OES_draw_texture */ \ + void drawTexf(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); \ + void drawTexfv(const GLfloat *coords); \ + void drawTexi(GLint x, GLint y, GLint z, GLint width, GLint height); \ + void drawTexiv(const GLint *coords); \ + void drawTexs(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); \ + void drawTexsv(const GLshort *coords); \ + void drawTexx(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); \ + void drawTexxv(const GLfixed *coords); \ + /* GL_OES_framebuffer_object */ \ + /* GL_OES_matrix_palette */ \ + void currentPaletteMatrix(GLuint matrixpaletteindex); \ + void loadPaletteFromModelViewMatrix(); \ + void matrixIndexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \ + void weightPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); \ + /* GL_OES_point_size_array */ \ + void pointSizePointer(GLenum type, GLsizei stride, const void *pointer); \ + /* GL_OES_query_matrix */ \ + GLbitfield queryMatrixx(GLfixed *mantissa, GLint *exponent); \ + /* GL_OES_texture_cube_map */ \ + void getTexGenfv(GLenum coord, GLenum pname, GLfloat *params); \ + void getTexGeniv(GLenum coord, GLenum pname, GLint *params); \ + void getTexGenxv(GLenum coord, GLenum pname, GLfixed *params); \ + void texGenf(GLenum coord, GLenum pname, GLfloat param); \ + void texGenfv(GLenum coord, GLenum pname, const GLfloat *params); \ + void texGeni(GLenum coord, GLenum pname, GLint param); \ + void texGeniv(GLenum coord, GLenum pname, const GLint *params); \ + void texGenx(GLenum coord, GLenum pname, GLfixed param); \ + void texGenxv(GLenum coord, GLenum pname, const GLfixed *params); + +#endif // ANGLE_CONTEXT_API_1_0_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/libANGLE/Display.cpp b/gfx/angle/checkout/src/libANGLE/Display.cpp index 5c0f4f189a9d..7feca74c7efb 100644 --- a/gfx/angle/checkout/src/libANGLE/Display.cpp +++ b/gfx/angle/checkout/src/libANGLE/Display.cpp @@ -1049,6 +1049,9 @@ void Display::initDisplayExtensions() // Enable program cache control since it is not back-end dependent. mDisplayExtensions.programCacheControl = true; + // Request extension is implemented in the ANGLE frontend + mDisplayExtensions.createContextExtensionsEnabled = true; + mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions); } diff --git a/gfx/angle/checkout/src/libANGLE/Error.h b/gfx/angle/checkout/src/libANGLE/Error.h index 1d57bb8707c0..5084e017c4c5 100644 --- a/gfx/angle/checkout/src/libANGLE/Error.h +++ b/gfx/angle/checkout/src/libANGLE/Error.h @@ -162,7 +162,7 @@ class ANGLE_NO_DISCARD Error final // automatic error type conversion inline Error(gl::Error &&glErr); - inline Error(gl::Error glErr); + inline Error(const gl::Error &glErr); inline Error &operator=(const Error &other); inline Error &operator=(Error &&other); diff --git a/gfx/angle/checkout/src/libANGLE/Error.inl b/gfx/angle/checkout/src/libANGLE/Error.inl index 4632830ce0bc..aed8dcdd1210 100644 --- a/gfx/angle/checkout/src/libANGLE/Error.inl +++ b/gfx/angle/checkout/src/libANGLE/Error.inl @@ -134,10 +134,10 @@ Error::Error(gl::Error &&glErr) { } -Error::Error(gl::Error glErr) +Error::Error(const gl::Error &glErr) : mCode(EGL_BAD_ACCESS), mID(0), - mMessage(std::move(glErr.mMessage)) + mMessage(glErr.mMessage.get()) { } diff --git a/gfx/angle/checkout/src/libANGLE/ErrorStrings.h b/gfx/angle/checkout/src/libANGLE/ErrorStrings.h index fced38086f35..5a7f403d6f66 100644 --- a/gfx/angle/checkout/src/libANGLE/ErrorStrings.h +++ b/gfx/angle/checkout/src/libANGLE/ErrorStrings.h @@ -16,6 +16,7 @@ namespace gl { +ERRMSG(BufferBoundForTransformFeedback, "Buffer is bound for transform feedback."); ERRMSG(BufferNotBound, "A buffer must be bound."); ERRMSG(CompressedTextureDimensionsMustMatchData, "Compressed texture dimensions must exactly match the dimensions of the data passed in."); @@ -29,6 +30,9 @@ ERRMSG(DefaultFramebufferTarget, "It is invalid to change default FBO's attachme ERRMSG(DispatchIndirectBufferNotBound, "Dispatch indirect buffer must be bound."); ERRMSG(DrawBufferTypeMismatch, "Fragment shader output type does not match the bound framebuffer attachment type."); +ERRMSG(ElementArrayBufferBoundForTransformFeedback, + "It is undefined behavior to use an element array buffer that is bound for transform " + "feedback."); ERRMSG(EnumNotSupported, "Enum is not currently supported."); ERRMSG(EnumRequiresGLES31, "Enum requires GLES 3.1"); ERRMSG(ES31Required, "OpenGL ES 3.1 Required"); @@ -41,6 +45,10 @@ ERRMSG(FeedbackLoop, "Feedback loop formed between Framebuffer and active Textur ERRMSG(FramebufferIncompleteAttachment, "Attachment type must be compatible with attachment object."); ERRMSG(GenerateMipmapNotAllowed, "Texture format does not support mipmap generation."); +ERRMSG(GeometryShaderExtensionNotEnabled, "GL_EXT_geometry_shader extension not enabled."); +ERRMSG(GLES1Only, "GLES1-only function."); +ERRMSG(IncompatibleDrawModeAgainstGeometryShader, + "Primitive mode is incompatible with the input primitive type of the geometry shader."); ERRMSG(IndexExceedsMaxActiveUniform, "Index exceeds program active uniform count."); ERRMSG(IndexExceedsMaxDrawBuffer, "Index exceeds MAX_DRAW_BUFFERS."); ERRMSG(IndexExceedsMaxVertexAttribute, "Index exceeds MAX_VERTEX_ATTRIBS."); @@ -56,6 +64,8 @@ ERRMSG(InvalidBorder, "Border must be 0."); ERRMSG(InvalidBufferTypes, "Invalid buffer target enum."); ERRMSG(InvalidBufferUsage, "Invalid buffer usage enum."); ERRMSG(InvalidClearMask, "Invalid mask bits."); +ERRMSG(InvalidCombinedImageUnit, + "Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_COMBINED_IMAGE_UNITS)"); ERRMSG(InvalidConstantColor, "CONSTANT_COLOR (or ONE_MINUS_CONSTANT_COLOR) and CONSTANT_ALPHA (or " "ONE_MINUS_CONSTANT_ALPHA) cannot be used together as source and destination factors in the " @@ -83,6 +93,8 @@ ERRMSG(InvalidInternalFormat, "Invalid internal format."); ERRMSG(InvalidMatrixMode, "Invalid matrix mode."); ERRMSG(InvalidMemoryBarrierBit, "Invalid memory barrier bit."); ERRMSG(InvalidMipLevel, "Level of detail outside of range."); +ERRMSG(InvalidMultitextureUnit, + "Specified unit must be in [GL_TEXTURE0, GL_TEXTURE0 + GL_MAX_TEXTURE_UNITS)"); ERRMSG(InvalidName, "Invalid name."); ERRMSG(InvalidNameCharacters, "Name contains invalid characters."); ERRMSG(InvalidPname, "Invalid pname."); @@ -116,6 +128,8 @@ ERRMSG(InvalidVertexAttrSize, "Vertex attribute size must be 1, 2, 3, or 4."); ERRMSG(InvalidWidth, "Invalid width."); ERRMSG(InvalidWrapModeTexture, "Invalid wrap mode for texture type."); ERRMSG(LevelNotZero, "Texture level must be zero."); +ERRMSG(MatrixStackOverflow, "Current matrix stack is full."); +ERRMSG(MatrixStackUnderflow, "Current matrix stack has only a single matrix."); ERRMSG(MismatchedByteCountType, "Buffer size does not align with data type."); ERRMSG(MismatchedFormat, "Format must match internal format."); ERRMSG(MismatchedTargetAndFormat, "Invalid texture target and format combination."); @@ -135,10 +149,11 @@ ERRMSG(NegativeSize, "Cannot have negative height or width."); ERRMSG(NegativeStart, "Cannot have negative start."); ERRMSG(NegativeStride, "Cannot have negative stride."); ERRMSG(NoActiveComputeShaderStage, "No active compute shader stage in this program."); +ERRMSG(NoActiveGeometryShaderStage, "No active geometry shader stage in this program."); ERRMSG(NoActiveProgramWithComputeShader, "No active program for the compute shader stage."); ERRMSG(NoSuchPath, "No such path object."); ERRMSG(NoTransformFeedbackOutputVariables, - "The active program has specified no output variables to record."); + "The active program has specified no output variables to record."); ERRMSG(NoZeroDivisor, "At least one enabled attribute must have a divisor of zero."); ERRMSG(NVFenceNotSupported, "GL_NV_fence is not supported"); ERRMSG(ObjectNotGenerated, "Object cannot be used because it has not been generated."); @@ -149,6 +164,11 @@ ERRMSG(OutsideOfBounds, "Parameter outside of bounds."); ERRMSG(ParamOverflow, "The provided parameters overflow with the provided buffer."); ERRMSG(PixelDataNotNull, "Pixel data must be null."); ERRMSG(PixelDataNull, "Pixel data cannot be null."); +ERRMSG(PixelPackBufferBoundForTransformFeedback, + "It is undefined behavior to use a pixel pack buffer that is bound for transform feedback."); +ERRMSG( + PixelUnpackBufferBoundForTransformFeedback, + "It is undefined behavior to use a pixel unpack buffer that is bound for transform feedback."); ERRMSG(ProgramDoesNotExist, "Program doesn't exist."); ERRMSG(ProgramNotBound, "A program must be bound."); ERRMSG(ProgramNotLinked, "Program not linked."); @@ -168,15 +188,23 @@ ERRMSG(StencilReferenceMaskOrMismatch, ERRMSG(StrideMustBeMultipleOfType, "Stride must be a multiple of the passed in datatype."); ERRMSG(TextureNotBound, "A texture must be bound."); ERRMSG(TextureNotPow2, "The texture is a non-power-of-two texture."); +ERRMSG(TransformFeedbackBufferDoubleBound, + "A transform feedback buffer that would be written to is also bound to a " + "non-transform-feedback target, which would cause undefined behavior."); +ERRMSG(TransformFeedbackBufferTooSmall, "Not enough space in bound transform feedback buffers."); ERRMSG(TransformFeedbackDoesNotExist, "Transform feedback object that does not exist."); ERRMSG(TypeMismatch, "Passed in texture target and format must match the one originally used to define the " "texture."); ERRMSG(TypeNotUnsignedShortByte, "Only UNSIGNED_SHORT and UNSIGNED_BYTE types are supported."); +ERRMSG(UniformBufferBoundForTransformFeedback, + "It is undefined behavior to use an uniform buffer that is bound for transform feedback."); ERRMSG(UniformSizeMismatch, "Uniform size does not match uniform method."); ERRMSG(UnknownParameter, "Unknown parameter value."); ERRMSG(VertexArrayNoBuffer, "An enabled vertex array has no buffer."); ERRMSG(VertexArrayNoBufferPointer, "An enabled vertex array has no buffer and no pointer."); +ERRMSG(VertexBufferBoundForTransformFeedback, + "It is undefined behavior to use a vertex buffer that is bound for transform feedback."); ERRMSG(VertexShaderTypeMismatch, "Vertex shader input type does not match the type of the bound vertex attribute.") ERRMSG(ViewportNegativeSize, "Viewport size cannot be negative."); diff --git a/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp b/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp index 25538d3f4f92..666c0ff26996 100644 --- a/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp +++ b/gfx/angle/checkout/src/libANGLE/Framebuffer.cpp @@ -90,7 +90,7 @@ bool CheckAttachmentCompleteness(const Context *context, const FramebufferAttach // TODO(jmadill): Check if OpenGL ES2 drivers enforce cube completeness. const Texture *texture = attachment.getTexture(); ASSERT(texture); - if (texture->getTarget() == GL_TEXTURE_CUBE_MAP && + if (texture->getType() == TextureType::CubeMap && !texture->getTextureState().isCubeComplete()) { return false; @@ -981,7 +981,7 @@ void Framebuffer::invalidateCompletenessCache() } } -GLenum Framebuffer::checkStatus(const Context *context) +Error Framebuffer::checkStatus(const Context *context, GLenum *statusOut) { // The default framebuffer is always complete except when it is surfaceless in which // case it is always unsupported. We return early because the default framebuffer may @@ -991,18 +991,29 @@ GLenum Framebuffer::checkStatus(const Context *context) ASSERT(mCachedStatus.valid()); ASSERT(mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE || mCachedStatus.value() == GL_FRAMEBUFFER_UNDEFINED_OES); - return mCachedStatus.value(); + *statusOut = mCachedStatus.value(); + return NoError(); } if (hasAnyDirtyBit() || !mCachedStatus.valid()) { - mCachedStatus = checkStatusImpl(context); + mCachedStatus = checkStatusWithGLFrontEnd(context); + + if (mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE) + { + ANGLE_TRY(syncState(context)); + if (!mImpl->checkStatus(context)) + { + mCachedStatus = GL_FRAMEBUFFER_UNSUPPORTED; + } + } } - return mCachedStatus.value(); + *statusOut = mCachedStatus.value(); + return NoError(); } -GLenum Framebuffer::checkStatusImpl(const Context *context) +GLenum Framebuffer::checkStatusWithGLFrontEnd(const Context *context) { const ContextState &state = context->getContextState(); @@ -1199,12 +1210,6 @@ GLenum Framebuffer::checkStatusImpl(const Context *context) } } - syncState(context); - if (!mImpl->checkStatus(context)) - { - return GL_FRAMEBUFFER_UNSUPPORTED; - } - return GL_FRAMEBUFFER_COMPLETE; } @@ -1287,25 +1292,8 @@ Error Framebuffer::clear(const Context *context, GLbitfield mask) return NoError(); } - const auto &blend = glState.getBlendState(); - const auto &depthStencil = glState.getDepthStencilState(); - - bool color = (mask & GL_COLOR_BUFFER_BIT) != 0 && !IsColorMaskedOut(blend); - bool depth = (mask & GL_DEPTH_BUFFER_BIT) != 0 && !IsDepthMaskedOut(depthStencil); - bool stencil = (mask & GL_STENCIL_BUFFER_BIT) != 0 && !IsStencilMaskedOut(depthStencil); - - if (partialClearNeedsInit(context, color, depth, stencil)) - { - ANGLE_TRY(ensureDrawAttachmentsInitialized(context)); - } - ANGLE_TRY(mImpl->clear(context, mask)); - if (glState.isRobustResourceInitEnabled()) - { - markDrawAttachmentsInitialized(color, depth, stencil); - } - return NoError(); } @@ -1320,17 +1308,8 @@ Error Framebuffer::clearBufferfv(const Context *context, return NoError(); } - if (partialBufferClearNeedsInit(context, buffer)) - { - ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer)); - } - ANGLE_TRY(mImpl->clearBufferfv(context, buffer, drawbuffer, values)); - if (context->isRobustResourceInitEnabled()) - { - markBufferInitialized(buffer, drawbuffer); - } return NoError(); } @@ -1345,17 +1324,8 @@ Error Framebuffer::clearBufferuiv(const Context *context, return NoError(); } - if (partialBufferClearNeedsInit(context, buffer)) - { - ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer)); - } - ANGLE_TRY(mImpl->clearBufferuiv(context, buffer, drawbuffer, values)); - if (context->isRobustResourceInitEnabled()) - { - markBufferInitialized(buffer, drawbuffer); - } return NoError(); } @@ -1370,17 +1340,8 @@ Error Framebuffer::clearBufferiv(const Context *context, return NoError(); } - if (partialBufferClearNeedsInit(context, buffer)) - { - ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer)); - } - ANGLE_TRY(mImpl->clearBufferiv(context, buffer, drawbuffer, values)); - if (context->isRobustResourceInitEnabled()) - { - markBufferInitialized(buffer, drawbuffer); - } return NoError(); } @@ -1396,28 +1357,23 @@ Error Framebuffer::clearBufferfi(const Context *context, return NoError(); } - if (partialBufferClearNeedsInit(context, buffer)) - { - ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer)); - } - ANGLE_TRY(mImpl->clearBufferfi(context, buffer, drawbuffer, depth, stencil)); - if (context->isRobustResourceInitEnabled()) - { - markBufferInitialized(buffer, drawbuffer); - } return NoError(); } -GLenum Framebuffer::getImplementationColorReadFormat(const Context *context) const +Error Framebuffer::getImplementationColorReadFormat(const Context *context, GLenum *formatOut) { - return mImpl->getImplementationColorReadFormat(context); + ANGLE_TRY(syncState(context)); + *formatOut = mImpl->getImplementationColorReadFormat(context); + return NoError(); } -GLenum Framebuffer::getImplementationColorReadType(const Context *context) const +Error Framebuffer::getImplementationColorReadType(const Context *context, GLenum *typeOut) { - return mImpl->getImplementationColorReadType(context); + ANGLE_TRY(syncState(context)); + *typeOut = mImpl->getImplementationColorReadType(context); + return NoError(); } Error Framebuffer::readPixels(const Context *context, @@ -1432,7 +1388,7 @@ Error Framebuffer::readPixels(const Context *context, Buffer *unpackBuffer = context->getGLState().getTargetBuffer(BufferBinding::PixelUnpack); if (unpackBuffer) { - unpackBuffer->onPixelUnpack(); + unpackBuffer->onPixelPack(context); } return NoError(); @@ -1477,18 +1433,18 @@ Error Framebuffer::blit(const Context *context, return mImpl->blit(context, sourceArea, destArea, blitMask, filter); } -int Framebuffer::getSamples(const Context *context) +Error Framebuffer::getSamples(const Context *context, int *samplesOut) { - if (complete(context)) - { - return getCachedSamples(context); - } - - return 0; + bool completeness = false; + ANGLE_TRY(isComplete(context, &completeness)); + *samplesOut = completeness ? getCachedSamples(context) : 0; + return NoError(); } int Framebuffer::getCachedSamples(const Context *context) { + ASSERT(mCachedStatus.valid() && mCachedStatus.value() == GL_FRAMEBUFFER_COMPLETE); + // For a complete framebuffer, all attachments must have the same sample count. // In this case return the first nonzero sample size. const auto *firstNonNullAttachment = mState.getFirstNonNullAttachment(); @@ -1773,7 +1729,9 @@ void Framebuffer::updateAttachment(const Context *context, multiviewLayout, viewportOffsets); mDirtyBits.set(dirtyBit); mState.mResourceNeedsInit.set(dirtyBit, attachment->initState() == InitState::MayNeedInit); - onDirtyBinding->bind(resource); + onDirtyBinding->bind(resource ? resource->getSubject() : nullptr); + + invalidateCompletenessCache(); } void Framebuffer::resetAttachment(const Context *context, GLenum binding) @@ -1781,23 +1739,30 @@ void Framebuffer::resetAttachment(const Context *context, GLenum binding) setAttachment(context, GL_NONE, binding, ImageIndex::MakeInvalid(), nullptr); } -void Framebuffer::syncState(const Context *context) +Error Framebuffer::syncState(const Context *context) { if (mDirtyBits.any()) { - mImpl->syncState(context, mDirtyBits); + mDirtyBitsGuard = mDirtyBits; + ANGLE_TRY(mImpl->syncState(context, mDirtyBits)); mDirtyBits.reset(); - if (mId != 0) - { - mCachedStatus.reset(); - } + mDirtyBitsGuard.reset(); } + return NoError(); } void Framebuffer::onSubjectStateChange(const Context *context, angle::SubjectIndex index, angle::SubjectMessage message) { + if (message == angle::SubjectMessage::DEPENDENT_DIRTY_BITS) + { + ASSERT(!mDirtyBitsGuard.valid() || mDirtyBitsGuard.value().test(index)); + mDirtyBits.set(index); + context->getGLState().setFramebufferDirty(this); + return; + } + // Only reset the cached status if this is not the default framebuffer. The default framebuffer // will still use this channel to mark itself dirty. if (mId != 0) @@ -1827,14 +1792,12 @@ FramebufferAttachment *Framebuffer::getAttachmentFromSubjectIndex(angle::Subject } } -bool Framebuffer::complete(const Context *context) +Error Framebuffer::isComplete(const Context *context, bool *completeOut) { - return (checkStatus(context) == GL_FRAMEBUFFER_COMPLETE); -} - -bool Framebuffer::cachedComplete() const -{ - return (mCachedStatus.valid() && mCachedStatus == GL_FRAMEBUFFER_COMPLETE); + GLenum status = GL_NONE; + ANGLE_TRY(checkStatus(context, &status)); + *completeOut = (status == GL_FRAMEBUFFER_COMPLETE); + return NoError(); } bool Framebuffer::formsRenderingFeedbackLoopWith(const State &state) const @@ -1875,18 +1838,24 @@ bool Framebuffer::formsRenderingFeedbackLoopWith(const State &state) const } } - // Note: we assume the front and back masks are the same for WebGL. const FramebufferAttachment *stencil = getStencilbuffer(); - ASSERT(dsState.stencilBackWritemask == dsState.stencilWritemask); - if (stencil && stencil->type() == GL_TEXTURE && dsState.stencilTest && - dsState.stencilWritemask != 0) + if (dsState.stencilTest && stencil) { - // Skip the feedback loop check if depth/stencil point to the same resource. - if (!depth || *stencil != *depth) + GLuint stencilSize = stencil->getStencilSize(); + ASSERT(stencilSize <= 8); + GLuint maxStencilValue = (1 << stencilSize) - 1; + // We assume the front and back masks are the same for WebGL. + ASSERT((dsState.stencilBackWritemask & maxStencilValue) == + (dsState.stencilWritemask & maxStencilValue)); + if (stencil->type() == GL_TEXTURE && dsState.stencilWritemask != 0) { - if (program->samplesFromTexture(state, stencil->id())) + // Skip the feedback loop check if depth/stencil point to the same resource. + if (!depth || *stencil != *depth) { - return true; + if (program->samplesFromTexture(state, stencil->id())) + { + return true; + } } } } @@ -1945,35 +1914,28 @@ void Framebuffer::setDefaultWidth(GLint defaultWidth) { mState.mDefaultWidth = defaultWidth; mDirtyBits.set(DIRTY_BIT_DEFAULT_WIDTH); + invalidateCompletenessCache(); } void Framebuffer::setDefaultHeight(GLint defaultHeight) { mState.mDefaultHeight = defaultHeight; mDirtyBits.set(DIRTY_BIT_DEFAULT_HEIGHT); + invalidateCompletenessCache(); } void Framebuffer::setDefaultSamples(GLint defaultSamples) { mState.mDefaultSamples = defaultSamples; mDirtyBits.set(DIRTY_BIT_DEFAULT_SAMPLES); + invalidateCompletenessCache(); } void Framebuffer::setDefaultFixedSampleLocations(bool defaultFixedSampleLocations) { mState.mDefaultFixedSampleLocations = defaultFixedSampleLocations; mDirtyBits.set(DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS); -} - -// TODO(jmadill): Remove this kludge. -GLenum Framebuffer::checkStatus(const ValidationContext *context) -{ - return checkStatus(static_cast(context)); -} - -int Framebuffer::getSamples(const ValidationContext *context) -{ - return getSamples(static_cast(context)); + invalidateCompletenessCache(); } GLsizei Framebuffer::getNumViews() const @@ -1996,6 +1958,63 @@ GLenum Framebuffer::getMultiviewLayout() const return mState.getMultiviewLayout(); } +Error Framebuffer::ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask) +{ + const auto &glState = context->getGLState(); + if (!context->isRobustResourceInitEnabled() || glState.isRasterizerDiscardEnabled()) + { + return NoError(); + } + + const BlendState &blend = glState.getBlendState(); + const DepthStencilState &depthStencil = glState.getDepthStencilState(); + + bool color = (mask & GL_COLOR_BUFFER_BIT) != 0 && !IsColorMaskedOut(blend); + bool depth = (mask & GL_DEPTH_BUFFER_BIT) != 0 && !IsDepthMaskedOut(depthStencil); + bool stencil = (mask & GL_STENCIL_BUFFER_BIT) != 0 && !IsStencilMaskedOut(depthStencil); + + if (!color && !depth && !stencil) + { + return NoError(); + } + + if (partialClearNeedsInit(context, color, depth, stencil)) + { + ANGLE_TRY(ensureDrawAttachmentsInitialized(context)); + } + + // If the impl encounters an error during a a full (non-partial) clear, the attachments will + // still be marked initialized. This simplifies design, allowing this method to be called before + // the clear. + markDrawAttachmentsInitialized(color, depth, stencil); + + return NoError(); +} + +Error Framebuffer::ensureClearBufferAttachmentsInitialized(const Context *context, + GLenum buffer, + GLint drawbuffer) +{ + if (!context->isRobustResourceInitEnabled() || + context->getGLState().isRasterizerDiscardEnabled() || + IsClearBufferMaskedOut(context, buffer)) + { + return NoError(); + } + + if (partialBufferClearNeedsInit(context, buffer)) + { + ANGLE_TRY(ensureBufferInitialized(context, buffer, drawbuffer)); + } + + // If the impl encounters an error during a a full (non-partial) clear, the attachments will + // still be marked initialized. This simplifies design, allowing this method to be called before + // the clear. + markBufferInitialized(buffer, drawbuffer); + + return NoError(); +} + Error Framebuffer::ensureDrawAttachmentsInitialized(const Context *context) { if (!context->isRobustResourceInitEnabled()) diff --git a/gfx/angle/checkout/src/libANGLE/Framebuffer.h b/gfx/angle/checkout/src/libANGLE/Framebuffer.h index e7fe8900d09d..4e99a89745c1 100644 --- a/gfx/angle/checkout/src/libANGLE/Framebuffer.h +++ b/gfx/angle/checkout/src/libANGLE/Framebuffer.h @@ -18,8 +18,8 @@ #include "libANGLE/Debug.h" #include "libANGLE/Error.h" #include "libANGLE/FramebufferAttachment.h" +#include "libANGLE/Observer.h" #include "libANGLE/RefCountObject.h" -#include "libANGLE/signal_utils.h" namespace rx { @@ -44,7 +44,6 @@ class Renderbuffer; class State; class Texture; class TextureCapsMap; -class ValidationContext; struct Caps; struct Extensions; struct ImageIndex; @@ -133,7 +132,7 @@ class FramebufferState final : angle::NonCopyable angle::BitSet mResourceNeedsInit; }; -class Framebuffer final : public LabeledObject, public angle::ObserverInterface +class Framebuffer final : public angle::ObserverInterface, public LabeledObject { public: // Constructor to build application-defined framebuffers @@ -215,7 +214,7 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface bool usingExtendedDrawBuffers() const; // This method calls checkStatus. - int getSamples(const Context *context); + Error getSamples(const Context *context, int *samplesOut); Error getSamplePosition(size_t index, GLfloat *xy) const; @@ -230,18 +229,13 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface void invalidateCompletenessCache(); - GLenum checkStatus(const Context *context); - - // TODO(jmadill): Remove this kludge. - GLenum checkStatus(const ValidationContext *context); - int getSamples(const ValidationContext *context); + Error checkStatus(const Context *context, GLenum *statusOut); // For when we don't want to check completeness in getSamples(). int getCachedSamples(const Context *context); // Helper for checkStatus == GL_FRAMEBUFFER_COMPLETE. - bool complete(const Context *context); - bool cachedComplete() const; + Error isComplete(const Context *context, bool *completeOut); bool hasValidDepthStencil() const; @@ -271,8 +265,10 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface GLfloat depth, GLint stencil); - GLenum getImplementationColorReadFormat(const Context *context) const; - GLenum getImplementationColorReadType(const Context *context) const; + // These two methods call syncState() internally. + Error getImplementationColorReadFormat(const Context *context, GLenum *formatOut); + Error getImplementationColorReadType(const Context *context, GLenum *typeOut); + Error readPixels(const Context *context, const Rectangle &area, GLenum format, @@ -305,7 +301,7 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface using DirtyBits = angle::BitSet; bool hasAnyDirtyBit() const { return mDirtyBits.any(); } - void syncState(const Context *context); + Error syncState(const Context *context); // Observer implementation void onSubjectStateChange(const Context *context, @@ -317,6 +313,10 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface GLint copyTextureLevel, GLint copyTextureLayer) const; + Error ensureClearAttachmentsInitialized(const Context *context, GLbitfield mask); + Error ensureClearBufferAttachmentsInitialized(const Context *context, + GLenum buffer, + GLint drawbuffer); Error ensureDrawAttachmentsInitialized(const Context *context); Error ensureReadAttachmentInitialized(const Context *context, GLbitfield blitMask); Box getDimensions() const; @@ -330,7 +330,7 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface GLenum matchType, GLuint matchId, size_t dirtyBit); - GLenum checkStatusImpl(const Context *context); + GLenum checkStatusWithGLFrontEnd(const Context *context); void setAttachment(const Context *context, GLenum type, GLenum binding, @@ -391,6 +391,10 @@ class Framebuffer final : public LabeledObject, public angle::ObserverInterface DirtyBits mDirtyBits; + // The dirty bits guard is checked when we get a dependent state change message. We verify that + // we don't set a dirty bit that isn't already set, when inside the dirty bits syncState. + Optional mDirtyBitsGuard; + // A cache of attached textures for quick validation of feedback loops. mutable Optional> mAttachedTextures; }; diff --git a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp index 762f47bb908d..6f50b859f575 100644 --- a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp +++ b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.cpp @@ -182,32 +182,32 @@ void FramebufferAttachment::attach(const Context *context, GLuint FramebufferAttachment::getRedSize() const { - return getSize().empty() ? 0 : getFormat().info->redBits; + return getFormat().info->redBits; } GLuint FramebufferAttachment::getGreenSize() const { - return getSize().empty() ? 0 : getFormat().info->greenBits; + return getFormat().info->greenBits; } GLuint FramebufferAttachment::getBlueSize() const { - return getSize().empty() ? 0 : getFormat().info->blueBits; + return getFormat().info->blueBits; } GLuint FramebufferAttachment::getAlphaSize() const { - return getSize().empty() ? 0 : getFormat().info->alphaBits; + return getFormat().info->alphaBits; } GLuint FramebufferAttachment::getDepthSize() const { - return getSize().empty() ? 0 : getFormat().info->depthBits; + return getFormat().info->depthBits; } GLuint FramebufferAttachment::getStencilSize() const { - return getSize().empty() ? 0 : getFormat().info->stencilBits; + return getFormat().info->stencilBits; } GLenum FramebufferAttachment::getComponentType() const @@ -231,12 +231,12 @@ const ImageIndex &FramebufferAttachment::getTextureImageIndex() const return mTarget.textureIndex(); } -GLenum FramebufferAttachment::cubeMapFace() const +TextureTarget FramebufferAttachment::cubeMapFace() const { ASSERT(mType == GL_TEXTURE); const auto &index = mTarget.textureIndex(); - return index.type == GL_TEXTURE_CUBE_MAP ? index.target : GL_NONE; + return index.type == TextureType::CubeMap ? index.target : TextureTarget::InvalidEnum; } GLint FramebufferAttachment::mipLevel() const @@ -353,6 +353,16 @@ Error FramebufferAttachmentObject::getAttachmentRenderTarget( return getAttachmentImpl()->getAttachmentRenderTarget(context, binding, imageIndex, rtOut); } +void FramebufferAttachmentObject::onStorageChange(const gl::Context *context) const +{ + return getAttachmentImpl()->onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED); +} + +angle::Subject *FramebufferAttachmentObject::getSubject() const +{ + return getAttachmentImpl(); +} + Error FramebufferAttachmentObject::initializeContents(const Context *context, const ImageIndex &imageIndex) { @@ -360,7 +370,7 @@ Error FramebufferAttachmentObject::initializeContents(const Context *context, // Because gl::Texture cannot support tracking individual layer dirtiness, we only handle // initializing entire mip levels for 2D array textures. - if (imageIndex.type == GL_TEXTURE_2D_ARRAY && imageIndex.hasLayer()) + if (imageIndex.type == TextureType::_2DArray && imageIndex.hasLayer()) { ImageIndex fullMipIndex = imageIndex; fullMipIndex.layerIndex = ImageIndex::ENTIRE_LEVEL; diff --git a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h index 44f2fab13711..8eeaccc4c1c9 100644 --- a/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h +++ b/gfx/angle/checkout/src/libANGLE/FramebufferAttachment.h @@ -15,7 +15,6 @@ #include "libANGLE/angletypes.h" #include "libANGLE/Error.h" #include "libANGLE/ImageIndex.h" -#include "libANGLE/signal_utils.h" namespace egl { @@ -36,6 +35,11 @@ class FramebufferAttachmentRenderTarget : angle::NonCopyable class FramebufferAttachmentObjectImpl; } +namespace angle +{ +class Subject; +} // namespace angle + namespace gl { class FramebufferAttachmentObject; @@ -100,7 +104,7 @@ class FramebufferAttachment final // These methods are only legal to call on Texture attachments const ImageIndex &getTextureImageIndex() const; - GLenum cubeMapFace() const; + TextureTarget cubeMapFace() const; GLint mipLevel() const; GLint layer() const; GLsizei getNumViews() const; @@ -180,7 +184,7 @@ class FramebufferAttachment final }; // A base class for objects that FBO Attachments may point to. -class FramebufferAttachmentObject : public angle::Subject +class FramebufferAttachmentObject { public: FramebufferAttachmentObject(); @@ -206,6 +210,9 @@ class FramebufferAttachmentObject : public angle::Subject Error initializeContents(const Context *context, const ImageIndex &imageIndex); + void onStorageChange(const gl::Context *context) const; + angle::Subject *getSubject() const; + protected: virtual rx::FramebufferAttachmentObjectImpl *getAttachmentImpl() const = 0; }; diff --git a/gfx/angle/checkout/src/libANGLE/GLES1State.cpp b/gfx/angle/checkout/src/libANGLE/GLES1State.cpp new file mode 100644 index 000000000000..de9cf679f80a --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/GLES1State.cpp @@ -0,0 +1,271 @@ +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// GLES1State.cpp: Implements the GLES1State class, tracking state +// for GLES1 contexts. + +#include "libANGLE/GLES1State.h" + +#include "libANGLE/Context.h" + +namespace gl +{ + +TextureCoordF::TextureCoordF() = default; + +TextureCoordF::TextureCoordF(float _s, float _t, float _r, float _q) : s(_s), t(_t), r(_r), q(_q) +{ +} + +bool TextureCoordF::operator==(const TextureCoordF &other) const +{ + return s == other.s && t == other.t && r == other.r && q == other.q; +} + +GLES1State::GLES1State() + : mGLState(nullptr), + mVertexArrayEnabled(false), + mNormalArrayEnabled(false), + mColorArrayEnabled(false), + mPointSizeArrayEnabled(false), + mLineSmoothEnabled(false), + mPointSmoothEnabled(false), + mPointSpriteEnabled(false), + mAlphaTestEnabled(false), + mLogicOpEnabled(false), + mLightingEnabled(false), + mFogEnabled(false), + mRescaleNormalEnabled(false), + mNormalizeEnabled(false), + mColorMaterialEnabled(false), + mReflectionMapEnabled(false), + mCurrentColor({0.0f, 0.0f, 0.0f, 0.0f}), + mCurrentNormal({0.0f, 0.0f, 0.0f}), + mClientActiveTexture(0), + mMatrixMode(MatrixType::Modelview), + mShadeModel(ShadingModel::Smooth), + mAlphaTestFunc(AlphaTestFunc::AlwaysPass), + mAlphaTestRef(0.0f), + mLogicOp(LogicalOperation::Copy), + mLineSmoothHint(HintSetting::DontCare), + mPointSmoothHint(HintSetting::DontCare), + mPerspectiveCorrectionHint(HintSetting::DontCare), + mFogHint(HintSetting::DontCare) +{ +} + +GLES1State::~GLES1State() = default; + +// Taken from the GLES 1.x spec which specifies all initial state values. +void GLES1State::initialize(const Context *context, const State *state) +{ + mGLState = state; + + const Caps &caps = context->getCaps(); + + mTexUnitEnables.resize(caps.maxMultitextureUnits); + for (auto &enables : mTexUnitEnables) + { + enables.enable2D = false; + enables.enableCubeMap = false; + } + + mVertexArrayEnabled = false; + mNormalArrayEnabled = false; + mColorArrayEnabled = false; + mPointSizeArrayEnabled = false; + mTexCoordArrayEnabled.resize(caps.maxMultitextureUnits, false); + + mLineSmoothEnabled = false; + mPointSmoothEnabled = false; + mPointSpriteEnabled = false; + mLogicOpEnabled = false; + mAlphaTestEnabled = false; + mLightingEnabled = false; + mFogEnabled = false; + mRescaleNormalEnabled = false; + mNormalizeEnabled = false; + mColorMaterialEnabled = false; + mReflectionMapEnabled = false; + + mMatrixMode = MatrixType::Modelview; + + mCurrentColor = {1.0f, 1.0f, 1.0f, 1.0f}; + mCurrentNormal = {0.0f, 0.0f, 1.0f}; + mCurrentTextureCoords.resize(caps.maxMultitextureUnits); + mClientActiveTexture = 0; + + mTextureEnvironments.resize(caps.maxMultitextureUnits); + + mModelviewMatrices.push_back(angle::Mat4()); + mProjectionMatrices.push_back(angle::Mat4()); + mTextureMatrices.resize(caps.maxMultitextureUnits); + for (auto &stack : mTextureMatrices) + { + stack.push_back(angle::Mat4()); + } + + mMaterial.ambient = {0.2f, 0.2f, 0.2f, 1.0f}; + mMaterial.diffuse = {0.8f, 0.8f, 0.8f, 1.0f}; + mMaterial.specular = {0.0f, 0.0f, 0.0f, 1.0f}; + mMaterial.emissive = {0.0f, 0.0f, 0.0f, 1.0f}; + + mMaterial.specularExponent = 0.0f; + + mLightModel.color = {0.2f, 0.2f, 0.2f, 1.0f}; + mLightModel.twoSided = false; + + mLights.resize(caps.maxLights); + + // GL_LIGHT0 is special and has default state that avoids all-black renderings. + mLights[0].diffuse = {1.0f, 1.0f, 1.0f, 1.0f}; + mLights[0].specular = {1.0f, 1.0f, 1.0f, 1.0f}; + + mFog.mode = FogMode::Exp; + mFog.density = 1.0f; + mFog.start = 0.0f; + mFog.end = 1.0f; + + mFog.color = {0.0f, 0.0f, 0.0f, 0.0f}; + + mShadeModel = ShadingModel::Smooth; + + mAlphaTestFunc = AlphaTestFunc::AlwaysPass; + mAlphaTestRef = 0.0f; + + mLogicOp = LogicalOperation::Copy; + + mClipPlaneEnabled.resize(caps.maxClipPlanes, false); + + mClipPlanes.resize(caps.maxClipPlanes, angle::Vector4(0.0f, 0.0f, 0.0f, 0.0f)); + + mPointParameters.pointSizeMin = 0.1f; + mPointParameters.pointSizeMax = 100.0f; + mPointParameters.pointFadeThresholdSize = 0.1f; + mPointParameters.pointDistanceAttenuation[0] = 1.0f; + mPointParameters.pointDistanceAttenuation[1] = 0.0f; + mPointParameters.pointDistanceAttenuation[2] = 0.0f; + + mPointParameters.pointSize = 1.0f; + + mLineSmoothHint = HintSetting::DontCare; + mPointSmoothHint = HintSetting::DontCare; + mPerspectiveCorrectionHint = HintSetting::DontCare; + mFogHint = HintSetting::DontCare; +} + +void GLES1State::setAlphaFunc(AlphaTestFunc func, GLfloat ref) +{ + mAlphaTestFunc = func; + mAlphaTestRef = ref; +} + +void GLES1State::setClientTextureUnit(unsigned int unit) +{ + mClientActiveTexture = unit; +} + +unsigned int GLES1State::getClientTextureUnit() const +{ + return mClientActiveTexture; +} + +void GLES1State::setCurrentColor(const ColorF &color) +{ + mCurrentColor = color; +} + +const ColorF &GLES1State::getCurrentColor() const +{ + return mCurrentColor; +} + +void GLES1State::setCurrentNormal(const angle::Vector3 &normal) +{ + mCurrentNormal = normal; +} + +const angle::Vector3 &GLES1State::getCurrentNormal() const +{ + return mCurrentNormal; +} + +void GLES1State::setCurrentTextureCoords(unsigned int unit, const TextureCoordF &coords) +{ + mCurrentTextureCoords[unit] = coords; +} + +const TextureCoordF &GLES1State::getCurrentTextureCoords(unsigned int unit) const +{ + return mCurrentTextureCoords[unit]; +} + +void GLES1State::setMatrixMode(MatrixType mode) +{ + mMatrixMode = mode; +} + +MatrixType GLES1State::getMatrixMode() const +{ + return mMatrixMode; +} + +void GLES1State::pushMatrix() +{ + auto &stack = currentMatrixStack(); + stack.push_back(stack.back()); +} + +void GLES1State::popMatrix() +{ + auto &stack = currentMatrixStack(); + stack.pop_back(); +} + +GLES1State::MatrixStack &GLES1State::currentMatrixStack() +{ + switch (mMatrixMode) + { + case MatrixType::Modelview: + return mModelviewMatrices; + case MatrixType::Projection: + return mProjectionMatrices; + case MatrixType::Texture: + return mTextureMatrices[mGLState->getActiveSampler()]; + default: + UNREACHABLE(); + return mModelviewMatrices; + } +} + +const GLES1State::MatrixStack &GLES1State::currentMatrixStack() const +{ + switch (mMatrixMode) + { + case MatrixType::Modelview: + return mModelviewMatrices; + case MatrixType::Projection: + return mProjectionMatrices; + case MatrixType::Texture: + return mTextureMatrices[mGLState->getActiveSampler()]; + default: + UNREACHABLE(); + return mModelviewMatrices; + } +} + +void GLES1State::loadMatrix(const angle::Mat4 &m) +{ + currentMatrixStack().back() = m; +} + +void GLES1State::multMatrix(const angle::Mat4 &m) +{ + angle::Mat4 currentMatrix = currentMatrixStack().back(); + currentMatrixStack().back() = currentMatrix.product(m); +} + +} // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/GLES1State.h b/gfx/angle/checkout/src/libANGLE/GLES1State.h new file mode 100644 index 000000000000..b9582b1c6df7 --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/GLES1State.h @@ -0,0 +1,239 @@ +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// GLES1State.h: Defines the GLES1State class holding the state of +// a GLES1 context. + +#ifndef LIBANGLE_GLES1STATE_H_ +#define LIBANGLE_GLES1STATE_H_ + +#include + +#include "common/FixedVector.h" +#include "common/angleutils.h" +#include "common/matrix_utils.h" +#include "common/vector_utils.h" +#include "libANGLE/Caps.h" +#include "libANGLE/angletypes.h" + +namespace gl +{ + +// State types specific to GLES1 contexts, from the OpenGL ES 1.1 spec "State Tables" section +struct TextureCoordF +{ + TextureCoordF(); + TextureCoordF(float _s, float _t, float _r, float _q); + bool operator==(const TextureCoordF &other) const; + + GLfloat s = 0.0f; + GLfloat t = 0.0f; + GLfloat r = 0.0f; + GLfloat q = 0.0f; +}; + +struct MaterialParameters +{ + ColorF ambient; + ColorF diffuse; + ColorF specular; + ColorF emissive; + GLfloat specularExponent; +}; + +struct LightModelParameters +{ + ColorF color; + bool twoSided; +}; + +struct LightParameters +{ + bool enabled = false; + ColorF ambient = {0.0f, 0.0f, 0.0f, 1.0f}; + ColorF diffuse = {0.0f, 0.0f, 0.0f, 1.0f}; + ColorF specular = {0.0f, 0.0f, 0.0f, 1.0f}; + angle::Vector4 position = {0.0f, 0.0f, 1.0f, 0.0f}; + angle::Vector3 direction = {0.0f, 0.0f, -1.0f}; + GLfloat spotlightExponent = 0.0f; + GLfloat spotlightCutoffAngle = 180.0f; + GLfloat attenuationConst = 1.0f; + GLfloat attenuationLinear = 0.0f; + GLfloat attenuationQuadratic = 0.0f; +}; + +struct FogParameters +{ + FogMode mode; + GLfloat density; + GLfloat start; + GLfloat end; + ColorF color; +}; + +struct TextureEnvironmentParameters +{ + TextureEnvMode envMode = TextureEnvMode::Modulate; + TextureCombine combineRgb = TextureCombine::Modulate; + TextureCombine combineAlpha = TextureCombine::Modulate; + + TextureSrc src0rgb = TextureSrc::Texture; + TextureSrc src0alpha = TextureSrc::Texture; + + TextureSrc src1rgb = TextureSrc::Previous; + TextureSrc src1alpha = TextureSrc::Previous; + + TextureSrc src2rgb = TextureSrc::Constant; + TextureSrc src2alpha = TextureSrc::Constant; + + TextureOp op0rgb = TextureOp::SrcColor; + TextureOp op0alpha = TextureOp::SrcAlpha; + + TextureOp op1rgb = TextureOp::SrcColor; + TextureOp op1alpha = TextureOp::SrcAlpha; + + TextureOp op2rgb = TextureOp::SrcAlpha; + TextureOp op2alpha = TextureOp::SrcAlpha; + + ColorF envColor = {0.0f, 0.0f, 0.0f, 0.0f}; + GLfloat rgbScale = 1.0f; + GLfloat alphaScale = 1.0f; + + bool pointSpriteCoordReplace = false; +}; + +struct PointParameters +{ + GLfloat pointSizeMin; + GLfloat pointSizeMax; + GLfloat pointFadeThresholdSize; + angle::Vector3 pointDistanceAttenuation; + GLfloat pointSize; +}; + +class Context; +class State; +class GLES1State final : angle::NonCopyable +{ + public: + GLES1State(); + ~GLES1State(); + + void initialize(const Context *context, const State *state); + + void setAlphaFunc(AlphaTestFunc func, GLfloat ref); + void setClientTextureUnit(unsigned int unit); + unsigned int getClientTextureUnit() const; + + void setCurrentColor(const ColorF &color); + const ColorF &getCurrentColor() const; + + void setCurrentNormal(const angle::Vector3 &normal); + const angle::Vector3 &getCurrentNormal() const; + + void setCurrentTextureCoords(unsigned int unit, const TextureCoordF &coords); + const TextureCoordF &getCurrentTextureCoords(unsigned int unit) const; + + void setMatrixMode(MatrixType mode); + MatrixType getMatrixMode() const; + + void pushMatrix(); + void popMatrix(); + + using MatrixStack = angle::FixedVector; + MatrixStack ¤tMatrixStack(); + const MatrixStack ¤tMatrixStack() const; + + void loadMatrix(const angle::Mat4 &m); + void multMatrix(const angle::Mat4 &m); + + private: + friend class State; + + // Back pointer for reading from State. + const State *mGLState; + + // All initial state values come from the + // OpenGL ES 1.1 spec. + struct TextureEnables + { + bool enable2D = false; + bool enableCubeMap = false; + }; + std::vector mTexUnitEnables; + + // Table 6.4, 6.5 (IsEnabled) + bool mVertexArrayEnabled; + bool mNormalArrayEnabled; + bool mColorArrayEnabled; + bool mPointSizeArrayEnabled; + std::vector mTexCoordArrayEnabled; + + // Table 6.7-6.16 (IsEnabled) + std::vector mClipPlaneEnabled; + bool mLineSmoothEnabled; + bool mPointSmoothEnabled; + bool mPointSpriteEnabled; + bool mAlphaTestEnabled; + bool mLogicOpEnabled; + bool mLightingEnabled; + bool mFogEnabled; + bool mRescaleNormalEnabled; + bool mNormalizeEnabled; + bool mColorMaterialEnabled; + bool mReflectionMapEnabled; + + // Table 6.3 + ColorF mCurrentColor; + angle::Vector3 mCurrentNormal; + // Invariant: mCurrentTextureCoords size is == GL_MAX_TEXTURE_UNITS. + std::vector mCurrentTextureCoords; + + // Table 6.4 + unsigned int mClientActiveTexture; + + // Table 6.7 + MatrixType mMatrixMode; + MatrixStack mProjectionMatrices; + MatrixStack mModelviewMatrices; + std::vector mTextureMatrices; + + // Table 6.15 + using TextureEnvironments = std::vector; + TextureEnvironments mTextureEnvironments; + + // Table 6.9, 2.8 + MaterialParameters mMaterial; + LightModelParameters mLightModel; + + // Table 6.10 + std::vector mLights; + + // Table 6.8 + FogParameters mFog; + ShadingModel mShadeModel; + + // Table 6.11 + PointParameters mPointParameters; + + // Table 6.16 + AlphaTestFunc mAlphaTestFunc; + GLfloat mAlphaTestRef; + LogicalOperation mLogicOp; + + // Table 6.7 + std::vector mClipPlanes; + + // Table 6.19 + HintSetting mLineSmoothHint; + HintSetting mPointSmoothHint; + HintSetting mPerspectiveCorrectionHint; + HintSetting mFogHint; +}; + +} // namespace gl + +#endif // LIBANGLE_GLES1STATE_H_ diff --git a/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp b/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp index 3f7443b3548a..dd664785098e 100644 --- a/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp +++ b/gfx/angle/checkout/src/libANGLE/HandleAllocator.cpp @@ -30,7 +30,8 @@ HandleAllocator::HandleAllocator() : mBaseValue(1), mNextValue(1), mLoggingEnabl mUnallocatedList.push_back(HandleRange(1, std::numeric_limits::max())); } -HandleAllocator::HandleAllocator(GLuint maximumHandleValue) : mBaseValue(1), mNextValue(1) +HandleAllocator::HandleAllocator(GLuint maximumHandleValue) + : mBaseValue(1), mNextValue(1), mLoggingEnabled(false) { mUnallocatedList.push_back(HandleRange(1, maximumHandleValue)); } diff --git a/gfx/angle/checkout/src/libANGLE/Image.cpp b/gfx/angle/checkout/src/libANGLE/Image.cpp index 04c757c2c476..e0e40b010b83 100644 --- a/gfx/angle/checkout/src/libANGLE/Image.cpp +++ b/gfx/angle/checkout/src/libANGLE/Image.cpp @@ -29,11 +29,11 @@ gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs return gl::ImageIndex::MakeInvalid(); } - GLenum target = egl_gl::EGLImageTargetToGLTextureTarget(eglTarget); + gl::TextureTarget target = egl_gl::EGLImageTargetToTextureTarget(eglTarget); GLint mip = static_cast(attribs.get(EGL_GL_TEXTURE_LEVEL_KHR, 0)); GLint layer = static_cast(attribs.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0)); - if (target == GL_TEXTURE_3D) + if (target == gl::TextureTarget::_3D) { return gl::ImageIndex::Make3D(mip, layer); } diff --git a/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp b/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp index d5cc781ba9f3..d46c0c5754af 100644 --- a/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp +++ b/gfx/angle/checkout/src/libANGLE/ImageIndex.cpp @@ -21,67 +21,67 @@ ImageIndex &ImageIndex::operator=(const ImageIndex &other) = default; bool ImageIndex::is3D() const { - return type == GL_TEXTURE_3D || type == GL_TEXTURE_2D_ARRAY; + return type == TextureType::_3D || type == TextureType::_2DArray; } GLint ImageIndex::cubeMapFaceIndex() const { - ASSERT(type == GL_TEXTURE_CUBE_MAP); - ASSERT(target >= gl::FirstCubeMapTextureTarget && target <= gl::LastCubeMapTextureTarget); - return target - gl::FirstCubeMapTextureTarget; + ASSERT(type == TextureType::CubeMap); + ASSERT(TextureTargetToType(target) == TextureType::CubeMap); + return static_cast(CubeMapTextureTargetToFaceIndex(target)); } bool ImageIndex::valid() const { - return type != GL_NONE; + return type != TextureType::InvalidEnum; } ImageIndex ImageIndex::Make2D(GLint mipIndex) { - return ImageIndex(GL_TEXTURE_2D, GL_TEXTURE_2D, mipIndex, ENTIRE_LEVEL, 1); + return ImageIndex(TextureType::_2D, TextureTarget::_2D, mipIndex, ENTIRE_LEVEL, 1); } ImageIndex ImageIndex::MakeRectangle(GLint mipIndex) { - return ImageIndex(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_RECTANGLE_ANGLE, mipIndex, - ENTIRE_LEVEL, 1); + return ImageIndex(TextureType::Rectangle, TextureTarget::Rectangle, mipIndex, ENTIRE_LEVEL, 1); } -ImageIndex ImageIndex::MakeCube(GLenum target, GLint mipIndex) +ImageIndex ImageIndex::MakeCube(TextureTarget target, GLint mipIndex) { - ASSERT(gl::IsCubeMapTextureTarget(target)); - return ImageIndex(GL_TEXTURE_CUBE_MAP, target, mipIndex, ENTIRE_LEVEL, 1); + ASSERT(TextureTargetToType(target) == TextureType::CubeMap); + return ImageIndex(TextureType::CubeMap, target, mipIndex, ENTIRE_LEVEL, 1); } ImageIndex ImageIndex::Make2DArray(GLint mipIndex, GLint layerIndex) { - return ImageIndex(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex, 1); + return ImageIndex(TextureType::_2DArray, TextureTarget::_2DArray, mipIndex, layerIndex, 1); } ImageIndex ImageIndex::Make2DArrayRange(GLint mipIndex, GLint layerIndex, GLint numLayers) { - return ImageIndex(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_2D_ARRAY, mipIndex, layerIndex, numLayers); + return ImageIndex(TextureType::_2DArray, TextureTarget::_2DArray, mipIndex, layerIndex, + numLayers); } ImageIndex ImageIndex::Make3D(GLint mipIndex, GLint layerIndex) { - return ImageIndex(GL_TEXTURE_3D, GL_TEXTURE_3D, mipIndex, layerIndex, 1); + return ImageIndex(TextureType::_3D, TextureTarget::_3D, mipIndex, layerIndex, 1); } -ImageIndex ImageIndex::MakeGeneric(GLenum target, GLint mipIndex) +ImageIndex ImageIndex::MakeGeneric(TextureTarget target, GLint mipIndex) { - GLenum textureType = IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target; - return ImageIndex(textureType, target, mipIndex, ENTIRE_LEVEL, 1); + return ImageIndex(TextureTargetToType(target), target, mipIndex, ENTIRE_LEVEL, 1); } ImageIndex ImageIndex::Make2DMultisample() { - return ImageIndex(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE, 0, ENTIRE_LEVEL, 1); + return ImageIndex(TextureType::_2DMultisample, TextureTarget::_2DMultisample, 0, ENTIRE_LEVEL, + 1); } ImageIndex ImageIndex::MakeInvalid() { - return ImageIndex(GL_NONE, GL_NONE, -1, -1, -1); + return ImageIndex(TextureType::InvalidEnum, TextureTarget::InvalidEnum, -1, -1, -1); } bool operator<(const ImageIndex &a, const ImageIndex &b) @@ -101,8 +101,8 @@ bool operator!=(const ImageIndex &a, const ImageIndex &b) return !(a == b); } -ImageIndex::ImageIndex(GLenum typeIn, - GLenum targetIn, +ImageIndex::ImageIndex(TextureType typeIn, + TextureTarget targetIn, GLint mipIndexIn, GLint layerIndexIn, GLint numLayersIn) @@ -118,32 +118,30 @@ ImageIndexIterator::ImageIndexIterator(const ImageIndexIterator &other) = defaul ImageIndexIterator ImageIndexIterator::Make2D(GLint minMip, GLint maxMip) { return ImageIndexIterator( - GL_TEXTURE_2D, Range(GL_TEXTURE_2D, GL_TEXTURE_2D), Range(minMip, maxMip), + TextureType::_2D, TextureTarget::_2D, TextureTarget::_2D, Range(minMip, maxMip), Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), nullptr); } ImageIndexIterator ImageIndexIterator::MakeRectangle(GLint minMip, GLint maxMip) { - return ImageIndexIterator(GL_TEXTURE_RECTANGLE_ANGLE, - Range(GL_TEXTURE_RECTANGLE_ANGLE, GL_TEXTURE_RECTANGLE_ANGLE), - Range(minMip, maxMip), + return ImageIndexIterator(TextureType::Rectangle, TextureTarget::Rectangle, + TextureTarget::Rectangle, Range(minMip, maxMip), Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), nullptr); } ImageIndexIterator ImageIndexIterator::MakeCube(GLint minMip, GLint maxMip) { - return ImageIndexIterator( - GL_TEXTURE_CUBE_MAP, - Range(gl::FirstCubeMapTextureTarget, gl::LastCubeMapTextureTarget), - Range(minMip, maxMip), - Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), nullptr); + return ImageIndexIterator(TextureType::CubeMap, kCubeMapTextureTargetMin, + kCubeMapTextureTargetMax, Range(minMip, maxMip), + Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), + nullptr); } ImageIndexIterator ImageIndexIterator::Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer) { - return ImageIndexIterator(GL_TEXTURE_3D, Range(GL_TEXTURE_3D, GL_TEXTURE_3D), + return ImageIndexIterator(TextureType::_3D, TextureTarget::_3D, TextureTarget::_3D, Range(minMip, maxMip), Range(minLayer, maxLayer), nullptr); } @@ -151,30 +149,45 @@ ImageIndexIterator ImageIndexIterator::Make3D(GLint minMip, GLint maxMip, ImageIndexIterator ImageIndexIterator::Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts) { - return ImageIndexIterator( - GL_TEXTURE_2D_ARRAY, Range(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_2D_ARRAY), - Range(minMip, maxMip), Range(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS), - layerCounts); + return ImageIndexIterator(TextureType::_2DArray, TextureTarget::_2DArray, + TextureTarget::_2DArray, Range(minMip, maxMip), + Range(0, IMPLEMENTATION_MAX_2D_ARRAY_TEXTURE_LAYERS), + layerCounts); } ImageIndexIterator ImageIndexIterator::Make2DMultisample() { - return ImageIndexIterator( - GL_TEXTURE_2D_MULTISAMPLE, - Range(GL_TEXTURE_2D_MULTISAMPLE, GL_TEXTURE_2D_MULTISAMPLE), Range(0, 0), - Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), nullptr); + return ImageIndexIterator(TextureType::_2DMultisample, TextureTarget::_2DMultisample, + TextureTarget::_2DMultisample, Range(0, 0), + Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), + nullptr); } -ImageIndexIterator::ImageIndexIterator(GLenum type, - const Range &targetRange, +ImageIndexIterator ImageIndexIterator::MakeGeneric(TextureType type, GLint minMip, GLint maxMip) +{ + if (type == TextureType::CubeMap) + { + return MakeCube(minMip, maxMip); + } + + TextureTarget target = NonCubeTextureTypeToTarget(type); + return ImageIndexIterator(type, target, target, Range(minMip, maxMip), + Range(ImageIndex::ENTIRE_LEVEL, ImageIndex::ENTIRE_LEVEL), + nullptr); +} + +ImageIndexIterator::ImageIndexIterator(TextureType type, + angle::EnumIterator targetLow, + angle::EnumIterator targetHigh, const Range &mipRange, const Range &layerRange, const GLsizei *layerCounts) - : mTargetRange(targetRange), + : mTargetLow(targetLow), + mTargetHigh(targetHigh), mMipRange(mipRange), mLayerRange(layerRange), mLayerCounts(layerCounts), - mCurrentIndex(type, targetRange.low(), mipRange.low(), layerRange.low(), 1) + mCurrentIndex(type, *targetLow, mipRange.low(), layerRange.low(), 1) {} GLint ImageIndexIterator::maxLayer() const @@ -198,18 +211,20 @@ ImageIndex ImageIndexIterator::next() // Iterate layers in the inner loop for now. We can add switchable // layer or mip iteration if we need it. - if (mCurrentIndex.target < mTargetRange.high()) + angle::EnumIterator currentTarget = mCurrentIndex.target; + if (currentTarget != mTargetHigh) { - mCurrentIndex.target++; + ++currentTarget; + mCurrentIndex.target = *currentTarget; } else if (mCurrentIndex.hasLayer() && mCurrentIndex.layerIndex < maxLayer() - 1) { - mCurrentIndex.target = mTargetRange.low(); + mCurrentIndex.target = *mTargetLow; mCurrentIndex.layerIndex++; } else if (mCurrentIndex.mipIndex < mMipRange.high() - 1) { - mCurrentIndex.target = mTargetRange.low(); + mCurrentIndex.target = *mTargetLow; mCurrentIndex.layerIndex = mLayerRange.low(); mCurrentIndex.mipIndex++; } diff --git a/gfx/angle/checkout/src/libANGLE/ImageIndex.h b/gfx/angle/checkout/src/libANGLE/ImageIndex.h index d06adb771008..af6fca300e2f 100644 --- a/gfx/angle/checkout/src/libANGLE/ImageIndex.h +++ b/gfx/angle/checkout/src/libANGLE/ImageIndex.h @@ -10,6 +10,7 @@ #define LIBANGLE_IMAGE_INDEX_H_ #include "common/mathutil.h" +#include "libANGLE/PackedGLEnums.h" #include "angle_gl.h" @@ -20,8 +21,8 @@ class ImageIndexIterator; struct ImageIndex { - GLenum type; - GLenum target; + TextureType type; + TextureTarget target; GLint mipIndex; @@ -38,11 +39,11 @@ struct ImageIndex static ImageIndex Make2D(GLint mipIndex); static ImageIndex MakeRectangle(GLint mipIndex); - static ImageIndex MakeCube(GLenum target, GLint mipIndex); + static ImageIndex MakeCube(TextureTarget target, GLint mipIndex); static ImageIndex Make2DArray(GLint mipIndex, GLint layerIndex); static ImageIndex Make2DArrayRange(GLint mipIndex, GLint layerIndex, GLint numLayers); static ImageIndex Make3D(GLint mipIndex, GLint layerIndex = ENTIRE_LEVEL); - static ImageIndex MakeGeneric(GLenum target, GLint mipIndex); + static ImageIndex MakeGeneric(TextureTarget target, GLint mipIndex); static ImageIndex Make2DMultisample(); static ImageIndex MakeInvalid(); @@ -52,8 +53,8 @@ struct ImageIndex private: friend class ImageIndexIterator; - ImageIndex(GLenum typeIn, - GLenum targetIn, + ImageIndex(TextureType typeIn, + TextureTarget targetIn, GLint mipIndexIn, GLint layerIndexIn, GLint numLayersIn); @@ -63,6 +64,13 @@ bool operator<(const ImageIndex &a, const ImageIndex &b); bool operator==(const ImageIndex &a, const ImageIndex &b); bool operator!=(const ImageIndex &a, const ImageIndex &b); +// To be used like this: +// +// ImageIndexIterator it = ...; +// while (it.hasNext()) +// { +// ImageIndex current = it.next(); +// } class ImageIndexIterator { public: @@ -74,21 +82,24 @@ class ImageIndexIterator static ImageIndexIterator Make3D(GLint minMip, GLint maxMip, GLint minLayer, GLint maxLayer); static ImageIndexIterator Make2DArray(GLint minMip, GLint maxMip, const GLsizei *layerCounts); static ImageIndexIterator Make2DMultisample(); + static ImageIndexIterator MakeGeneric(TextureType type, GLint minMip, GLint maxMip); ImageIndex next(); ImageIndex current() const; bool hasNext() const; private: - ImageIndexIterator(GLenum type, - const Range &targetRange, + ImageIndexIterator(TextureType type, + angle::EnumIterator targetLow, + angle::EnumIterator targetHigh, const Range &mipRange, const Range &layerRange, const GLsizei *layerCounts); GLint maxLayer() const; - const Range mTargetRange; + const angle::EnumIterator mTargetLow; + const angle::EnumIterator mTargetHigh; const Range mMipRange; const Range mLayerRange; const GLsizei *const mLayerCounts; diff --git a/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp index 89721fd7fb5d..e9340c61bb78 100644 --- a/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp +++ b/gfx/angle/checkout/src/libANGLE/MemoryProgramCache.cpp @@ -44,6 +44,7 @@ void WriteShaderVar(BinaryOutputStream *stream, const sh::ShaderVariable &var) stream->writeString(var.mappedName); stream->writeIntVector(var.arraySizes); stream->writeInt(var.staticUse); + stream->writeInt(var.active); stream->writeString(var.structName); ASSERT(var.fields.empty()); } @@ -56,6 +57,7 @@ void LoadShaderVar(BinaryInputStream *stream, sh::ShaderVariable *var) var->mappedName = stream->readString(); stream->readIntVector(&var->arraySizes); var->staticUse = stream->readBool(); + var->active = stream->readBool(); var->structName = stream->readString(); } @@ -64,9 +66,10 @@ void WriteShaderVariableBuffer(BinaryOutputStream *stream, const ShaderVariableB stream->writeInt(var.binding); stream->writeInt(var.dataSize); - stream->writeInt(var.vertexStaticUse); - stream->writeInt(var.fragmentStaticUse); - stream->writeInt(var.computeStaticUse); + for (ShaderType shaderType : AllShaderTypes()) + { + stream->writeInt(var.isActive(shaderType)); + } stream->writeInt(var.memberIndexes.size()); for (unsigned int memberCounterIndex : var.memberIndexes) @@ -79,9 +82,11 @@ void LoadShaderVariableBuffer(BinaryInputStream *stream, ShaderVariableBuffer *v { var->binding = stream->readInt(); var->dataSize = stream->readInt(); - var->vertexStaticUse = stream->readBool(); - var->fragmentStaticUse = stream->readBool(); - var->computeStaticUse = stream->readBool(); + + for (ShaderType shaderType : AllShaderTypes()) + { + var->setActive(shaderType, stream->readBool()); + } unsigned int numMembers = stream->readInt(); for (unsigned int blockMemberIndex = 0; blockMemberIndex < numMembers; blockMemberIndex++) @@ -101,9 +106,11 @@ void WriteBufferVariable(BinaryOutputStream *stream, const BufferVariable &var) stream->writeInt(var.blockInfo.isRowMajorMatrix); stream->writeInt(var.blockInfo.topLevelArrayStride); stream->writeInt(var.topLevelArraySize); - stream->writeInt(var.vertexStaticUse); - stream->writeInt(var.fragmentStaticUse); - stream->writeInt(var.computeStaticUse); + + for (ShaderType shaderType : AllShaderTypes()) + { + stream->writeInt(var.isActive(shaderType)); + } } void LoadBufferVariable(BinaryInputStream *stream, BufferVariable *var) @@ -117,9 +124,11 @@ void LoadBufferVariable(BinaryInputStream *stream, BufferVariable *var) var->blockInfo.isRowMajorMatrix = stream->readBool(); var->blockInfo.topLevelArrayStride = stream->readInt(); var->topLevelArraySize = stream->readInt(); - var->vertexStaticUse = stream->readBool(); - var->fragmentStaticUse = stream->readBool(); - var->computeStaticUse = stream->readBool(); + + for (ShaderType shaderType : AllShaderTypes()) + { + var->setActive(shaderType, stream->readBool()); + } } void WriteInterfaceBlock(BinaryOutputStream *stream, const InterfaceBlock &block) @@ -240,11 +249,11 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context, static_assert(MAX_VERTEX_ATTRIBS * 2 <= sizeof(uint32_t) * 8, "All bits of mAttributesTypeMask types and mask fit into 32 bits each"); state->mAttributesTypeMask.from_ulong(stream.readInt()); - state->mAttributesMask = stream.readInt(); + state->mAttributesMask = stream.readInt(); static_assert(MAX_VERTEX_ATTRIBS <= sizeof(unsigned long) * 8, "Too many vertex attribs for mask"); - state->mActiveAttribLocationsMask = stream.readInt(); + state->mActiveAttribLocationsMask = stream.readInt(); unsigned int attribCount = stream.readInt(); ASSERT(state->mAttributes.empty()); @@ -386,7 +395,7 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context, "All bits of mDrawBufferTypeMask and mActiveOutputVariables types and mask fit " "into 32 bits each"); state->mDrawBufferTypeMask.from_ulong(stream.readInt()); - state->mActiveOutputVariables = stream.readInt(); + state->mActiveOutputVariables = stream.readInt(); unsigned int samplerRangeLow = stream.readInt(); unsigned int samplerRangeHigh = stream.readInt(); @@ -394,7 +403,7 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context, unsigned int samplerCount = stream.readInt(); for (unsigned int samplerIndex = 0; samplerIndex < samplerCount; ++samplerIndex) { - GLenum textureType = stream.readInt(); + TextureType textureType = stream.readEnum(); size_t bindingCount = stream.readInt(); bool unreferenced = stream.readBool(); state->mSamplerBindings.emplace_back( @@ -420,8 +429,11 @@ LinkResult MemoryProgramCache::Deserialize(const Context *context, unsigned int atomicCounterRangeHigh = stream.readInt(); state->mAtomicCounterUniformRange = RangeUI(atomicCounterRangeLow, atomicCounterRangeHigh); - static_assert(SHADER_TYPE_MAX <= sizeof(unsigned long) * 8, "Too many shader types"); - state->mLinkedShaderStages = stream.readInt(); + static_assert(static_cast(ShaderType::EnumCount) <= sizeof(unsigned long) * 8, + "Too many shader types"); + state->mLinkedShaderStages = stream.readInt(); + + state->updateTransformFeedbackStrides(); return program->getImplementation()->load(context, infoLog, &stream); } @@ -577,7 +589,7 @@ void MemoryProgramCache::Serialize(const Context *context, stream.writeInt(state.getSamplerBindings().size()); for (const auto &samplerBinding : state.getSamplerBindings()) { - stream.writeInt(samplerBinding.textureType); + stream.writeEnum(samplerBinding.textureType); stream.writeInt(samplerBinding.boundTextureUnits.size()); stream.writeInt(samplerBinding.unreferenced); } @@ -612,14 +624,12 @@ void MemoryProgramCache::ComputeHash(const Context *context, const Program *program, ProgramHash *hashOut) { - const Shader *vertexShader = program->getAttachedVertexShader(); - const Shader *fragmentShader = program->getAttachedFragmentShader(); - const Shader *computeShader = program->getAttachedComputeShader(); - const Shader *geometryShader = program->getAttachedGeometryShader(); - // Compute the program hash. Start with the shader hashes and resource strings. HashStream hashStream; - hashStream << vertexShader << fragmentShader << computeShader << geometryShader; + for (ShaderType shaderType : AllShaderTypes()) + { + hashStream << program->getAttachedShader(shaderType); + } // Add some ANGLE metadata and Context properties, such as version and back-end. hashStream << ANGLE_COMMIT_HASH << context->getClientMajorVersion() diff --git a/gfx/angle/checkout/src/libANGLE/signal_utils.cpp b/gfx/angle/checkout/src/libANGLE/Observer.cpp similarity index 52% rename from gfx/angle/checkout/src/libANGLE/signal_utils.cpp rename to gfx/angle/checkout/src/libANGLE/Observer.cpp index acf1760f7eae..a9a3b3adca17 100644 --- a/gfx/angle/checkout/src/libANGLE/signal_utils.cpp +++ b/gfx/angle/checkout/src/libANGLE/Observer.cpp @@ -3,14 +3,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// signal_utils: +// Observer: // Implements the Observer pattern for sending state change notifications // from Subject objects to dependent Observer objects. // // See design document: // https://docs.google.com/document/d/15Edfotqg6_l1skTEL8ADQudF_oIdNa7i8Po43k6jMd4/ -#include "libANGLE/signal_utils.h" +#include "libANGLE/Observer.h" #include @@ -18,6 +18,15 @@ namespace angle { +namespace +{ +template +bool IsInContainer(const HaystackT &haystack, const NeedleT &needle) +{ + return std::find(haystack.begin(), haystack.end(), needle) != haystack.end(); +} +} // anonymous namespace + // Observer implementation. ObserverInterface::~ObserverInterface() = default; @@ -33,28 +42,57 @@ Subject::~Subject() bool Subject::hasObservers() const { - return !mObservers.empty(); + return !mFastObservers.empty(); } void Subject::addObserver(ObserverBinding *observer) { - ASSERT(std::find(mObservers.begin(), mObservers.end(), observer) == mObservers.end()); - mObservers.push_back(observer); + ASSERT(!IsInContainer(mFastObservers, observer) && !IsInContainer(mSlowObservers, observer)); + + if (!mFastObservers.full()) + { + mFastObservers.push_back(observer); + } + else + { + mSlowObservers.push_back(observer); + } } void Subject::removeObserver(ObserverBinding *observer) { - auto iter = std::find(mObservers.begin(), mObservers.end(), observer); - ASSERT(iter != mObservers.end()); - mObservers.erase(iter); + auto iter = std::find(mFastObservers.begin(), mFastObservers.end(), observer); + if (iter != mFastObservers.end()) + { + size_t index = iter - mFastObservers.begin(); + std::swap(mFastObservers[index], mFastObservers[mFastObservers.size() - 1]); + mFastObservers.resize(mFastObservers.size() - 1); + if (!mSlowObservers.empty()) + { + mFastObservers.push_back(mSlowObservers.back()); + mSlowObservers.pop_back(); + ASSERT(mFastObservers.full()); + } + } + else + { + auto slowIter = std::find(mSlowObservers.begin(), mSlowObservers.end(), observer); + ASSERT(slowIter != mSlowObservers.end()); + mSlowObservers.erase(slowIter); + } } void Subject::onStateChange(const gl::Context *context, SubjectMessage message) const { - if (mObservers.empty()) + if (mFastObservers.empty()) return; - for (const angle::ObserverBinding *receiver : mObservers) + for (const angle::ObserverBinding *receiver : mFastObservers) + { + receiver->onStateChange(context, message); + } + + for (const angle::ObserverBinding *receiver : mSlowObservers) { receiver->onStateChange(context, message); } @@ -62,11 +100,17 @@ void Subject::onStateChange(const gl::Context *context, SubjectMessage message) void Subject::resetObservers() { - for (angle::ObserverBinding *observer : mObservers) + for (angle::ObserverBinding *observer : mFastObservers) { observer->onSubjectReset(); } - mObservers.clear(); + mFastObservers.clear(); + + for (angle::ObserverBinding *observer : mSlowObservers) + { + observer->onSubjectReset(); + } + mSlowObservers.clear(); } // ObserverBinding implementation. @@ -115,4 +159,9 @@ void ObserverBinding::onSubjectReset() { mSubject = nullptr; } + +const Subject *ObserverBinding::getSubject() const +{ + return mSubject; +} } // namespace angle diff --git a/gfx/angle/checkout/src/libANGLE/signal_utils.h b/gfx/angle/checkout/src/libANGLE/Observer.h similarity index 77% rename from gfx/angle/checkout/src/libANGLE/signal_utils.h rename to gfx/angle/checkout/src/libANGLE/Observer.h index d81d742ffc8a..146c5699b857 100644 --- a/gfx/angle/checkout/src/libANGLE/signal_utils.h +++ b/gfx/angle/checkout/src/libANGLE/Observer.h @@ -3,16 +3,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// signal_utils: +// Observer: // Implements the Observer pattern for sending state change notifications // from Subject objects to dependent Observer objects. // // See design document: // https://docs.google.com/document/d/15Edfotqg6_l1skTEL8ADQudF_oIdNa7i8Po43k6jMd4/ -#ifndef LIBANGLE_SIGNAL_UTILS_H_ -#define LIBANGLE_SIGNAL_UTILS_H_ +#ifndef LIBANGLE_OBSERVER_H_ +#define LIBANGLE_OBSERVER_H_ +#include "common/FixedVector.h" #include "common/angleutils.h" namespace gl @@ -27,7 +28,9 @@ using SubjectIndex = size_t; enum class SubjectMessage { - STATE_CHANGE, + CONTENTS_CHANGED, + STORAGE_CHANGED, + DEPENDENT_DIRTY_BITS, }; // The observing class inherits from this interface class. @@ -59,7 +62,11 @@ class Subject : NonCopyable void addObserver(ObserverBinding *observer); void removeObserver(ObserverBinding *observer); - std::vector mObservers; + // Keep a short list of observers so we can allocate/free them quickly. But since we support + // unlimited bindings, have a spill-over list of that uses dynamic allocation. + static constexpr size_t kMaxFixedObservers = 8; + angle::FixedVector mFastObservers; + std::vector mSlowObservers; }; // Keeps a binding between a Subject and Observer, with a specific subject index. @@ -76,6 +83,8 @@ class ObserverBinding final void onStateChange(const gl::Context *context, SubjectMessage message) const; void onSubjectReset(); + const Subject *getSubject() const; + private: Subject *mSubject; ObserverInterface *mObserver; @@ -84,4 +93,4 @@ class ObserverBinding final } // namespace angle -#endif // LIBANGLE_SIGNAL_UTILS_H_ +#endif // LIBANGLE_OBSERVER_H_ diff --git a/gfx/angle/checkout/src/libANGLE/PackedGLEnums.cpp b/gfx/angle/checkout/src/libANGLE/PackedGLEnums.cpp new file mode 100644 index 000000000000..675a05daf486 --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/PackedGLEnums.cpp @@ -0,0 +1,196 @@ +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// PackedGLEnums.cpp: +// Declares ANGLE-specific enums classes for GLEnum and functions operating +// on them. + +#include "libANGLE/PackedGLEnums.h" + +#include "common/utilities.h" + +namespace gl +{ + +TextureType TextureTargetToType(TextureTarget target) +{ + switch (target) + { + case TextureTarget::CubeMapNegativeX: + case TextureTarget::CubeMapNegativeY: + case TextureTarget::CubeMapNegativeZ: + case TextureTarget::CubeMapPositiveX: + case TextureTarget::CubeMapPositiveY: + case TextureTarget::CubeMapPositiveZ: + return TextureType::CubeMap; + case TextureTarget::External: + return TextureType::External; + case TextureTarget::Rectangle: + return TextureType::Rectangle; + case TextureTarget::_2D: + return TextureType::_2D; + case TextureTarget::_2DArray: + return TextureType::_2DArray; + case TextureTarget::_2DMultisample: + return TextureType::_2DMultisample; + case TextureTarget::_3D: + return TextureType::_3D; + default: + UNREACHABLE(); + return TextureType::InvalidEnum; + } +} + +TextureTarget NonCubeTextureTypeToTarget(TextureType type) +{ + switch (type) + { + case TextureType::External: + return TextureTarget::External; + case TextureType::Rectangle: + return TextureTarget::Rectangle; + case TextureType::_2D: + return TextureTarget::_2D; + case TextureType::_2DArray: + return TextureTarget::_2DArray; + case TextureType::_2DMultisample: + return TextureTarget::_2DMultisample; + case TextureType::_3D: + return TextureTarget::_3D; + default: + UNREACHABLE(); + return TextureTarget::InvalidEnum; + } +} + +// Check that we can do arithmetic on TextureTarget to convert from / to cube map faces +static_assert(static_cast(TextureTarget::CubeMapNegativeX) - + static_cast(TextureTarget::CubeMapPositiveX) == + 1u, + ""); +static_assert(static_cast(TextureTarget::CubeMapPositiveY) - + static_cast(TextureTarget::CubeMapPositiveX) == + 2u, + ""); +static_assert(static_cast(TextureTarget::CubeMapNegativeY) - + static_cast(TextureTarget::CubeMapPositiveX) == + 3u, + ""); +static_assert(static_cast(TextureTarget::CubeMapPositiveZ) - + static_cast(TextureTarget::CubeMapPositiveX) == + 4u, + ""); +static_assert(static_cast(TextureTarget::CubeMapNegativeZ) - + static_cast(TextureTarget::CubeMapPositiveX) == + 5u, + ""); + +TextureTarget CubeFaceIndexToTextureTarget(size_t face) +{ + ASSERT(face < 6u); + return static_cast(static_cast(TextureTarget::CubeMapPositiveX) + face); +} + +size_t CubeMapTextureTargetToFaceIndex(TextureTarget target) +{ + ASSERT(TextureTargetToType(target) == TextureType::CubeMap); + return static_cast(target) - static_cast(TextureTarget::CubeMapPositiveX); +} + +TextureType SamplerTypeToTextureType(GLenum samplerType) +{ + switch (samplerType) + { + case GL_SAMPLER_2D: + case GL_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_2D: + case GL_SAMPLER_2D_SHADOW: + return TextureType::_2D; + + case GL_SAMPLER_EXTERNAL_OES: + return TextureType::External; + + case GL_SAMPLER_CUBE: + case GL_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_SAMPLER_CUBE_SHADOW: + return TextureType::CubeMap; + + case GL_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: + return TextureType::_2DArray; + + case GL_SAMPLER_3D: + case GL_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_3D: + return TextureType::_3D; + + case GL_SAMPLER_2D_MULTISAMPLE: + case GL_INT_SAMPLER_2D_MULTISAMPLE: + case GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE: + return TextureType::_2DMultisample; + + case GL_SAMPLER_2D_RECT_ANGLE: + return TextureType::Rectangle; + + default: + UNREACHABLE(); + return TextureType::InvalidEnum; + } +} + +} // namespace gl + +namespace egl_gl +{ + +gl::TextureTarget EGLCubeMapTargetToCubeMapTarget(EGLenum eglTarget) +{ + ASSERT(egl::IsCubeMapTextureTarget(eglTarget)); + return gl::CubeFaceIndexToTextureTarget(egl::CubeMapTextureTargetToLayerIndex(eglTarget)); +} + +gl::TextureTarget EGLImageTargetToTextureTarget(EGLenum eglTarget) +{ + switch (eglTarget) + { + case EGL_GL_TEXTURE_2D_KHR: + return gl::TextureTarget::_2D; + + case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: + case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: + case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: + case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: + case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: + case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: + return EGLCubeMapTargetToCubeMapTarget(eglTarget); + + case EGL_GL_TEXTURE_3D_KHR: + return gl::TextureTarget::_3D; + + default: + UNREACHABLE(); + return gl::TextureTarget::InvalidEnum; + } +} + +gl::TextureType EGLTextureTargetToTextureType(EGLenum eglTarget) +{ + switch (eglTarget) + { + case EGL_TEXTURE_2D: + return gl::TextureType::_2D; + + case EGL_TEXTURE_RECTANGLE_ANGLE: + return gl::TextureType::Rectangle; + + default: + UNREACHABLE(); + return gl::TextureType::InvalidEnum; + } +} + +} // namespace egl_gl diff --git a/gfx/angle/checkout/src/libANGLE/PackedGLEnums.h b/gfx/angle/checkout/src/libANGLE/PackedGLEnums.h index c2917a494292..3559845bbe04 100644 --- a/gfx/angle/checkout/src/libANGLE/PackedGLEnums.h +++ b/gfx/angle/checkout/src/libANGLE/PackedGLEnums.h @@ -15,6 +15,8 @@ #include #include +#include + #include "common/bitset_utils.h" namespace angle @@ -131,4 +133,56 @@ using PackedEnumBitSet = BitSetT(), uint32_t, E>; } // namespace angle +namespace gl +{ + +TextureType TextureTargetToType(TextureTarget target); +TextureTarget NonCubeTextureTypeToTarget(TextureType type); + +TextureTarget CubeFaceIndexToTextureTarget(size_t face); +size_t CubeMapTextureTargetToFaceIndex(TextureTarget target); + +constexpr TextureTarget kCubeMapTextureTargetMin = TextureTarget::CubeMapPositiveX; +constexpr TextureTarget kCubeMapTextureTargetMax = TextureTarget::CubeMapNegativeZ; +constexpr TextureTarget kAfterCubeMapTextureTargetMax = + static_cast(static_cast(kCubeMapTextureTargetMax) + 1); +struct AllCubeFaceTextureTargets +{ + angle::EnumIterator begin() const { return kCubeMapTextureTargetMin; } + angle::EnumIterator end() const { return kAfterCubeMapTextureTargetMax; } +}; + +constexpr ShaderType kGLES2ShaderTypeMin = ShaderType::Vertex; +constexpr ShaderType kGLES2ShaderTypeMax = ShaderType::Fragment; +constexpr ShaderType kAfterGLES2ShaderTypeMax = + static_cast(static_cast(kGLES2ShaderTypeMax) + 1); +struct AllGLES2ShaderTypes +{ + angle::EnumIterator begin() const { return kGLES2ShaderTypeMin; } + angle::EnumIterator end() const { return kAfterGLES2ShaderTypeMax; } +}; + +constexpr ShaderType kShaderTypeMin = ShaderType::Vertex; +constexpr ShaderType kShaderTypeMax = ShaderType::Compute; +constexpr ShaderType kAfterShaderTypeMax = + static_cast(static_cast(kShaderTypeMax) + 1); +struct AllShaderTypes +{ + angle::EnumIterator begin() const { return kShaderTypeMin; } + angle::EnumIterator end() const { return kAfterShaderTypeMax; } +}; + +using ShaderBitSet = angle::PackedEnumBitSet; + +TextureType SamplerTypeToTextureType(GLenum samplerType); + +} // namespace gl + +namespace egl_gl +{ +gl::TextureTarget EGLCubeMapTargetToCubeMapTarget(EGLenum eglTarget); +gl::TextureTarget EGLImageTargetToTextureTarget(EGLenum eglTarget); +gl::TextureType EGLTextureTargetToTextureType(EGLenum eglTarget); +} // namespace egl_gl + #endif // LIBANGLE_PACKEDGLENUMS_H_ diff --git a/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.cpp b/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.cpp index b58f63c57205..81f2c8d4a80d 100644 --- a/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.cpp +++ b/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.cpp @@ -15,6 +15,58 @@ namespace gl { +template <> +AlphaTestFunc FromGLenum(GLenum from) +{ + switch (from) + { + case GL_ALWAYS: + return AlphaTestFunc::AlwaysPass; + case GL_EQUAL: + return AlphaTestFunc::Equal; + case GL_GEQUAL: + return AlphaTestFunc::Gequal; + case GL_GREATER: + return AlphaTestFunc::Greater; + case GL_LEQUAL: + return AlphaTestFunc::Lequal; + case GL_LESS: + return AlphaTestFunc::Less; + case GL_NEVER: + return AlphaTestFunc::Never; + case GL_NOTEQUAL: + return AlphaTestFunc::NotEqual; + default: + return AlphaTestFunc::InvalidEnum; + } +} + +GLenum ToGLenum(AlphaTestFunc from) +{ + switch (from) + { + case AlphaTestFunc::AlwaysPass: + return GL_ALWAYS; + case AlphaTestFunc::Equal: + return GL_EQUAL; + case AlphaTestFunc::Gequal: + return GL_GEQUAL; + case AlphaTestFunc::Greater: + return GL_GREATER; + case AlphaTestFunc::Lequal: + return GL_LEQUAL; + case AlphaTestFunc::Less: + return GL_LESS; + case AlphaTestFunc::Never: + return GL_NEVER; + case AlphaTestFunc::NotEqual: + return GL_NOTEQUAL; + default: + UNREACHABLE(); + return GL_NONE; + } +} + template <> BufferBinding FromGLenum(GLenum from) { @@ -171,4 +223,572 @@ GLenum ToGLenum(CullFaceMode from) } } +template <> +FogMode FromGLenum(GLenum from) +{ + switch (from) + { + case GL_EXP: + return FogMode::Exp; + case GL_EXP2: + return FogMode::Exp2; + case GL_LINEAR: + return FogMode::Linear; + default: + return FogMode::InvalidEnum; + } +} + +GLenum ToGLenum(FogMode from) +{ + switch (from) + { + case FogMode::Exp: + return GL_EXP; + case FogMode::Exp2: + return GL_EXP2; + case FogMode::Linear: + return GL_LINEAR; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +HintSetting FromGLenum(GLenum from) +{ + switch (from) + { + case GL_DONT_CARE: + return HintSetting::DontCare; + case GL_FASTEST: + return HintSetting::Fastest; + case GL_NICEST: + return HintSetting::Nicest; + default: + return HintSetting::InvalidEnum; + } +} + +GLenum ToGLenum(HintSetting from) +{ + switch (from) + { + case HintSetting::DontCare: + return GL_DONT_CARE; + case HintSetting::Fastest: + return GL_FASTEST; + case HintSetting::Nicest: + return GL_NICEST; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +LogicalOperation FromGLenum(GLenum from) +{ + switch (from) + { + case GL_AND: + return LogicalOperation::And; + case GL_AND_INVERTED: + return LogicalOperation::AndInverted; + case GL_AND_REVERSE: + return LogicalOperation::AndReverse; + case GL_CLEAR: + return LogicalOperation::Clear; + case GL_COPY: + return LogicalOperation::Copy; + case GL_COPY_INVERTED: + return LogicalOperation::CopyInverted; + case GL_EQUIV: + return LogicalOperation::Equiv; + case GL_INVERT: + return LogicalOperation::Invert; + case GL_NAND: + return LogicalOperation::Nand; + case GL_NOOP: + return LogicalOperation::Noop; + case GL_NOR: + return LogicalOperation::Nor; + case GL_OR: + return LogicalOperation::Or; + case GL_OR_INVERTED: + return LogicalOperation::OrInverted; + case GL_OR_REVERSE: + return LogicalOperation::OrReverse; + case GL_SET: + return LogicalOperation::Set; + case GL_XOR: + return LogicalOperation::Xor; + default: + return LogicalOperation::InvalidEnum; + } +} + +GLenum ToGLenum(LogicalOperation from) +{ + switch (from) + { + case LogicalOperation::And: + return GL_AND; + case LogicalOperation::AndInverted: + return GL_AND_INVERTED; + case LogicalOperation::AndReverse: + return GL_AND_REVERSE; + case LogicalOperation::Clear: + return GL_CLEAR; + case LogicalOperation::Copy: + return GL_COPY; + case LogicalOperation::CopyInverted: + return GL_COPY_INVERTED; + case LogicalOperation::Equiv: + return GL_EQUIV; + case LogicalOperation::Invert: + return GL_INVERT; + case LogicalOperation::Nand: + return GL_NAND; + case LogicalOperation::Noop: + return GL_NOOP; + case LogicalOperation::Nor: + return GL_NOR; + case LogicalOperation::Or: + return GL_OR; + case LogicalOperation::OrInverted: + return GL_OR_INVERTED; + case LogicalOperation::OrReverse: + return GL_OR_REVERSE; + case LogicalOperation::Set: + return GL_SET; + case LogicalOperation::Xor: + return GL_XOR; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +MatrixType FromGLenum(GLenum from) +{ + switch (from) + { + case GL_MODELVIEW: + return MatrixType::Modelview; + case GL_PROJECTION: + return MatrixType::Projection; + case GL_TEXTURE: + return MatrixType::Texture; + default: + return MatrixType::InvalidEnum; + } +} + +GLenum ToGLenum(MatrixType from) +{ + switch (from) + { + case MatrixType::Modelview: + return GL_MODELVIEW; + case MatrixType::Projection: + return GL_PROJECTION; + case MatrixType::Texture: + return GL_TEXTURE; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +ShaderType FromGLenum(GLenum from) +{ + switch (from) + { + case GL_VERTEX_SHADER: + return ShaderType::Vertex; + case GL_FRAGMENT_SHADER: + return ShaderType::Fragment; + case GL_GEOMETRY_SHADER_EXT: + return ShaderType::Geometry; + case GL_COMPUTE_SHADER: + return ShaderType::Compute; + default: + return ShaderType::InvalidEnum; + } +} + +GLenum ToGLenum(ShaderType from) +{ + switch (from) + { + case ShaderType::Vertex: + return GL_VERTEX_SHADER; + case ShaderType::Fragment: + return GL_FRAGMENT_SHADER; + case ShaderType::Geometry: + return GL_GEOMETRY_SHADER_EXT; + case ShaderType::Compute: + return GL_COMPUTE_SHADER; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +ShadingModel FromGLenum(GLenum from) +{ + switch (from) + { + case GL_FLAT: + return ShadingModel::Flat; + case GL_SMOOTH: + return ShadingModel::Smooth; + default: + return ShadingModel::InvalidEnum; + } +} + +GLenum ToGLenum(ShadingModel from) +{ + switch (from) + { + case ShadingModel::Flat: + return GL_FLAT; + case ShadingModel::Smooth: + return GL_SMOOTH; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureCombine FromGLenum(GLenum from) +{ + switch (from) + { + case GL_ADD: + return TextureCombine::Add; + case GL_ADD_SIGNED: + return TextureCombine::AddSigned; + case GL_DOT3_RGB: + return TextureCombine::Dot3Rgb; + case GL_DOT3_RGBA: + return TextureCombine::Dot3Rgba; + case GL_INTERPOLATE: + return TextureCombine::Interpolate; + case GL_MODULATE: + return TextureCombine::Modulate; + case GL_REPLACE: + return TextureCombine::Replace; + case GL_SUBTRACT: + return TextureCombine::Subtract; + default: + return TextureCombine::InvalidEnum; + } +} + +GLenum ToGLenum(TextureCombine from) +{ + switch (from) + { + case TextureCombine::Add: + return GL_ADD; + case TextureCombine::AddSigned: + return GL_ADD_SIGNED; + case TextureCombine::Dot3Rgb: + return GL_DOT3_RGB; + case TextureCombine::Dot3Rgba: + return GL_DOT3_RGBA; + case TextureCombine::Interpolate: + return GL_INTERPOLATE; + case TextureCombine::Modulate: + return GL_MODULATE; + case TextureCombine::Replace: + return GL_REPLACE; + case TextureCombine::Subtract: + return GL_SUBTRACT; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureEnvMode FromGLenum(GLenum from) +{ + switch (from) + { + case GL_ADD: + return TextureEnvMode::Add; + case GL_BLEND: + return TextureEnvMode::Blend; + case GL_COMBINE: + return TextureEnvMode::Combine; + case GL_DECAL: + return TextureEnvMode::Decal; + case GL_MODULATE: + return TextureEnvMode::Modulate; + case GL_REPLACE: + return TextureEnvMode::Replace; + default: + return TextureEnvMode::InvalidEnum; + } +} + +GLenum ToGLenum(TextureEnvMode from) +{ + switch (from) + { + case TextureEnvMode::Add: + return GL_ADD; + case TextureEnvMode::Blend: + return GL_BLEND; + case TextureEnvMode::Combine: + return GL_COMBINE; + case TextureEnvMode::Decal: + return GL_DECAL; + case TextureEnvMode::Modulate: + return GL_MODULATE; + case TextureEnvMode::Replace: + return GL_REPLACE; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureOp FromGLenum(GLenum from) +{ + switch (from) + { + case GL_ONE_MINUS_SRC_ALPHA: + return TextureOp::OneMinusSrcAlpha; + case GL_ONE_MINUS_SRC_COLOR: + return TextureOp::OneMinusSrcColor; + case GL_SRC_ALPHA: + return TextureOp::SrcAlpha; + case GL_SRC_COLOR: + return TextureOp::SrcColor; + default: + return TextureOp::InvalidEnum; + } +} + +GLenum ToGLenum(TextureOp from) +{ + switch (from) + { + case TextureOp::OneMinusSrcAlpha: + return GL_ONE_MINUS_SRC_ALPHA; + case TextureOp::OneMinusSrcColor: + return GL_ONE_MINUS_SRC_COLOR; + case TextureOp::SrcAlpha: + return GL_SRC_ALPHA; + case TextureOp::SrcColor: + return GL_SRC_COLOR; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureSrc FromGLenum(GLenum from) +{ + switch (from) + { + case GL_CONSTANT: + return TextureSrc::Constant; + case GL_PREVIOUS: + return TextureSrc::Previous; + case GL_PRIMARY_COLOR: + return TextureSrc::PrimaryColor; + case GL_TEXTURE: + return TextureSrc::Texture; + default: + return TextureSrc::InvalidEnum; + } +} + +GLenum ToGLenum(TextureSrc from) +{ + switch (from) + { + case TextureSrc::Constant: + return GL_CONSTANT; + case TextureSrc::Previous: + return GL_PREVIOUS; + case TextureSrc::PrimaryColor: + return GL_PRIMARY_COLOR; + case TextureSrc::Texture: + return GL_TEXTURE; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureTarget FromGLenum(GLenum from) +{ + switch (from) + { + case GL_TEXTURE_2D: + return TextureTarget::_2D; + case GL_TEXTURE_2D_ARRAY: + return TextureTarget::_2DArray; + case GL_TEXTURE_2D_MULTISAMPLE: + return TextureTarget::_2DMultisample; + case GL_TEXTURE_3D: + return TextureTarget::_3D; + case GL_TEXTURE_EXTERNAL_OES: + return TextureTarget::External; + case GL_TEXTURE_RECTANGLE_ANGLE: + return TextureTarget::Rectangle; + case GL_TEXTURE_CUBE_MAP_POSITIVE_X: + return TextureTarget::CubeMapPositiveX; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: + return TextureTarget::CubeMapNegativeX; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: + return TextureTarget::CubeMapPositiveY; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: + return TextureTarget::CubeMapNegativeY; + case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: + return TextureTarget::CubeMapPositiveZ; + case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + return TextureTarget::CubeMapNegativeZ; + default: + return TextureTarget::InvalidEnum; + } +} + +GLenum ToGLenum(TextureTarget from) +{ + switch (from) + { + case TextureTarget::_2D: + return GL_TEXTURE_2D; + case TextureTarget::_2DArray: + return GL_TEXTURE_2D_ARRAY; + case TextureTarget::_2DMultisample: + return GL_TEXTURE_2D_MULTISAMPLE; + case TextureTarget::_3D: + return GL_TEXTURE_3D; + case TextureTarget::External: + return GL_TEXTURE_EXTERNAL_OES; + case TextureTarget::Rectangle: + return GL_TEXTURE_RECTANGLE_ANGLE; + case TextureTarget::CubeMapPositiveX: + return GL_TEXTURE_CUBE_MAP_POSITIVE_X; + case TextureTarget::CubeMapNegativeX: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_X; + case TextureTarget::CubeMapPositiveY: + return GL_TEXTURE_CUBE_MAP_POSITIVE_Y; + case TextureTarget::CubeMapNegativeY: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; + case TextureTarget::CubeMapPositiveZ: + return GL_TEXTURE_CUBE_MAP_POSITIVE_Z; + case TextureTarget::CubeMapNegativeZ: + return GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +TextureType FromGLenum(GLenum from) +{ + switch (from) + { + case GL_TEXTURE_2D: + return TextureType::_2D; + case GL_TEXTURE_2D_ARRAY: + return TextureType::_2DArray; + case GL_TEXTURE_2D_MULTISAMPLE: + return TextureType::_2DMultisample; + case GL_TEXTURE_3D: + return TextureType::_3D; + case GL_TEXTURE_EXTERNAL_OES: + return TextureType::External; + case GL_TEXTURE_RECTANGLE_ANGLE: + return TextureType::Rectangle; + case GL_TEXTURE_CUBE_MAP: + return TextureType::CubeMap; + default: + return TextureType::InvalidEnum; + } +} + +GLenum ToGLenum(TextureType from) +{ + switch (from) + { + case TextureType::_2D: + return GL_TEXTURE_2D; + case TextureType::_2DArray: + return GL_TEXTURE_2D_ARRAY; + case TextureType::_2DMultisample: + return GL_TEXTURE_2D_MULTISAMPLE; + case TextureType::_3D: + return GL_TEXTURE_3D; + case TextureType::External: + return GL_TEXTURE_EXTERNAL_OES; + case TextureType::Rectangle: + return GL_TEXTURE_RECTANGLE_ANGLE; + case TextureType::CubeMap: + return GL_TEXTURE_CUBE_MAP; + default: + UNREACHABLE(); + return GL_NONE; + } +} + +template <> +VertexArrayType FromGLenum(GLenum from) +{ + switch (from) + { + case GL_COLOR_ARRAY: + return VertexArrayType::Color; + case GL_NORMAL_ARRAY: + return VertexArrayType::Normal; + case GL_POINT_SIZE_ARRAY_OES: + return VertexArrayType::PointSize; + case GL_TEXTURE_COORD_ARRAY: + return VertexArrayType::TextureCoord; + case GL_VERTEX_ARRAY: + return VertexArrayType::Vertex; + default: + return VertexArrayType::InvalidEnum; + } +} + +GLenum ToGLenum(VertexArrayType from) +{ + switch (from) + { + case VertexArrayType::Color: + return GL_COLOR_ARRAY; + case VertexArrayType::Normal: + return GL_NORMAL_ARRAY; + case VertexArrayType::PointSize: + return GL_POINT_SIZE_ARRAY_OES; + case VertexArrayType::TextureCoord: + return GL_TEXTURE_COORD_ARRAY; + case VertexArrayType::Vertex: + return GL_VERTEX_ARRAY; + default: + UNREACHABLE(); + return GL_NONE; + } +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.h b/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.h index a67fac28e3e1..79d263abcf09 100644 --- a/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.h +++ b/gfx/angle/checkout/src/libANGLE/PackedGLEnums_autogen.h @@ -22,6 +22,25 @@ namespace gl template Enum FromGLenum(GLenum from); +enum class AlphaTestFunc : uint8_t +{ + AlwaysPass = 0, + Equal = 1, + Gequal = 2, + Greater = 3, + Lequal = 4, + Less = 5, + Never = 6, + NotEqual = 7, + + InvalidEnum = 8, + EnumCount = 8, +}; + +template <> +AlphaTestFunc FromGLenum(GLenum from); +GLenum ToGLenum(AlphaTestFunc from); + enum class BufferBinding : uint8_t { Array = 0, @@ -79,6 +98,226 @@ template <> CullFaceMode FromGLenum(GLenum from); GLenum ToGLenum(CullFaceMode from); +enum class FogMode : uint8_t +{ + Exp = 0, + Exp2 = 1, + Linear = 2, + + InvalidEnum = 3, + EnumCount = 3, +}; + +template <> +FogMode FromGLenum(GLenum from); +GLenum ToGLenum(FogMode from); + +enum class HintSetting : uint8_t +{ + DontCare = 0, + Fastest = 1, + Nicest = 2, + + InvalidEnum = 3, + EnumCount = 3, +}; + +template <> +HintSetting FromGLenum(GLenum from); +GLenum ToGLenum(HintSetting from); + +enum class LogicalOperation : uint8_t +{ + And = 0, + AndInverted = 1, + AndReverse = 2, + Clear = 3, + Copy = 4, + CopyInverted = 5, + Equiv = 6, + Invert = 7, + Nand = 8, + Noop = 9, + Nor = 10, + Or = 11, + OrInverted = 12, + OrReverse = 13, + Set = 14, + Xor = 15, + + InvalidEnum = 16, + EnumCount = 16, +}; + +template <> +LogicalOperation FromGLenum(GLenum from); +GLenum ToGLenum(LogicalOperation from); + +enum class MatrixType : uint8_t +{ + Modelview = 0, + Projection = 1, + Texture = 2, + + InvalidEnum = 3, + EnumCount = 3, +}; + +template <> +MatrixType FromGLenum(GLenum from); +GLenum ToGLenum(MatrixType from); + +enum class ShaderType : uint8_t +{ + Vertex = 0, + Fragment = 1, + Geometry = 2, + Compute = 3, + + InvalidEnum = 4, + EnumCount = 4, +}; + +template <> +ShaderType FromGLenum(GLenum from); +GLenum ToGLenum(ShaderType from); + +enum class ShadingModel : uint8_t +{ + Flat = 0, + Smooth = 1, + + InvalidEnum = 2, + EnumCount = 2, +}; + +template <> +ShadingModel FromGLenum(GLenum from); +GLenum ToGLenum(ShadingModel from); + +enum class TextureCombine : uint8_t +{ + Add = 0, + AddSigned = 1, + Dot3Rgb = 2, + Dot3Rgba = 3, + Interpolate = 4, + Modulate = 5, + Replace = 6, + Subtract = 7, + + InvalidEnum = 8, + EnumCount = 8, +}; + +template <> +TextureCombine FromGLenum(GLenum from); +GLenum ToGLenum(TextureCombine from); + +enum class TextureEnvMode : uint8_t +{ + Add = 0, + Blend = 1, + Combine = 2, + Decal = 3, + Modulate = 4, + Replace = 5, + + InvalidEnum = 6, + EnumCount = 6, +}; + +template <> +TextureEnvMode FromGLenum(GLenum from); +GLenum ToGLenum(TextureEnvMode from); + +enum class TextureOp : uint8_t +{ + OneMinusSrcAlpha = 0, + OneMinusSrcColor = 1, + SrcAlpha = 2, + SrcColor = 3, + + InvalidEnum = 4, + EnumCount = 4, +}; + +template <> +TextureOp FromGLenum(GLenum from); +GLenum ToGLenum(TextureOp from); + +enum class TextureSrc : uint8_t +{ + Constant = 0, + Previous = 1, + PrimaryColor = 2, + Texture = 3, + + InvalidEnum = 4, + EnumCount = 4, +}; + +template <> +TextureSrc FromGLenum(GLenum from); +GLenum ToGLenum(TextureSrc from); + +enum class TextureTarget : uint8_t +{ + _2D = 0, + _2DArray = 1, + _2DMultisample = 2, + _3D = 3, + External = 4, + Rectangle = 5, + CubeMapPositiveX = 6, + CubeMapNegativeX = 7, + CubeMapPositiveY = 8, + CubeMapNegativeY = 9, + CubeMapPositiveZ = 10, + CubeMapNegativeZ = 11, + + InvalidEnum = 12, + EnumCount = 12, +}; + +template <> +TextureTarget FromGLenum(GLenum from); +GLenum ToGLenum(TextureTarget from); + +enum class TextureType : uint8_t +{ + _2D = 0, + _2DArray = 1, + _2DMultisample = 2, + _3D = 3, + External = 4, + Rectangle = 5, + CubeMap = 6, + + InvalidEnum = 7, + EnumCount = 7, +}; + +template <> +TextureType FromGLenum(GLenum from); +GLenum ToGLenum(TextureType from); + +enum class VertexArrayType : uint8_t +{ + Color = 0, + Normal = 1, + PointSize = 2, + TextureCoord = 3, + Vertex = 4, + + InvalidEnum = 5, + EnumCount = 5, +}; + +template <> +VertexArrayType FromGLenum(GLenum from); +GLenum ToGLenum(VertexArrayType from); + } // namespace gl #endif // LIBANGLE_PACKEDGLENUMS_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/libANGLE/Program.cpp b/gfx/angle/checkout/src/libANGLE/Program.cpp index ec32a1501231..df8fa6d8d04a 100644 --- a/gfx/angle/checkout/src/libANGLE/Program.cpp +++ b/gfx/angle/checkout/src/libANGLE/Program.cpp @@ -205,7 +205,7 @@ bool IncludeSameArrayElement(const std::set &nameSet, const std::st return false; } -bool validateInterfaceBlocksCount(GLuint maxInterfaceBlocks, +bool ValidateInterfaceBlocksCount(GLuint maxInterfaceBlocks, const std::vector &interfaceBlocks, const std::string &errorMessage, InfoLog &infoLog) @@ -213,7 +213,7 @@ bool validateInterfaceBlocksCount(GLuint maxInterfaceBlocks, GLuint blockCount = 0; for (const sh::InterfaceBlock &block : interfaceBlocks) { - if (block.staticUse || block.layout != sh::BLOCKLAYOUT_PACKED) + if (block.active || block.layout != sh::BLOCKLAYOUT_PACKED) { blockCount += (block.arraySize ? block.arraySize : 1); if (blockCount > maxInterfaceBlocks) @@ -277,22 +277,13 @@ void InitUniformBlockLinker(const gl::Context *context, const ProgramState &state, UniformBlockLinker *blockLinker) { - if (state.getAttachedVertexShader()) + for (ShaderType shaderType : AllShaderTypes()) { - blockLinker->addShaderBlocks(GL_VERTEX_SHADER, - &state.getAttachedVertexShader()->getUniformBlocks(context)); - } - - if (state.getAttachedFragmentShader()) - { - blockLinker->addShaderBlocks(GL_FRAGMENT_SHADER, - &state.getAttachedFragmentShader()->getUniformBlocks(context)); - } - - if (state.getAttachedComputeShader()) - { - blockLinker->addShaderBlocks(GL_COMPUTE_SHADER, - &state.getAttachedComputeShader()->getUniformBlocks(context)); + Shader *shader = state.getAttachedShader(shaderType); + if (shader) + { + blockLinker->addShaderBlocks(shaderType, &shader->getUniformBlocks(context)); + } } } @@ -300,23 +291,13 @@ void InitShaderStorageBlockLinker(const gl::Context *context, const ProgramState &state, ShaderStorageBlockLinker *blockLinker) { - if (state.getAttachedVertexShader()) + for (ShaderType shaderType : AllShaderTypes()) { - blockLinker->addShaderBlocks( - GL_VERTEX_SHADER, &state.getAttachedVertexShader()->getShaderStorageBlocks(context)); - } - - if (state.getAttachedFragmentShader()) - { - blockLinker->addShaderBlocks( - GL_FRAGMENT_SHADER, - &state.getAttachedFragmentShader()->getShaderStorageBlocks(context)); - } - - if (state.getAttachedComputeShader()) - { - blockLinker->addShaderBlocks( - GL_COMPUTE_SHADER, &state.getAttachedComputeShader()->getShaderStorageBlocks(context)); + Shader *shader = state.getAttachedShader(shaderType); + if (shader != nullptr) + { + blockLinker->addShaderBlocks(shaderType, &shader->getShaderStorageBlocks(context)); + } } } @@ -396,6 +377,142 @@ const char *GetLinkMismatchErrorString(LinkMismatchError linkError) } } +LinkMismatchError LinkValidateInterfaceBlockFields(const sh::InterfaceBlockField &blockField1, + const sh::InterfaceBlockField &blockField2, + bool webglCompatibility, + std::string *mismatchedBlockFieldName) +{ + if (blockField1.name != blockField2.name) + { + return LinkMismatchError::FIELD_NAME_MISMATCH; + } + + // If webgl, validate precision of UBO fields, otherwise don't. See Khronos bug 10287. + LinkMismatchError linkError = Program::LinkValidateVariablesBase( + blockField1, blockField2, webglCompatibility, true, mismatchedBlockFieldName); + if (linkError != LinkMismatchError::NO_MISMATCH) + { + AddParentPrefix(blockField1.name, mismatchedBlockFieldName); + return linkError; + } + + if (blockField1.isRowMajorLayout != blockField2.isRowMajorLayout) + { + AddParentPrefix(blockField1.name, mismatchedBlockFieldName); + return LinkMismatchError::MATRIX_PACKING_MISMATCH; + } + + return LinkMismatchError::NO_MISMATCH; +} + +LinkMismatchError AreMatchingInterfaceBlocks(const sh::InterfaceBlock &interfaceBlock1, + const sh::InterfaceBlock &interfaceBlock2, + bool webglCompatibility, + std::string *mismatchedBlockFieldName) +{ + // validate blocks for the same member types + if (interfaceBlock1.fields.size() != interfaceBlock2.fields.size()) + { + return LinkMismatchError::FIELD_NUMBER_MISMATCH; + } + if (interfaceBlock1.arraySize != interfaceBlock2.arraySize) + { + return LinkMismatchError::ARRAY_SIZE_MISMATCH; + } + if (interfaceBlock1.layout != interfaceBlock2.layout || + interfaceBlock1.binding != interfaceBlock2.binding) + { + return LinkMismatchError::LAYOUT_QUALIFIER_MISMATCH; + } + const unsigned int numBlockMembers = static_cast(interfaceBlock1.fields.size()); + for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++) + { + const sh::InterfaceBlockField &member1 = interfaceBlock1.fields[blockMemberIndex]; + const sh::InterfaceBlockField &member2 = interfaceBlock2.fields[blockMemberIndex]; + + LinkMismatchError linkError = LinkValidateInterfaceBlockFields( + member1, member2, webglCompatibility, mismatchedBlockFieldName); + if (linkError != LinkMismatchError::NO_MISMATCH) + { + return linkError; + } + } + return LinkMismatchError::NO_MISMATCH; +} + +bool ValidateGraphicsInterfaceBlocks(const std::vector &vertexInterfaceBlocks, + const std::vector &fragmentInterfaceBlocks, + InfoLog &infoLog, + bool webglCompatibility, + sh::BlockType blockType, + GLuint maxCombinedInterfaceBlocks) +{ + // Check that interface blocks defined in the vertex and fragment shaders are identical + typedef std::map InterfaceBlockMap; + InterfaceBlockMap linkedInterfaceBlocks; + GLuint blockCount = 0; + + for (const sh::InterfaceBlock &vertexInterfaceBlock : vertexInterfaceBlocks) + { + linkedInterfaceBlocks[vertexInterfaceBlock.name] = &vertexInterfaceBlock; + if (IsActiveInterfaceBlock(vertexInterfaceBlock)) + { + blockCount += std::max(vertexInterfaceBlock.arraySize, 1u); + } + } + + for (const sh::InterfaceBlock &fragmentInterfaceBlock : fragmentInterfaceBlocks) + { + auto entry = linkedInterfaceBlocks.find(fragmentInterfaceBlock.name); + if (entry != linkedInterfaceBlocks.end()) + { + const sh::InterfaceBlock &vertexInterfaceBlock = *(entry->second); + std::string mismatchedBlockFieldName; + LinkMismatchError linkError = + AreMatchingInterfaceBlocks(vertexInterfaceBlock, fragmentInterfaceBlock, + webglCompatibility, &mismatchedBlockFieldName); + if (linkError != LinkMismatchError::NO_MISMATCH) + { + LogLinkMismatch(infoLog, fragmentInterfaceBlock.name, "interface block", linkError, + mismatchedBlockFieldName, ShaderType::Vertex, ShaderType::Fragment); + return false; + } + } + + // [OpenGL ES 3.1] Chapter 7.6.2 Page 105: + // If a uniform block is used by multiple shader stages, each such use counts separately + // against this combined limit. + // [OpenGL ES 3.1] Chapter 7.8 Page 111: + // If a shader storage block in a program is referenced by multiple shaders, each such + // reference counts separately against this combined limit. + if (IsActiveInterfaceBlock(fragmentInterfaceBlock)) + { + blockCount += std::max(fragmentInterfaceBlock.arraySize, 1u); + } + } + + if (blockCount > maxCombinedInterfaceBlocks) + { + switch (blockType) + { + case sh::BlockType::BLOCK_UNIFORM: + infoLog << "The sum of the number of active uniform blocks exceeds " + "MAX_COMBINED_UNIFORM_BLOCKS (" + << maxCombinedInterfaceBlocks << ")."; + break; + case sh::BlockType::BLOCK_BUFFER: + infoLog << "The sum of the number of active shader storage blocks exceeds " + "MAX_COMBINED_SHADER_STORAGE_BLOCKS (" + << maxCombinedInterfaceBlocks << ")."; + break; + default: + UNREACHABLE(); + } + return false; + } + return true; +} + } // anonymous namespace const char *const g_fakepath = "C:\\fakepath"; @@ -489,8 +606,8 @@ void LogLinkMismatch(InfoLog &infoLog, const char *variableType, LinkMismatchError linkError, const std::string &mismatchedStructOrBlockFieldName, - GLenum shaderType1, - GLenum shaderType2) + ShaderType shaderType1, + ShaderType shaderType2) { std::ostringstream stream; stream << GetLinkMismatchErrorString(linkError) << "s of " << variableType << " '" @@ -507,6 +624,12 @@ void LogLinkMismatch(InfoLog &infoLog, infoLog << stream.str(); } +bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock) +{ + // Only 'packed' blocks are allowed to be considered inactive. + return interfaceBlock.active || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED; +} + // VariableLocation implementation. VariableLocation::VariableLocation() : arrayIndex(0), index(kUnused), ignored(false) { @@ -519,7 +642,7 @@ VariableLocation::VariableLocation(unsigned int arrayIndex, unsigned int index) } // SamplerBindings implementation. -SamplerBinding::SamplerBinding(GLenum textureTypeIn, size_t elementCount, bool unreferenced) +SamplerBinding::SamplerBinding(TextureType textureTypeIn, size_t elementCount, bool unreferenced) : textureType(textureTypeIn), boundTextureUnits(elementCount, 0), unreferenced(unreferenced) { } @@ -608,6 +731,24 @@ const std::string &ProgramState::getLabel() return mLabel; } +Shader *ProgramState::getAttachedShader(ShaderType shaderType) const +{ + switch (shaderType) + { + case ShaderType::Vertex: + return mAttachedVertexShader; + case ShaderType::Fragment: + return mAttachedFragmentShader; + case ShaderType::Compute: + return mAttachedComputeShader; + case ShaderType::Geometry: + return mAttachedGeometryShader; + default: + UNREACHABLE(); + return nullptr; + } +} + GLuint ProgramState::getUniformIndexFromName(const std::string &name) const { return GetResourceIndexFromName(mUniforms, name); @@ -704,7 +845,8 @@ void Program::onDestroy(const Context *context) mState.mAttachedGeometryShader = nullptr; } - mProgram->destroy(context); + // TODO(jmadill): Handle error in the Context. + ANGLE_SWALLOW_ERR(mProgram->destroy(context)); ASSERT(!mState.mAttachedVertexShader && !mState.mAttachedFragmentShader && !mState.mAttachedComputeShader && !mState.mAttachedGeometryShader); @@ -727,28 +869,28 @@ void Program::attachShader(Shader *shader) { switch (shader->getType()) { - case GL_VERTEX_SHADER: + case ShaderType::Vertex: { ASSERT(!mState.mAttachedVertexShader); mState.mAttachedVertexShader = shader; mState.mAttachedVertexShader->addRef(); break; } - case GL_FRAGMENT_SHADER: + case ShaderType::Fragment: { ASSERT(!mState.mAttachedFragmentShader); mState.mAttachedFragmentShader = shader; mState.mAttachedFragmentShader->addRef(); break; } - case GL_COMPUTE_SHADER: + case ShaderType::Compute: { ASSERT(!mState.mAttachedComputeShader); mState.mAttachedComputeShader = shader; mState.mAttachedComputeShader->addRef(); break; } - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: { ASSERT(!mState.mAttachedGeometryShader); mState.mAttachedGeometryShader = shader; @@ -764,28 +906,28 @@ void Program::detachShader(const Context *context, Shader *shader) { switch (shader->getType()) { - case GL_VERTEX_SHADER: + case ShaderType::Vertex: { ASSERT(mState.mAttachedVertexShader == shader); shader->release(context); mState.mAttachedVertexShader = nullptr; break; } - case GL_FRAGMENT_SHADER: + case ShaderType::Fragment: { ASSERT(mState.mAttachedFragmentShader == shader); shader->release(context); mState.mAttachedFragmentShader = nullptr; break; } - case GL_COMPUTE_SHADER: + case ShaderType::Compute: { ASSERT(mState.mAttachedComputeShader == shader); shader->release(context); mState.mAttachedComputeShader = nullptr; break; } - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: { ASSERT(mState.mAttachedGeometryShader == shader); shader->release(context); @@ -803,6 +945,11 @@ int Program::getAttachedShadersCount() const (mState.mAttachedComputeShader ? 1 : 0) + (mState.mAttachedGeometryShader ? 1 : 0); } +const Shader *Program::getAttachedShader(ShaderType shaderType) const +{ + return mState.getAttachedShader(shaderType); +} + void Program::bindAttributeLocation(GLuint index, const char *name) { mAttributeBindings.bindLocation(index, name); @@ -824,7 +971,7 @@ BindingInfo Program::getFragmentInputBindingInfo(const Context *context, GLint i ret.type = GL_NONE; ret.valid = false; - Shader *fragmentShader = mState.getAttachedFragmentShader(); + Shader *fragmentShader = mState.getAttachedShader(ShaderType::Fragment); ASSERT(fragmentShader); // Find the actual fragment shader varying we're interested in @@ -902,9 +1049,16 @@ Error Program::link(const gl::Context *context) double startTime = platform->currentTime(platform); unlink(); + mInfoLog.reset(); + + // Validate we have properly attached shaders before checking the cache. + if (!linkValidateShaders(context, mInfoLog)) + { + return NoError(); + } ProgramHash programHash; - auto *cache = context->getMemoryProgramCache(); + MemoryProgramCache *cache = context->getMemoryProgramCache(); if (cache) { ANGLE_TRY_RESULT(cache->getProgram(context, this, &mState, &programHash), mLinked); @@ -921,12 +1075,9 @@ Error Program::link(const gl::Context *context) // Cache load failed, fall through to normal linking. unlink(); - mInfoLog.reset(); - if (!linkValidateShaders(context, mInfoLog)) - { - return NoError(); - } + // Re-link shaders after the unlink call. + ASSERT(linkValidateShaders(context, mInfoLog)); if (mState.mAttachedComputeShader) { @@ -1063,22 +1214,46 @@ void Program::updateLinkedShaderStages() if (mState.mAttachedVertexShader) { - mState.mLinkedShaderStages.set(SHADER_VERTEX); + mState.mLinkedShaderStages.set(ShaderType::Vertex); } if (mState.mAttachedFragmentShader) { - mState.mLinkedShaderStages.set(SHADER_FRAGMENT); + mState.mLinkedShaderStages.set(ShaderType::Fragment); } if (mState.mAttachedComputeShader) { - mState.mLinkedShaderStages.set(SHADER_COMPUTE); + mState.mLinkedShaderStages.set(ShaderType::Compute); } if (mState.mAttachedGeometryShader) { - mState.mLinkedShaderStages.set(SHADER_GEOMETRY); + mState.mLinkedShaderStages.set(ShaderType::Geometry); + } +} + +void ProgramState::updateTransformFeedbackStrides() +{ + if (mTransformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS) + { + mTransformFeedbackStrides.resize(1); + size_t totalSize = 0; + for (auto &varying : mLinkedTransformFeedbackVaryings) + { + totalSize += varying.size() * VariableExternalSize(varying.type); + } + mTransformFeedbackStrides[0] = static_cast(totalSize); + } + else + { + mTransformFeedbackStrides.resize(mLinkedTransformFeedbackVaryings.size()); + for (size_t i = 0; i < mLinkedTransformFeedbackVaryings.size(); i++) + { + auto &varying = mLinkedTransformFeedbackVaryings[i]; + mTransformFeedbackStrides[i] = + static_cast(varying.size() * VariableExternalSize(varying.type)); + } } } @@ -1113,6 +1288,7 @@ void Program::unlink() mValidated = false; mLinked = false; + mInfoLog.reset(); } bool Program::isLinked() const @@ -1120,6 +1296,12 @@ bool Program::isLinked() const return mLinked; } +bool Program::hasLinkedShaderStage(ShaderType shaderType) const +{ + ASSERT(shaderType != ShaderType::InvalidEnum); + return mState.mLinkedShaderStages[shaderType]; +} + Error Program::loadBinary(const Context *context, GLenum binaryFormat, const void *binary, @@ -1837,11 +2019,12 @@ bool Program::validateSamplers(InfoLog *infoLog, const Caps &caps) if (mTextureUnitTypesCache.empty()) { - mTextureUnitTypesCache.resize(caps.maxCombinedTextureImageUnits, GL_NONE); + mTextureUnitTypesCache.resize(caps.maxCombinedTextureImageUnits, TextureType::InvalidEnum); } else { - std::fill(mTextureUnitTypesCache.begin(), mTextureUnitTypesCache.end(), GL_NONE); + std::fill(mTextureUnitTypesCache.begin(), mTextureUnitTypesCache.end(), + TextureType::InvalidEnum); } // if any two active samplers in a program are of different types, but refer to the same @@ -1852,7 +2035,7 @@ bool Program::validateSamplers(InfoLog *infoLog, const Caps &caps) if (samplerBinding.unreferenced) continue; - GLenum textureType = samplerBinding.textureType; + TextureType textureType = samplerBinding.textureType; for (GLuint textureUnit : samplerBinding.boundTextureUnits) { @@ -1869,7 +2052,7 @@ bool Program::validateSamplers(InfoLog *infoLog, const Caps &caps) return false; } - if (mTextureUnitTypesCache[textureUnit] != GL_NONE) + if (mTextureUnitTypesCache[textureUnit] != TextureType::InvalidEnum) { if (textureType != mTextureUnitTypesCache[textureUnit]) { @@ -2102,7 +2285,7 @@ bool Program::linkValidateShaders(const Context *context, InfoLog &infoLog) infoLog << "Attached compute shader is not compiled."; return false; } - ASSERT(computeShader->getType() == GL_COMPUTE_SHADER); + ASSERT(computeShader->getType() == ShaderType::Compute); mState.mComputeShaderLocalSize = computeShader->getWorkGroupSize(context); @@ -2121,14 +2304,14 @@ bool Program::linkValidateShaders(const Context *context, InfoLog &infoLog) infoLog << "No compiled fragment shader when at least one graphics shader is attached."; return false; } - ASSERT(fragmentShader->getType() == GL_FRAGMENT_SHADER); + ASSERT(fragmentShader->getType() == ShaderType::Fragment); if (!vertexShader || !vertexShader->isCompiled(context)) { infoLog << "No compiled vertex shader when at least one graphics shader is attached."; return false; } - ASSERT(vertexShader->getType() == GL_VERTEX_SHADER); + ASSERT(vertexShader->getType() == ShaderType::Vertex); int vertexShaderVersion = vertexShader->getShaderVersion(context); if (fragmentShader->getShaderVersion(context) != vertexShaderVersion) @@ -2160,7 +2343,7 @@ bool Program::linkValidateShaders(const Context *context, InfoLog &infoLog) mInfoLog << "Geometry shader version does not match vertex shader version."; return false; } - ASSERT(geometryShader->getType() == GL_GEOMETRY_SHADER_EXT); + ASSERT(geometryShader->getType() == ShaderType::Geometry); Optional inputPrimitive = geometryShader->getGeometryShaderInputPrimitiveType(context); @@ -2261,7 +2444,7 @@ bool Program::linkValidateShaderInterfaceMatching(const Context *context, const std::vector &outputVaryings = generatingShader->getOutputVaryings(context); const std::vector &inputVaryings = consumingShader->getInputVaryings(context); - bool validateGeometryShaderInputs = consumingShader->getType() == GL_GEOMETRY_SHADER_EXT; + bool validateGeometryShaderInputs = consumingShader->getType() == ShaderType::Geometry; for (const sh::Varying &input : inputVaryings) { @@ -2296,7 +2479,9 @@ bool Program::linkValidateShaderInterfaceMatching(const Context *context, } } - // We permit unmatched, unreferenced varyings + // We permit unmatched, unreferenced varyings. Note that this specifically depends on + // whether the input is statically used - a statically used input should fail this test even + // if it is not active. GLSL ES 3.00.6 section 4.3.10. if (!matched && input.staticUse) { infoLog << GetShaderTypeString(consumingShader->getType()) << " varying " << input.name @@ -2425,7 +2610,7 @@ void Program::linkSamplerAndImageBindings() for (unsigned int samplerIndex : mState.mSamplerUniformRange) { const auto &samplerUniform = mState.mUniforms[samplerIndex]; - GLenum textureType = SamplerTypeToTextureType(samplerUniform.type); + TextureType textureType = SamplerTypeToTextureType(samplerUniform.type); mState.mSamplerBindings.emplace_back( SamplerBinding(textureType, samplerUniform.getBasicTypeElementCount(), false)); } @@ -2466,48 +2651,31 @@ bool Program::linkAtomicCounterBuffers() } } // TODO(jie.a.chen@intel.com): Count each atomic counter buffer to validate against - // gl_Max[Vertex|Fragment|Compute|Combined]AtomicCounterBuffers. + // gl_Max[Vertex|Fragment|Compute|Geometry|Combined]AtomicCounterBuffers. return true; } -LinkMismatchError Program::LinkValidateInterfaceBlockFields( - const sh::InterfaceBlockField &blockField1, - const sh::InterfaceBlockField &blockField2, - bool webglCompatibility, - std::string *mismatchedBlockFieldName) -{ - if (blockField1.name != blockField2.name) - { - return LinkMismatchError::FIELD_NAME_MISMATCH; - } - - // If webgl, validate precision of UBO fields, otherwise don't. See Khronos bug 10287. - LinkMismatchError linkError = LinkValidateVariablesBase( - blockField1, blockField2, webglCompatibility, true, mismatchedBlockFieldName); - if (linkError != LinkMismatchError::NO_MISMATCH) - { - AddParentPrefix(blockField1.name, mismatchedBlockFieldName); - return linkError; - } - - if (blockField1.isRowMajorLayout != blockField2.isRowMajorLayout) - { - AddParentPrefix(blockField1.name, mismatchedBlockFieldName); - return LinkMismatchError::MATRIX_PACKING_MISMATCH; - } - - return LinkMismatchError::NO_MISMATCH; -} - // Assigns locations to all attributes from the bindings and program locations. bool Program::linkAttributes(const Context *context, InfoLog &infoLog) { const ContextState &data = context->getContextState(); - auto *vertexShader = mState.getAttachedVertexShader(); + Shader *vertexShader = mState.getAttachedShader(ShaderType::Vertex); + + int shaderVersion = vertexShader->getShaderVersion(context); unsigned int usedLocations = 0; - mState.mAttributes = vertexShader->getActiveAttributes(context); + if (shaderVersion >= 300) + { + // In GLSL ES 3.00.6, aliasing checks should be done with all declared attributes - see GLSL + // ES 3.00.6 section 12.46. Inactive attributes will be pruned after aliasing checks. + mState.mAttributes = vertexShader->getAllAttributes(context); + } + else + { + // In GLSL ES 1.00.17 we only do aliasing checks for active attributes. + mState.mAttributes = vertexShader->getActiveAttributes(context); + } GLuint maxAttribs = data.getCaps().maxVertexAttributes; // TODO(jmadill): handle aliasing robustly @@ -2519,7 +2687,7 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) std::vector usedAttribMap(maxAttribs, nullptr); - // Link attributes that have a binding location + // Assign locations to attributes that have a binding location and check for attribute aliasing. for (sh::Attribute &attribute : mState.mAttributes) { // GLSL ES 3.10 January 2016 section 4.3.4: Vertex shader inputs can't be arrays or @@ -2540,8 +2708,8 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) if (static_cast(regs + attribute.location) > maxAttribs) { - infoLog << "Active attribute (" << attribute.name << ") at location " - << attribute.location << " is too big to fit"; + infoLog << "Attribute (" << attribute.name << ") at location " << attribute.location + << " is too big to fit"; return false; } @@ -2551,12 +2719,13 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) const int regLocation = attribute.location + reg; sh::ShaderVariable *linkedAttribute = usedAttribMap[regLocation]; - // In GLSL 3.00, attribute aliasing produces a link error - // In GLSL 1.00, attribute aliasing is allowed, but ANGLE currently has a bug + // In GLSL ES 3.00.6 and in WebGL, attribute aliasing produces a link error. + // In non-WebGL GLSL ES 1.00.17, attribute aliasing is allowed with some + // restrictions - see GLSL ES 1.00.17 section 2.10.4, but ANGLE currently has a bug. if (linkedAttribute) { // TODO(jmadill): fix aliasing on ES2 - // if (mProgram->getShaderVersion() >= 300) + // if (shaderVersion >= 300 && !webgl) { infoLog << "Attribute '" << attribute.name << "' aliases attribute '" << linkedAttribute->name << "' at location " << regLocation; @@ -2573,7 +2742,7 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) } } - // Link attributes that don't have a binding location + // Assign locations to attributes that don't have a binding location. for (sh::Attribute &attribute : mState.mAttributes) { // Not set by glBindAttribLocation or by location layout qualifier @@ -2584,7 +2753,7 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) if (availableIndex == -1 || static_cast(availableIndex + regs) > maxAttribs) { - infoLog << "Too many active attributes (" << attribute.name << ")"; + infoLog << "Too many attributes (" << attribute.name << ")"; return false; } @@ -2595,8 +2764,27 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) ASSERT(mState.mAttributesTypeMask.none()); ASSERT(mState.mAttributesMask.none()); + // Prune inactive attributes. This step is only needed on shaderVersion >= 300 since on earlier + // shader versions we're only processing active attributes to begin with. + if (shaderVersion >= 300) + { + for (auto attributeIter = mState.mAttributes.begin(); + attributeIter != mState.mAttributes.end();) + { + if (attributeIter->active) + { + ++attributeIter; + } + else + { + attributeIter = mState.mAttributes.erase(attributeIter); + } + } + } + for (const sh::Attribute &attribute : mState.mAttributes) { + ASSERT(attribute.active); ASSERT(attribute.location != -1); unsigned int regs = static_cast(VariableRegisterCount(attribute.type)); @@ -2620,77 +2808,6 @@ bool Program::linkAttributes(const Context *context, InfoLog &infoLog) return true; } -bool Program::ValidateGraphicsInterfaceBlocks( - const std::vector &vertexInterfaceBlocks, - const std::vector &fragmentInterfaceBlocks, - InfoLog &infoLog, - bool webglCompatibility, - sh::BlockType blockType, - GLuint maxCombinedInterfaceBlocks) -{ - // Check that interface blocks defined in the vertex and fragment shaders are identical - typedef std::map InterfaceBlockMap; - InterfaceBlockMap linkedInterfaceBlocks; - GLuint blockCount = 0; - - for (const sh::InterfaceBlock &vertexInterfaceBlock : vertexInterfaceBlocks) - { - linkedInterfaceBlocks[vertexInterfaceBlock.name] = &vertexInterfaceBlock; - if (vertexInterfaceBlock.staticUse || vertexInterfaceBlock.layout != sh::BLOCKLAYOUT_PACKED) - { - blockCount += std::max(vertexInterfaceBlock.arraySize, 1u); - } - } - - for (const sh::InterfaceBlock &fragmentInterfaceBlock : fragmentInterfaceBlocks) - { - auto entry = linkedInterfaceBlocks.find(fragmentInterfaceBlock.name); - if (entry != linkedInterfaceBlocks.end()) - { - const sh::InterfaceBlock &vertexInterfaceBlock = *(entry->second); - std::string mismatchedBlockFieldName; - LinkMismatchError linkError = - AreMatchingInterfaceBlocks(vertexInterfaceBlock, fragmentInterfaceBlock, - webglCompatibility, &mismatchedBlockFieldName); - if (linkError != LinkMismatchError::NO_MISMATCH) - { - LogLinkMismatch(infoLog, fragmentInterfaceBlock.name, "interface block", linkError, - mismatchedBlockFieldName, GL_VERTEX_SHADER, GL_FRAGMENT_SHADER); - return false; - } - } - else - { - if (fragmentInterfaceBlock.staticUse || - fragmentInterfaceBlock.layout != sh::BLOCKLAYOUT_PACKED) - { - blockCount += std::max(fragmentInterfaceBlock.arraySize, 1u); - } - } - } - - if (blockCount > maxCombinedInterfaceBlocks) - { - switch (blockType) - { - case sh::BlockType::BLOCK_UNIFORM: - infoLog << "The sum of the number of active uniform blocks exceeds " - "MAX_COMBINED_UNIFORM_BLOCKS (" - << maxCombinedInterfaceBlocks << ")."; - break; - case sh::BlockType::BLOCK_BUFFER: - infoLog << "The sum of the number of active shader storage blocks exceeds " - "MAX_COMBINED_SHADER_STORAGE_BLOCKS (" - << maxCombinedInterfaceBlocks << ")."; - break; - default: - UNREACHABLE(); - } - return false; - } - return true; -} - bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) { const auto &caps = context->getCaps(); @@ -2700,7 +2817,7 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) Shader &computeShader = *mState.mAttachedComputeShader; const auto &computeUniformBlocks = computeShader.getUniformBlocks(context); - if (!validateInterfaceBlocksCount( + if (!ValidateInterfaceBlocksCount( caps.maxComputeUniformBlocks, computeUniformBlocks, "Compute shader uniform block count exceeds GL_MAX_COMPUTE_UNIFORM_BLOCKS (", infoLog)) @@ -2709,7 +2826,7 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) } const auto &computeShaderStorageBlocks = computeShader.getShaderStorageBlocks(context); - if (!validateInterfaceBlocksCount(caps.maxComputeShaderStorageBlocks, + if (!ValidateInterfaceBlocksCount(caps.maxComputeShaderStorageBlocks, computeShaderStorageBlocks, "Compute shader shader storage block count exceeds " "GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS (", @@ -2726,13 +2843,13 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) const auto &vertexUniformBlocks = vertexShader.getUniformBlocks(context); const auto &fragmentUniformBlocks = fragmentShader.getUniformBlocks(context); - if (!validateInterfaceBlocksCount( + if (!ValidateInterfaceBlocksCount( caps.maxVertexUniformBlocks, vertexUniformBlocks, "Vertex shader uniform block count exceeds GL_MAX_VERTEX_UNIFORM_BLOCKS (", infoLog)) { return false; } - if (!validateInterfaceBlocksCount( + if (!ValidateInterfaceBlocksCount( caps.maxFragmentUniformBlocks, fragmentUniformBlocks, "Fragment shader uniform block count exceeds GL_MAX_FRAGMENT_UNIFORM_BLOCKS (", infoLog)) @@ -2741,6 +2858,20 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) return false; } + Shader *geometryShader = mState.mAttachedGeometryShader; + if (geometryShader) + { + const auto &geometryUniformBlocks = geometryShader->getUniformBlocks(context); + if (!ValidateInterfaceBlocksCount( + caps.maxGeometryUniformBlocks, geometryUniformBlocks, + "Geometry shader uniform block count exceeds GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT (", + infoLog)) + { + return false; + } + } + + // TODO(jiawei.shao@intel.com): validate geometry shader uniform blocks. bool webglCompatibility = context->getExtensions().webglCompatibility; if (!ValidateGraphicsInterfaceBlocks(vertexUniformBlocks, fragmentUniformBlocks, infoLog, webglCompatibility, sh::BlockType::BLOCK_UNIFORM, @@ -2754,7 +2885,7 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) const auto &vertexShaderStorageBlocks = vertexShader.getShaderStorageBlocks(context); const auto &fragmentShaderStorageBlocks = fragmentShader.getShaderStorageBlocks(context); - if (!validateInterfaceBlocksCount(caps.maxVertexShaderStorageBlocks, + if (!ValidateInterfaceBlocksCount(caps.maxVertexShaderStorageBlocks, vertexShaderStorageBlocks, "Vertex shader shader storage block count exceeds " "GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS (", @@ -2762,7 +2893,7 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) { return false; } - if (!validateInterfaceBlocksCount(caps.maxFragmentShaderStorageBlocks, + if (!ValidateInterfaceBlocksCount(caps.maxFragmentShaderStorageBlocks, fragmentShaderStorageBlocks, "Fragment shader shader storage block count exceeds " "GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS (", @@ -2772,6 +2903,21 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) return false; } + if (geometryShader) + { + const auto &geometryShaderStorageBlocks = + geometryShader->getShaderStorageBlocks(context); + if (!ValidateInterfaceBlocksCount(caps.maxGeometryShaderStorageBlocks, + geometryShaderStorageBlocks, + "Geometry shader shader storage block count exceeds " + "GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT (", + infoLog)) + { + return false; + } + } + + // TODO(jiawei.shao@intel.com): validate geometry shader shader storage blocks. if (!ValidateGraphicsInterfaceBlocks( vertexShaderStorageBlocks, fragmentShaderStorageBlocks, infoLog, webglCompatibility, sh::BlockType::BLOCK_BUFFER, caps.maxCombinedShaderStorageBlocks)) @@ -2782,41 +2928,6 @@ bool Program::linkInterfaceBlocks(const Context *context, InfoLog &infoLog) return true; } -LinkMismatchError Program::AreMatchingInterfaceBlocks(const sh::InterfaceBlock &interfaceBlock1, - const sh::InterfaceBlock &interfaceBlock2, - bool webglCompatibility, - std::string *mismatchedBlockFieldName) -{ - // validate blocks for the same member types - if (interfaceBlock1.fields.size() != interfaceBlock2.fields.size()) - { - return LinkMismatchError::FIELD_NUMBER_MISMATCH; - } - if (interfaceBlock1.arraySize != interfaceBlock2.arraySize) - { - return LinkMismatchError::ARRAY_SIZE_MISMATCH; - } - if (interfaceBlock1.layout != interfaceBlock2.layout || - interfaceBlock1.binding != interfaceBlock2.binding) - { - return LinkMismatchError::LAYOUT_QUALIFIER_MISMATCH; - } - const unsigned int numBlockMembers = static_cast(interfaceBlock1.fields.size()); - for (unsigned int blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++) - { - const sh::InterfaceBlockField &member1 = interfaceBlock1.fields[blockMemberIndex]; - const sh::InterfaceBlockField &member2 = interfaceBlock2.fields[blockMemberIndex]; - - LinkMismatchError linkError = LinkValidateInterfaceBlockFields( - member1, member2, webglCompatibility, mismatchedBlockFieldName); - if (linkError != LinkMismatchError::NO_MISMATCH) - { - return linkError; - } - } - return LinkMismatchError::NO_MISMATCH; -} - LinkMismatchError Program::LinkValidateVariablesBase(const sh::ShaderVariable &variable1, const sh::ShaderVariable &variable2, bool validatePrecision, @@ -3108,6 +3219,9 @@ bool Program::linkValidateGlobalNames(const Context *context, InfoLog &infoLog) mState.mAttachedVertexShader->getUniforms(context); const std::vector &fragmentUniforms = mState.mAttachedFragmentShader->getUniforms(context); + const std::vector *geometryUniforms = + (mState.mAttachedGeometryShader) ? &mState.mAttachedGeometryShader->getUniforms(context) + : nullptr; const std::vector &attributes = mState.mAttachedVertexShader->getActiveAttributes(context); for (const auto &attrib : attributes) @@ -3128,6 +3242,17 @@ bool Program::linkValidateGlobalNames(const Context *context, InfoLog &infoLog) return false; } } + if (geometryUniforms) + { + for (const auto &uniform : *geometryUniforms) + { + if (uniform.name == attrib.name) + { + infoLog << "Name conflicts between a uniform and an attribute: " << attrib.name; + return false; + } + } + } } return true; } @@ -3165,6 +3290,7 @@ void Program::gatherTransformFeedbackVaryings(const ProgramMergedVaryings &varyi } } } + mState.updateTransformFeedbackStrides(); } ProgramMergedVaryings Program::getMergedVaryings(const Context *context) const @@ -3428,7 +3554,7 @@ bool Program::samplesFromTexture(const gl::State &state, GLuint textureID) const for (const auto &binding : mState.mSamplerBindings) { - GLenum textureType = binding.textureType; + TextureType textureType = binding.textureType; for (const auto &unit : binding.boundTextureUnits) { GLenum programTextureID = state.getSamplerTextureId(unit, textureType); diff --git a/gfx/angle/checkout/src/libANGLE/Program.h b/gfx/angle/checkout/src/libANGLE/Program.h index 74848c45ad85..8f59c094e855 100644 --- a/gfx/angle/checkout/src/libANGLE/Program.h +++ b/gfx/angle/checkout/src/libANGLE/Program.h @@ -163,8 +163,10 @@ void LogLinkMismatch(InfoLog &infoLog, const char *variableType, LinkMismatchError linkError, const std::string &mismatchedStructOrBlockFieldName, - GLenum shaderType1, - GLenum shaderType2); + ShaderType shaderType1, + ShaderType shaderType2); + +bool IsActiveInterfaceBlock(const sh::InterfaceBlock &interfaceBlock); // Struct used for correlating uniforms/elements of uniform arrays to handles struct VariableLocation @@ -213,12 +215,12 @@ struct BindingInfo // This small structure encapsulates binding sampler uniforms to active GL textures. struct SamplerBinding { - SamplerBinding(GLenum textureTypeIn, size_t elementCount, bool unreferenced); + SamplerBinding(TextureType textureTypeIn, size_t elementCount, bool unreferenced); SamplerBinding(const SamplerBinding &other); ~SamplerBinding(); // Necessary for retrieving active textures from the GL state. - GLenum textureType; + TextureType textureType; // List of all textures bound to this sampler, of type textureType. std::vector boundTextureUnits; @@ -275,8 +277,6 @@ struct ImageBinding std::vector boundImageUnits; }; -using ShaderStagesMask = angle::BitSet; - class ProgramState final : angle::NonCopyable { public: @@ -285,10 +285,7 @@ class ProgramState final : angle::NonCopyable const std::string &getLabel(); - Shader *getAttachedVertexShader() const { return mAttachedVertexShader; } - Shader *getAttachedFragmentShader() const { return mAttachedFragmentShader; } - Shader *getAttachedComputeShader() const { return mAttachedComputeShader; } - Shader *getAttachedGeometryShader() const { return mAttachedGeometryShader; } + Shader *getAttachedShader(ShaderType shaderType) const; const std::vector &getTransformFeedbackVaryingNames() const { return mTransformFeedbackVaryingNames; @@ -353,12 +350,14 @@ class ProgramState final : angle::NonCopyable int getNumViews() const { return mNumViews; } bool usesMultiview() const { return mNumViews != -1; } - const ShaderStagesMask &getLinkedShaderStages() const { return mLinkedShaderStages; } + const ShaderBitSet &getLinkedShaderStages() const { return mLinkedShaderStages; } private: friend class MemoryProgramCache; friend class Program; + void updateTransformFeedbackStrides(); + std::string mLabel; sh::WorkGroupSize mComputeShaderLocalSize; @@ -422,7 +421,7 @@ class ProgramState final : angle::NonCopyable bool mBinaryRetrieveableHint; bool mSeparable; - ShaderStagesMask mLinkedShaderStages; + ShaderBitSet mLinkedShaderStages; // ANGLE_multiview. int mNumViews; @@ -432,6 +431,9 @@ class ProgramState final : angle::NonCopyable GLenum mGeometryShaderOutputPrimitiveType; int mGeometryShaderInvocations; int mGeometryShaderMaxVertices; + + // The size of the data written to each transform feedback buffer per vertex. + std::vector mTransformFeedbackStrides; }; class ProgramBindings final : angle::NonCopyable @@ -478,10 +480,7 @@ class Program final : angle::NonCopyable, public LabeledObject void detachShader(const Context *context, Shader *shader); int getAttachedShadersCount() const; - const Shader *getAttachedVertexShader() const { return mState.mAttachedVertexShader; } - const Shader *getAttachedFragmentShader() const { return mState.mAttachedFragmentShader; } - const Shader *getAttachedComputeShader() const { return mState.mAttachedComputeShader; } - const Shader *getAttachedGeometryShader() const { return mState.mAttachedGeometryShader; } + const Shader *getAttachedShader(ShaderType shaderType) const; void bindAttributeLocation(GLuint index, const char *name); void bindUniformLocation(GLuint index, const char *name); @@ -498,10 +497,7 @@ class Program final : angle::NonCopyable, public LabeledObject Error link(const gl::Context *context); bool isLinked() const; - bool hasLinkedVertexShader() const { return mState.mLinkedShaderStages[SHADER_VERTEX]; } - bool hasLinkedFragmentShader() const { return mState.mLinkedShaderStages[SHADER_FRAGMENT]; } - bool hasLinkedComputeShader() const { return mState.mLinkedShaderStages[SHADER_COMPUTE]; } - bool hasLinkedGeometryShader() const { return mState.mLinkedShaderStages[SHADER_GEOMETRY]; } + bool hasLinkedShaderStage(ShaderType shaderType) const; Error loadBinary(const Context *context, GLenum binaryFormat, @@ -627,12 +623,6 @@ class Program final : angle::NonCopyable, public LabeledObject GLuint getTransformFeedbackVaryingResourceIndex(const GLchar *name) const; const TransformFeedbackVarying &getTransformFeedbackVaryingResource(GLuint index) const; - static LinkMismatchError LinkValidateInterfaceBlockFields( - const sh::InterfaceBlockField &blockField1, - const sh::InterfaceBlockField &blockField2, - bool webglCompatibility, - std::string *mismatchedBlockFieldName); - void addRef(); void release(const Context *context); unsigned int getRefCount() const; @@ -660,6 +650,17 @@ class Program final : angle::NonCopyable, public LabeledObject return mState.mComputeShaderLocalSize; } + GLenum getGeometryShaderInputPrimitiveType() const + { + return mState.mGeometryShaderInputPrimitiveType; + } + GLenum getGeometryShaderOutputPrimitiveType() const + { + return mState.mGeometryShaderOutputPrimitiveType; + } + GLint getGeometryShaderInvocations() const { return mState.mGeometryShaderInvocations; } + GLint getGeometryShaderMaxVertices() const { return mState.mGeometryShaderMaxVertices; } + const ProgramState &getState() const { return mState; } static LinkMismatchError LinkValidateVariablesBase( @@ -692,6 +693,11 @@ class Program final : angle::NonCopyable, public LabeledObject ComponentTypeMask getAttributesTypeMask() const { return mState.mAttributesTypeMask; } AttributesMask getAttributesMask() const { return mState.mAttributesMask; } + const std::vector &getTransformFeedbackStrides() const + { + return mState.mTransformFeedbackStrides; + } + private: ~Program() override; @@ -699,13 +705,6 @@ class Program final : angle::NonCopyable, public LabeledObject bool linkValidateShaders(const Context *context, InfoLog &infoLog); bool linkAttributes(const Context *context, InfoLog &infoLog); - static bool ValidateGraphicsInterfaceBlocks( - const std::vector &vertexInterfaceBlocks, - const std::vector &fragmentInterfaceBlocks, - InfoLog &infoLog, - bool webglCompatibility, - sh::BlockType blockType, - GLuint maxCombinedInterfaceBlocks); bool linkInterfaceBlocks(const Context *context, InfoLog &infoLog); bool linkVaryings(const Context *context, InfoLog &infoLog) const; @@ -717,11 +716,6 @@ class Program final : angle::NonCopyable, public LabeledObject void updateLinkedShaderStages(); - static LinkMismatchError AreMatchingInterfaceBlocks(const sh::InterfaceBlock &interfaceBlock1, - const sh::InterfaceBlock &interfaceBlock2, - bool webglCompatibility, - std::string *mismatchedBlockFieldName); - static LinkMismatchError LinkValidateVaryings(const sh::Varying &outputVarying, const sh::Varying &inputVarying, int shaderVersion, @@ -810,7 +804,7 @@ class Program final : angle::NonCopyable, public LabeledObject // Cache for sampler validation Optional mCachedValidateSamplersResult; - std::vector mTextureUnitTypesCache; + std::vector mTextureUnitTypesCache; }; } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp index 158f5ae4bd6b..9ef76b70ff65 100644 --- a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp +++ b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.cpp @@ -49,107 +49,22 @@ int GetUniformLocationBinding(const ProgramBindings &uniformLocationBindings, } template -void SetStaticUse(std::vector *list, - const std::string &name, - GLenum shaderType, - bool staticUse) +void SetActive(std::vector *list, const std::string &name, ShaderType shaderType, bool active) { for (auto &variable : *list) { if (variable.name == name) { - variable.setStaticUse(shaderType, staticUse); + variable.setActive(shaderType, active); return; } } } -} // anonymous namespace - -UniformLinker::UniformLinker(const ProgramState &state) : mState(state) -{ -} - -UniformLinker::~UniformLinker() = default; - -void UniformLinker::getResults(std::vector *uniforms, - std::vector *uniformLocations) -{ - uniforms->swap(mUniforms); - uniformLocations->swap(mUniformLocations); -} - -bool UniformLinker::link(const Context *context, - InfoLog &infoLog, - const ProgramBindings &uniformLocationBindings) -{ - if (mState.getAttachedVertexShader() && mState.getAttachedFragmentShader()) - { - ASSERT(mState.getAttachedComputeShader() == nullptr); - if (!validateGraphicsUniforms(context, infoLog)) - { - return false; - } - } - - // Flatten the uniforms list (nested fields) into a simple list (no nesting). - // Also check the maximum uniform vector and sampler counts. - if (!flattenUniformsAndCheckCaps(context, infoLog)) - { - return false; - } - - if (!checkMaxCombinedAtomicCounters(context->getCaps(), infoLog)) - { - return false; - } - - if (!indexUniforms(infoLog, uniformLocationBindings)) - { - return false; - } - - return true; -} - -bool UniformLinker::validateGraphicsUniforms(const Context *context, InfoLog &infoLog) const -{ - // Check that uniforms defined in the vertex and fragment shaders are identical - std::map linkedUniforms; - const std::vector &vertexUniforms = - mState.getAttachedVertexShader()->getUniforms(context); - const std::vector &fragmentUniforms = - mState.getAttachedFragmentShader()->getUniforms(context); - - for (const sh::Uniform &vertexUniform : vertexUniforms) - { - linkedUniforms[vertexUniform.name] = &vertexUniform; - } - - for (const sh::Uniform &fragmentUniform : fragmentUniforms) - { - auto entry = linkedUniforms.find(fragmentUniform.name); - if (entry != linkedUniforms.end()) - { - const sh::Uniform &vertexUniform = *(entry->second); - std::string mismatchedStructFieldName; - LinkMismatchError linkError = - LinkValidateUniforms(vertexUniform, fragmentUniform, &mismatchedStructFieldName); - if (linkError != LinkMismatchError::NO_MISMATCH) - { - LogLinkMismatch(infoLog, fragmentUniform.name, "uniform", linkError, - mismatchedStructFieldName, GL_VERTEX_SHADER, GL_FRAGMENT_SHADER); - return false; - } - } - } - return true; -} - // GLSL ES Spec 3.00.3, section 4.3.5. -LinkMismatchError UniformLinker::LinkValidateUniforms(const sh::Uniform &uniform1, - const sh::Uniform &uniform2, - std::string *mismatchedStructFieldName) +LinkMismatchError LinkValidateUniforms(const sh::Uniform &uniform1, + const sh::Uniform &uniform2, + std::string *mismatchedStructFieldName) { #if ANGLE_PROGRAM_LINK_VALIDATE_UNIFORM_PRECISION == ANGLE_ENABLED const bool validatePrecision = true; @@ -184,10 +99,124 @@ LinkMismatchError UniformLinker::LinkValidateUniforms(const sh::Uniform &uniform return LinkMismatchError::NO_MISMATCH; } +using ShaderUniform = std::pair; + +bool ValidateGraphicsUniformsPerShader(const Context *context, + Shader *shaderToLink, + bool extendLinkedUniforms, + std::map *linkedUniforms, + InfoLog &infoLog) +{ + ASSERT(context && shaderToLink && linkedUniforms); + + for (const sh::Uniform &uniform : shaderToLink->getUniforms(context)) + { + const auto &entry = linkedUniforms->find(uniform.name); + if (entry != linkedUniforms->end()) + { + const sh::Uniform &linkedUniform = *(entry->second.second); + std::string mismatchedStructFieldName; + LinkMismatchError linkError = + LinkValidateUniforms(uniform, linkedUniform, &mismatchedStructFieldName); + if (linkError != LinkMismatchError::NO_MISMATCH) + { + LogLinkMismatch(infoLog, uniform.name, "uniform", linkError, + mismatchedStructFieldName, entry->second.first, + shaderToLink->getType()); + return false; + } + } + else if (extendLinkedUniforms) + { + (*linkedUniforms)[uniform.name] = std::make_pair(shaderToLink->getType(), &uniform); + } + } + + return true; +} + +} // anonymous namespace + +UniformLinker::UniformLinker(const ProgramState &state) : mState(state) +{ +} + +UniformLinker::~UniformLinker() = default; + +void UniformLinker::getResults(std::vector *uniforms, + std::vector *uniformLocations) +{ + uniforms->swap(mUniforms); + uniformLocations->swap(mUniformLocations); +} + +bool UniformLinker::link(const Context *context, + InfoLog &infoLog, + const ProgramBindings &uniformLocationBindings) +{ + if (mState.getAttachedShader(ShaderType::Vertex) && + mState.getAttachedShader(ShaderType::Fragment)) + { + ASSERT(mState.getAttachedShader(ShaderType::Compute) == nullptr); + if (!validateGraphicsUniforms(context, infoLog)) + { + return false; + } + } + + // Flatten the uniforms list (nested fields) into a simple list (no nesting). + // Also check the maximum uniform vector and sampler counts. + if (!flattenUniformsAndCheckCaps(context, infoLog)) + { + return false; + } + + if (!checkMaxCombinedAtomicCounters(context->getCaps(), infoLog)) + { + return false; + } + + if (!indexUniforms(infoLog, uniformLocationBindings)) + { + return false; + } + + return true; +} + +bool UniformLinker::validateGraphicsUniforms(const Context *context, InfoLog &infoLog) const +{ + // Check that uniforms defined in the graphics shaders are identical + std::map linkedUniforms; + for (const sh::Uniform &vertexUniform : + mState.getAttachedShader(ShaderType::Vertex)->getUniforms(context)) + { + linkedUniforms[vertexUniform.name] = std::make_pair(ShaderType::Vertex, &vertexUniform); + } + + std::vector activeShadersToLink; + if (mState.getAttachedShader(ShaderType::Geometry)) + { + activeShadersToLink.push_back(mState.getAttachedShader(ShaderType::Geometry)); + } + activeShadersToLink.push_back(mState.getAttachedShader(ShaderType::Fragment)); + + const size_t numActiveShadersToLink = activeShadersToLink.size(); + for (size_t shaderIndex = 0; shaderIndex < numActiveShadersToLink; ++shaderIndex) + { + bool isLastShader = (shaderIndex == numActiveShadersToLink - 1); + if (!ValidateGraphicsUniformsPerShader(context, activeShadersToLink[shaderIndex], + !isLastShader, &linkedUniforms, infoLog)) + { + return false; + } + } + + return true; +} + bool UniformLinker::indexUniforms(InfoLog &infoLog, const ProgramBindings &uniformLocationBindings) { - // All the locations where another uniform can't be located. - std::set reservedLocations; // Locations which have been allocated for an unused uniform. std::set ignoredLocations; @@ -196,8 +225,7 @@ bool UniformLinker::indexUniforms(InfoLog &infoLog, const ProgramBindings &unifo // Gather uniform locations that have been set either using the bindUniformLocation API or by // using a location layout qualifier and check conflicts between them. if (!gatherUniformLocationsAndCheckConflicts(infoLog, uniformLocationBindings, - &reservedLocations, &ignoredLocations, - &maxUniformLocation)) + &ignoredLocations, &maxUniformLocation)) { return false; } @@ -282,10 +310,12 @@ bool UniformLinker::indexUniforms(InfoLog &infoLog, const ProgramBindings &unifo bool UniformLinker::gatherUniformLocationsAndCheckConflicts( InfoLog &infoLog, const ProgramBindings &uniformLocationBindings, - std::set *reservedLocations, std::set *ignoredLocations, int *maxUniformLocation) { + // All the locations where another uniform can't be located. + std::set reservedLocations; + for (const LinkedUniform &uniform : mUniforms) { if (uniform.isBuiltIn()) @@ -305,13 +335,13 @@ bool UniformLinker::gatherUniformLocationsAndCheckConflicts( // GLSL ES 3.10 section 4.4.3 int elementLocation = shaderLocation + arrayIndex; *maxUniformLocation = std::max(*maxUniformLocation, elementLocation); - if (reservedLocations->find(elementLocation) != reservedLocations->end()) + if (reservedLocations.find(elementLocation) != reservedLocations.end()) { infoLog << "Multiple uniforms bound to location " << elementLocation << "."; return false; } - reservedLocations->insert(elementLocation); - if (!uniform.staticUse) + reservedLocations.insert(elementLocation); + if (!uniform.active) { ignoredLocations->insert(elementLocation); } @@ -321,12 +351,16 @@ bool UniformLinker::gatherUniformLocationsAndCheckConflicts( { // Only the first location is reserved even if the uniform is an array. *maxUniformLocation = std::max(*maxUniformLocation, apiBoundLocation); - if (reservedLocations->find(apiBoundLocation) != reservedLocations->end()) + if (reservedLocations.find(apiBoundLocation) != reservedLocations.end()) { infoLog << "Multiple uniforms bound to location " << apiBoundLocation << "."; return false; } - reservedLocations->insert(apiBoundLocation); + reservedLocations.insert(apiBoundLocation); + if (!uniform.active) + { + ignoredLocations->insert(apiBoundLocation); + } } } @@ -335,7 +369,7 @@ bool UniformLinker::gatherUniformLocationsAndCheckConflicts( for (const auto &locationBinding : uniformLocationBindings) { GLuint location = locationBinding.second; - if (reservedLocations->find(location) == reservedLocations->end()) + if (reservedLocations.find(location) == reservedLocations.end()) { ignoredLocations->insert(location); *maxUniformLocation = std::max(*maxUniformLocation, static_cast(location)); @@ -350,7 +384,7 @@ void UniformLinker::pruneUnusedUniforms() auto uniformIter = mUniforms.begin(); while (uniformIter != mUniforms.end()) { - if (uniformIter->staticUse) + if (uniformIter->active) { ++uniformIter; } @@ -419,9 +453,9 @@ bool UniformLinker::flattenUniformsAndCheckCaps(const Context *context, InfoLog const Caps &caps = context->getCaps(); - if (mState.getAttachedComputeShader()) + if (mState.getAttachedShader(ShaderType::Compute)) { - Shader *computeShader = mState.getAttachedComputeShader(); + Shader *computeShader = mState.getAttachedShader(ShaderType::Compute); // TODO (mradev): check whether we need finer-grained component counting if (!flattenUniformsAndCheckCapsForShader( @@ -439,7 +473,7 @@ bool UniformLinker::flattenUniformsAndCheckCaps(const Context *context, InfoLog } else { - Shader *vertexShader = mState.getAttachedVertexShader(); + Shader *vertexShader = mState.getAttachedShader(ShaderType::Vertex); if (!flattenUniformsAndCheckCapsForShader( context, vertexShader, caps.maxVertexUniformVectors, @@ -454,7 +488,7 @@ bool UniformLinker::flattenUniformsAndCheckCaps(const Context *context, InfoLog return false; } - Shader *fragmentShader = mState.getAttachedFragmentShader(); + Shader *fragmentShader = mState.getAttachedShader(ShaderType::Fragment); if (!flattenUniformsAndCheckCapsForShader( context, fragmentShader, caps.maxFragmentUniformVectors, caps.maxTextureImageUnits, @@ -467,6 +501,22 @@ bool UniformLinker::flattenUniformsAndCheckCaps(const Context *context, InfoLog { return false; } + + Shader *geometryShader = mState.getAttachedShader(ShaderType::Geometry); + // TODO (jiawei.shao@intel.com): check whether we need finer-grained component counting + if (geometryShader && + !flattenUniformsAndCheckCapsForShader( + context, geometryShader, caps.maxGeometryUniformComponents / 4, + caps.maxGeometryTextureImageUnits, caps.maxGeometryImageUniforms, + caps.maxGeometryAtomicCounters, + "Geometry shader active uniforms exceed MAX_GEOMETRY_UNIFORM_VECTORS_EXT (", + "Geometry shader sampler count exceeds MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT (", + "Geometry shader image count exceeds MAX_GEOMETRY_IMAGE_UNIFORMS_EXT (", + "Geometry shader atomic counter count exceeds MAX_GEOMETRY_ATOMIC_COUNTERS_EXT (", + samplerUniforms, imageUniforms, atomicCounterUniforms, infoLog)) + { + return false; + } } mUniforms.insert(mUniforms.end(), samplerUniforms.begin(), samplerUniforms.end()); @@ -480,14 +530,14 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniform( std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType) + ShaderType shaderType) { int location = uniform.location; ShaderUniformCount shaderUniformCount = flattenUniformImpl(uniform, uniform.name, uniform.mappedName, samplerUniforms, - imageUniforms, atomicCounterUniforms, shaderType, uniform.staticUse, - uniform.binding, uniform.offset, &location); - if (uniform.staticUse) + imageUniforms, atomicCounterUniforms, shaderType, uniform.active, + uniform.staticUse, uniform.binding, uniform.offset, &location); + if (uniform.active) { return shaderUniformCount; } @@ -502,7 +552,8 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenArrayOfStructsUniform( std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -520,14 +571,15 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenArrayOfStructsUniform( { shaderUniformCount += flattenArrayOfStructsUniform( uniform, arrayNestingIndex + 1u, elementName, elementMappedName, samplerUniforms, - imageUniforms, atomicCounterUniforms, shaderType, markStaticUse, binding, offset, - location); + imageUniforms, atomicCounterUniforms, shaderType, markActive, markStaticUse, + binding, offset, location); } else { shaderUniformCount += flattenStructUniform( uniform.fields, elementName, elementMappedName, samplerUniforms, imageUniforms, - atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location); + atomicCounterUniforms, shaderType, markActive, markStaticUse, binding, offset, + location); } } return shaderUniformCount; @@ -540,7 +592,8 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenStructUniform( std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -552,9 +605,9 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenStructUniform( const std::string &fieldName = namePrefix + "." + field.name; const std::string &fieldMappedName = mappedNamePrefix + "." + field.mappedName; - shaderUniformCount += - flattenUniformImpl(field, fieldName, fieldMappedName, samplerUniforms, imageUniforms, - atomicCounterUniforms, shaderType, markStaticUse, -1, -1, location); + shaderUniformCount += flattenUniformImpl(field, fieldName, fieldMappedName, samplerUniforms, + imageUniforms, atomicCounterUniforms, shaderType, + markActive, markStaticUse, -1, -1, location); } return shaderUniformCount; } @@ -566,7 +619,8 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenArrayUniform( std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -583,9 +637,10 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenArrayUniform( const std::string elementName = namePrefix + ArrayString(arrayElement); const std::string elementMappedName = mappedNamePrefix + ArrayString(arrayElement); - shaderUniformCount += flattenUniformImpl( - uniformElement, elementName, elementMappedName, samplerUniforms, imageUniforms, - atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location); + shaderUniformCount += + flattenUniformImpl(uniformElement, elementName, elementMappedName, samplerUniforms, + imageUniforms, atomicCounterUniforms, shaderType, markActive, + markStaticUse, binding, offset, location); } return shaderUniformCount; } @@ -597,7 +652,8 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl( std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -610,15 +666,17 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl( { if (uniform.isArray()) { - shaderUniformCount += flattenArrayOfStructsUniform( - uniform, 0u, fullName, fullMappedName, samplerUniforms, imageUniforms, - atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location); + shaderUniformCount += + flattenArrayOfStructsUniform(uniform, 0u, fullName, fullMappedName, samplerUniforms, + imageUniforms, atomicCounterUniforms, shaderType, + markActive, markStaticUse, binding, offset, location); } else { - shaderUniformCount += flattenStructUniform( - uniform.fields, fullName, fullMappedName, samplerUniforms, imageUniforms, - atomicCounterUniforms, shaderType, markStaticUse, binding, offset, location); + shaderUniformCount += + flattenStructUniform(uniform.fields, fullName, fullMappedName, samplerUniforms, + imageUniforms, atomicCounterUniforms, shaderType, markActive, + markStaticUse, binding, offset, location); } return shaderUniformCount; } @@ -628,8 +686,8 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl( // "For an active variable declared as an array of an aggregate data type (structures or // arrays), a separate entry will be generated for each active array element" return flattenArrayUniform(uniform, fullName, fullMappedName, samplerUniforms, - imageUniforms, atomicCounterUniforms, shaderType, markStaticUse, - binding, offset, location); + imageUniforms, atomicCounterUniforms, shaderType, markActive, + markStaticUse, binding, offset, location); } // Not a struct @@ -676,10 +734,14 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl( { existingUniform->location = *location; } + if (markActive) + { + existingUniform->active = true; + existingUniform->setActive(shaderType, true); + } if (markStaticUse) { existingUniform->staticUse = true; - existingUniform->setStaticUse(shaderType, true); } } else @@ -689,11 +751,12 @@ UniformLinker::ShaderUniformCount UniformLinker::flattenUniformImpl( uniform.arraySizes, binding, offset, *location, -1, sh::BlockMemberInfo::getDefaultBlockInfo()); linkedUniform.mappedName = fullMappedNameWithArrayIndex; + linkedUniform.active = markActive; linkedUniform.staticUse = markStaticUse; linkedUniform.flattenedOffsetInParentArrays = uniform.flattenedOffsetInParentArrays; - if (markStaticUse) + if (markActive) { - linkedUniform.setStaticUse(shaderType, true); + linkedUniform.setActive(shaderType, true); } uniformList->push_back(linkedUniform); @@ -723,7 +786,7 @@ bool UniformLinker::checkMaxCombinedAtomicCounters(const Caps &caps, InfoLog &in unsigned int atomicCounterCount = 0; for (const auto &uniform : mUniforms) { - if (IsAtomicCounterType(uniform.type) && uniform.staticUse) + if (IsAtomicCounterType(uniform.type) && uniform.active) { atomicCounterCount += uniform.getBasicTypeElementCount(); if (atomicCounterCount > caps.maxCombinedAtomicCounters) @@ -747,7 +810,7 @@ InterfaceBlockLinker::~InterfaceBlockLinker() { } -void InterfaceBlockLinker::addShaderBlocks(GLenum shader, +void InterfaceBlockLinker::addShaderBlocks(ShaderType shader, const std::vector *blocks) { mShaderBlocks.push_back(std::make_pair(shader, blocks)); @@ -762,23 +825,22 @@ void InterfaceBlockLinker::linkBlocks(const GetBlockSize &getBlockSize, for (const auto &shaderBlocks : mShaderBlocks) { - const GLenum shaderType = shaderBlocks.first; + const ShaderType shaderType = shaderBlocks.first; for (const auto &block : *shaderBlocks.second) { - // Only 'packed' blocks are allowed to be considered inactive. - if (!block.staticUse && block.layout == sh::BLOCKLAYOUT_PACKED) + if (!IsActiveInterfaceBlock(block)) continue; if (visitedList.count(block.name) > 0) { - if (block.staticUse) + if (block.active) { for (InterfaceBlock &priorBlock : *mBlocksOut) { if (block.name == priorBlock.name) { - priorBlock.setStaticUse(shaderType, true); + priorBlock.setActive(shaderType, true); // Update the block members static use. defineBlockMembers(nullptr, block.fields, block.fieldPrefix(), block.fieldMappedPrefix(), -1, @@ -806,7 +868,7 @@ void InterfaceBlockLinker::defineArrayOfStructsBlockMembers(const GetBlockMember int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const + ShaderType shaderType) const { // Nested arrays are processed starting from outermost (arrayNestingIndex 0u) and ending at the // innermost. @@ -841,7 +903,7 @@ void InterfaceBlockLinker::defineBlockMembers(const GetBlockMemberInfo &getMembe int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const + ShaderType shaderType) const { for (const VarT &field : fields) { @@ -862,7 +924,7 @@ void InterfaceBlockLinker::defineBlockMember(const GetBlockMemberInfo &getMember int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const + ShaderType shaderType) const { int nextArraySize = topLevelArraySize; if (((field.isArray() && field.isStruct()) || field.isArrayOfArrays()) && @@ -922,7 +984,7 @@ void InterfaceBlockLinker::defineBlockMember(const GetBlockMemberInfo &getMember if (blockIndex == -1) { - updateBlockMemberStaticUsedImpl(fullNameWithArrayIndex, shaderType, field.staticUse); + updateBlockMemberActiveImpl(fullNameWithArrayIndex, shaderType, field.active); } else { @@ -942,7 +1004,7 @@ void InterfaceBlockLinker::defineBlockMember(const GetBlockMemberInfo &getMember void InterfaceBlockLinker::defineInterfaceBlock(const GetBlockSize &getBlockSize, const GetBlockMemberInfo &getMemberInfo, const sh::InterfaceBlock &interfaceBlock, - GLenum shaderType) const + ShaderType shaderType) const { size_t blockSize = 0; std::vector blockIndexes; @@ -987,7 +1049,7 @@ void InterfaceBlockLinker::defineInterfaceBlock(const GetBlockSize &getBlockSize InterfaceBlock block(interfaceBlock.name, interfaceBlock.mappedName, interfaceBlock.isArray(), arrayElement, blockBinding); block.memberIndexes = blockIndexes; - block.setStaticUse(shaderType, interfaceBlock.staticUse); + block.setActive(shaderType, interfaceBlock.active); // Since all block elements in an array share the same active interface blocks, they // will all be active once any block member is used. So, since interfaceBlock.name[0] @@ -1014,12 +1076,12 @@ void UniformBlockLinker::defineBlockMemberImpl(const sh::ShaderVariable &field, int blockIndex, const sh::BlockMemberInfo &memberInfo, int /*topLevelArraySize*/, - GLenum shaderType) const + ShaderType shaderType) const { LinkedUniform newUniform(field.type, field.precision, fullName, field.arraySizes, -1, -1, -1, blockIndex, memberInfo); newUniform.mappedName = fullMappedName; - newUniform.setStaticUse(shaderType, field.staticUse); + newUniform.setActive(shaderType, field.active); // Since block uniforms have no location, we don't need to store them in the uniform locations // list. @@ -1031,11 +1093,11 @@ size_t UniformBlockLinker::getCurrentBlockMemberIndex() const return mUniformsOut->size(); } -void UniformBlockLinker::updateBlockMemberStaticUsedImpl(const std::string &fullName, - GLenum shaderType, - bool staticUse) const +void UniformBlockLinker::updateBlockMemberActiveImpl(const std::string &fullName, + ShaderType shaderType, + bool active) const { - SetStaticUse(mUniformsOut, fullName, shaderType, staticUse); + SetActive(mUniformsOut, fullName, shaderType, active); } // ShaderStorageBlockLinker implementation. @@ -1055,12 +1117,12 @@ void ShaderStorageBlockLinker::defineBlockMemberImpl(const sh::ShaderVariable &f int blockIndex, const sh::BlockMemberInfo &memberInfo, int topLevelArraySize, - GLenum shaderType) const + ShaderType shaderType) const { BufferVariable newBufferVariable(field.type, field.precision, fullName, field.arraySizes, blockIndex, memberInfo); newBufferVariable.mappedName = fullMappedName; - newBufferVariable.setStaticUse(shaderType, field.staticUse); + newBufferVariable.setActive(shaderType, field.active); newBufferVariable.topLevelArraySize = topLevelArraySize; @@ -1072,11 +1134,11 @@ size_t ShaderStorageBlockLinker::getCurrentBlockMemberIndex() const return mBufferVariablesOut->size(); } -void ShaderStorageBlockLinker::updateBlockMemberStaticUsedImpl(const std::string &fullName, - GLenum shaderType, - bool staticUse) const +void ShaderStorageBlockLinker::updateBlockMemberActiveImpl(const std::string &fullName, + ShaderType shaderType, + bool active) const { - SetStaticUse(mBufferVariablesOut, fullName, shaderType, staticUse); + SetActive(mBufferVariablesOut, fullName, shaderType, active); } // AtomicCounterBufferLinker implementation. diff --git a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h index ba06d483208e..ce6d7b51824d 100644 --- a/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h +++ b/gfx/angle/checkout/src/libANGLE/ProgramLinkedResources.h @@ -13,6 +13,7 @@ #include "angle_gl.h" #include "common/angleutils.h" +#include "libANGLE/PackedGLEnums_autogen.h" #include "libANGLE/VaryingPacking.h" #include @@ -81,10 +82,6 @@ class UniformLinker final : angle::NonCopyable bool validateGraphicsUniforms(const Context *context, InfoLog &infoLog) const; - static LinkMismatchError LinkValidateUniforms(const sh::Uniform &uniform1, - const sh::Uniform &uniform2, - std::string *mismatchedStructFieldName); - bool flattenUniformsAndCheckCapsForShader(const Context *context, Shader *shader, GLuint maxUniformComponents, @@ -107,7 +104,7 @@ class UniformLinker final : angle::NonCopyable std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType); + ShaderType shaderType); ShaderUniformCount flattenArrayOfStructsUniform( const sh::ShaderVariable &uniform, @@ -117,7 +114,9 @@ class UniformLinker final : angle::NonCopyable std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -129,7 +128,8 @@ class UniformLinker final : angle::NonCopyable std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -141,21 +141,23 @@ class UniformLinker final : angle::NonCopyable std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, int *location); - // markStaticUse is given as a separate parameter because it is tracked here at struct - // granularity. + // markActive and markStaticUse are given as separate parameters because they are tracked here + // at struct granularity. ShaderUniformCount flattenUniformImpl(const sh::ShaderVariable &uniform, const std::string &fullName, const std::string &fullMappedName, std::vector *samplerUniforms, std::vector *imageUniforms, std::vector *atomicCounterUniforms, - GLenum shaderType, + ShaderType shaderType, + bool markActive, bool markStaticUse, int binding, int offset, @@ -164,7 +166,6 @@ class UniformLinker final : angle::NonCopyable bool indexUniforms(InfoLog &infoLog, const ProgramBindings &uniformLocationBindings); bool gatherUniformLocationsAndCheckConflicts(InfoLog &infoLog, const ProgramBindings &uniformLocationBindings, - std::set *reservedLocations, std::set *ignoredLocations, int *maxUniformLocation); void pruneUnusedUniforms(); @@ -189,7 +190,7 @@ class InterfaceBlockLinker : angle::NonCopyable // This is called once per shader stage. It stores a pointer to the block vector, so it's // important that this class does not persist longer than the duration of Program::link. - void addShaderBlocks(GLenum shader, const std::vector *blocks); + void addShaderBlocks(ShaderType shader, const std::vector *blocks); // This is called once during a link operation, after all shader blocks are added. void linkBlocks(const GetBlockSize &getBlockSize, @@ -200,7 +201,7 @@ class InterfaceBlockLinker : angle::NonCopyable void defineInterfaceBlock(const GetBlockSize &getBlockSize, const GetBlockMemberInfo &getMemberInfo, const sh::InterfaceBlock &interfaceBlock, - GLenum shaderType) const; + ShaderType shaderType) const; template void defineBlockMembers(const GetBlockMemberInfo &getMemberInfo, @@ -210,7 +211,7 @@ class InterfaceBlockLinker : angle::NonCopyable int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const; + ShaderType shaderType) const; template void defineBlockMember(const GetBlockMemberInfo &getMemberInfo, const VarT &field, @@ -219,7 +220,7 @@ class InterfaceBlockLinker : angle::NonCopyable int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const; + ShaderType shaderType) const; virtual void defineBlockMemberImpl(const sh::ShaderVariable &field, const std::string &fullName, @@ -227,13 +228,13 @@ class InterfaceBlockLinker : angle::NonCopyable int blockIndex, const sh::BlockMemberInfo &memberInfo, int topLevelArraySize, - GLenum shaderType) const = 0; + ShaderType shaderType) const = 0; virtual size_t getCurrentBlockMemberIndex() const = 0; - virtual void updateBlockMemberStaticUsedImpl(const std::string &fullName, - GLenum shaderType, - bool staticUse) const = 0; + virtual void updateBlockMemberActiveImpl(const std::string &fullName, + ShaderType shaderType, + bool active) const = 0; - using ShaderBlocks = std::pair *>; + using ShaderBlocks = std::pair *>; std::vector mShaderBlocks; std::vector *mBlocksOut; @@ -248,7 +249,7 @@ class InterfaceBlockLinker : angle::NonCopyable int blockIndex, bool singleEntryForTopLevelArray, int topLevelArraySize, - GLenum shaderType) const; + ShaderType shaderType) const; }; class UniformBlockLinker final : public InterfaceBlockLinker @@ -265,11 +266,11 @@ class UniformBlockLinker final : public InterfaceBlockLinker int blockIndex, const sh::BlockMemberInfo &memberInfo, int topLevelArraySize, - GLenum shaderType) const override; + ShaderType shaderType) const override; size_t getCurrentBlockMemberIndex() const override; - void updateBlockMemberStaticUsedImpl(const std::string &fullName, - GLenum shaderType, - bool staticUse) const override; + void updateBlockMemberActiveImpl(const std::string &fullName, + ShaderType shaderType, + bool active) const override; std::vector *mUniformsOut; }; @@ -287,11 +288,11 @@ class ShaderStorageBlockLinker final : public InterfaceBlockLinker int blockIndex, const sh::BlockMemberInfo &memberInfo, int topLevelArraySize, - GLenum shaderType) const override; + ShaderType shaderType) const override; size_t getCurrentBlockMemberIndex() const override; - void updateBlockMemberStaticUsedImpl(const std::string &fullName, - GLenum shaderType, - bool staticUse) const override; + void updateBlockMemberActiveImpl(const std::string &fullName, + ShaderType shaderType, + bool active) const override; std::vector *mBufferVariablesOut; }; diff --git a/gfx/angle/checkout/src/libANGLE/RefCountObject.h b/gfx/angle/checkout/src/libANGLE/RefCountObject.h index cb41cc27f4c0..543a69d31556 100644 --- a/gfx/angle/checkout/src/libANGLE/RefCountObject.h +++ b/gfx/angle/checkout/src/libANGLE/RefCountObject.h @@ -124,9 +124,12 @@ class BindingPointer { // addRef first in case newObject == mObject and this is the last reference to it. if (newObject != nullptr) reinterpret_cast(newObject)->addRef(); - if (mObject != nullptr) - reinterpret_cast(mObject)->release(context); + // Store the old pointer in a temporary so we can set the pointer before calling release. + // Otherwise the object could still be referenced when its destructor is called. + ObjectType *oldObject = mObject; mObject = newObject; + if (oldObject != nullptr) + reinterpret_cast(oldObject)->release(context); } ObjectType *get() const { return mObject; } diff --git a/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp b/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp index c797d15210ba..d321db07d413 100644 --- a/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp +++ b/gfx/angle/checkout/src/libANGLE/Renderbuffer.cpp @@ -109,7 +109,7 @@ Error Renderbuffer::setStorage(const Context *context, mState.update(static_cast(width), static_cast(height), Format(internalformat), 0, InitState::MayNeedInit); - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStorageChange(context); return NoError(); } @@ -126,7 +126,7 @@ Error Renderbuffer::setStorageMultisample(const Context *context, mState.update(static_cast(width), static_cast(height), Format(internalformat), static_cast(samples), InitState::MayNeedInit); - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStorageChange(context); return NoError(); } @@ -140,7 +140,7 @@ Error Renderbuffer::setStorageEGLImageTarget(const Context *context, egl::Image mState.update(static_cast(image->getWidth()), static_cast(image->getHeight()), Format(image->getFormat()), 0, image->sourceInitState()); - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStorageChange(context); return NoError(); } diff --git a/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp b/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp index a7c0af4ec13d..a2e944dd882e 100644 --- a/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp +++ b/gfx/angle/checkout/src/libANGLE/ResourceManager.cpp @@ -161,10 +161,9 @@ void ShaderProgramManager::reset(const Context *context) GLuint ShaderProgramManager::createShader(rx::GLImplFactory *factory, const gl::Limitations &rendererLimitations, - GLenum type) + ShaderType type) { - ASSERT(type == GL_VERTEX_SHADER || type == GL_FRAGMENT_SHADER || type == GL_COMPUTE_SHADER || - type == GL_GEOMETRY_SHADER_EXT); + ASSERT(type != ShaderType::InvalidEnum); GLuint handle = mHandleAllocator.allocate(); mShaders.assign(handle, new Shader(this, factory, rendererLimitations, type, handle)); return handle; @@ -223,9 +222,11 @@ void ShaderProgramManager::deleteObject(const Context *context, // TextureManager Implementation. // static -Texture *TextureManager::AllocateNewObject(rx::GLImplFactory *factory, GLuint handle, GLenum target) +Texture *TextureManager::AllocateNewObject(rx::GLImplFactory *factory, + GLuint handle, + TextureType type) { - Texture *texture = new Texture(factory, handle, target); + Texture *texture = new Texture(factory, handle, type); texture->addRef(); return texture; } diff --git a/gfx/angle/checkout/src/libANGLE/ResourceManager.h b/gfx/angle/checkout/src/libANGLE/ResourceManager.h index c5b0d376b4ad..42e05305eda9 100644 --- a/gfx/angle/checkout/src/libANGLE/ResourceManager.h +++ b/gfx/angle/checkout/src/libANGLE/ResourceManager.h @@ -130,7 +130,7 @@ class ShaderProgramManager : public ResourceManagerBase GLuint createShader(rx::GLImplFactory *factory, const Limitations &rendererLimitations, - GLenum type); + ShaderType type); void deleteShader(const Context *context, GLuint shader); Shader *getShader(GLuint handle) const; @@ -159,12 +159,12 @@ class TextureManager : public TypedResourceManager GetActiveShaderVariables(const std::vector *variableList for (size_t varIndex = 0; varIndex < variableList->size(); varIndex++) { const VarT &var = variableList->at(varIndex); - if (var.staticUse) + if (var.active) { result.push_back(var); } @@ -74,20 +74,20 @@ bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y) return gl::VariableSortOrder(x.type) < gl::VariableSortOrder(y.type); } -const char *GetShaderTypeString(GLenum type) +const char *GetShaderTypeString(ShaderType type) { switch (type) { - case GL_VERTEX_SHADER: + case ShaderType::Vertex: return "VERTEX"; - case GL_FRAGMENT_SHADER: + case ShaderType::Fragment: return "FRAGMENT"; - case GL_COMPUTE_SHADER: + case ShaderType::Compute: return "COMPUTE"; - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: return "GEOMETRY"; default: @@ -96,7 +96,7 @@ const char *GetShaderTypeString(GLenum type) } } -ShaderState::ShaderState(GLenum shaderType) +ShaderState::ShaderState(ShaderType shaderType) : mLabel(), mShaderType(shaderType), mShaderVersion(100), @@ -114,7 +114,7 @@ ShaderState::~ShaderState() Shader::Shader(ShaderProgramManager *manager, rx::GLImplFactory *implFactory, const gl::Limitations &rendererLimitations, - GLenum type, + ShaderType type, GLuint handle) : mState(type), mImplementation(implFactory->createShader(mState)), @@ -394,22 +394,22 @@ void Shader::resolveCompile(const Context *context) switch (mState.mShaderType) { - case GL_COMPUTE_SHADER: + case ShaderType::Compute: { mState.mLocalSize = sh::GetComputeShaderLocalGroupSize(compilerHandle); break; } - case GL_VERTEX_SHADER: + case ShaderType::Vertex: { { mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle)); - mState.mActiveAttributes = - GetActiveShaderVariables(sh::GetAttributes(compilerHandle)); + mState.mAllAttributes = GetShaderVariables(sh::GetAttributes(compilerHandle)); + mState.mActiveAttributes = GetActiveShaderVariables(&mState.mAllAttributes); mState.mNumViews = sh::GetVertexShaderNumViews(compilerHandle); } break; } - case GL_FRAGMENT_SHADER: + case ShaderType::Fragment: { mState.mInputVaryings = GetShaderVariables(sh::GetInputVaryings(compilerHandle)); // TODO(jmadill): Figure out why we only sort in the FS, and if we need to. @@ -418,7 +418,7 @@ void Shader::resolveCompile(const Context *context) GetActiveShaderVariables(sh::GetOutputVariables(compilerHandle)); break; } - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: { mState.mInputVaryings = GetShaderVariables(sh::GetInputVaryings(compilerHandle)); mState.mOutputVaryings = GetShaderVariables(sh::GetOutputVaryings(compilerHandle)); @@ -529,6 +529,12 @@ const std::vector &Shader::getActiveAttributes(const Context *con return mState.getActiveAttributes(); } +const std::vector &Shader::getAllAttributes(const Context *context) +{ + resolveCompile(context); + return mState.getAllAttributes(); +} + const std::vector &Shader::getActiveOutputVariables(const Context *context) { resolveCompile(context); @@ -539,7 +545,7 @@ std::string Shader::getTransformFeedbackVaryingMappedName(const std::string &tfV const Context *context) { // TODO(jiawei.shao@intel.com): support transform feedback on geometry shader. - ASSERT(mState.getShaderType() == GL_VERTEX_SHADER); + ASSERT(mState.getShaderType() == ShaderType::Vertex); const auto &varyings = getOutputVaryings(context); auto bracketPos = tfVaryingName.find("["); if (bracketPos != std::string::npos) diff --git a/gfx/angle/checkout/src/libANGLE/Shader.h b/gfx/angle/checkout/src/libANGLE/Shader.h index d9d658700459..a3b5f249bd5f 100644 --- a/gfx/angle/checkout/src/libANGLE/Shader.h +++ b/gfx/angle/checkout/src/libANGLE/Shader.h @@ -51,7 +51,7 @@ enum class CompileStatus class ShaderState final : angle::NonCopyable { public: - ShaderState(GLenum shaderType); + ShaderState(ShaderType shaderType); ~ShaderState(); const std::string &getLabel() const { return mLabel; } @@ -59,7 +59,7 @@ class ShaderState final : angle::NonCopyable const std::string &getSource() const { return mSource; } const std::string &getTranslatedSource() const { return mTranslatedSource; } - GLenum getShaderType() const { return mShaderType; } + ShaderType getShaderType() const { return mShaderType; } int getShaderVersion() const { return mShaderVersion; } const std::vector &getInputVaryings() const { return mInputVaryings; } @@ -71,6 +71,7 @@ class ShaderState final : angle::NonCopyable return mShaderStorageBlocks; } const std::vector &getActiveAttributes() const { return mActiveAttributes; } + const std::vector &getAllAttributes() const { return mAllAttributes; } const std::vector &getActiveOutputVariables() const { return mActiveOutputVariables; @@ -83,7 +84,7 @@ class ShaderState final : angle::NonCopyable std::string mLabel; - GLenum mShaderType; + ShaderType mShaderType; int mShaderVersion; std::string mTranslatedSource; std::string mSource; @@ -95,6 +96,7 @@ class ShaderState final : angle::NonCopyable std::vector mUniforms; std::vector mUniformBlocks; std::vector mShaderStorageBlocks; + std::vector mAllAttributes; std::vector mActiveAttributes; std::vector mActiveOutputVariables; @@ -117,7 +119,7 @@ class Shader final : angle::NonCopyable, public LabeledObject Shader(ShaderProgramManager *manager, rx::GLImplFactory *implFactory, const gl::Limitations &rendererLimitations, - GLenum type, + ShaderType type, GLuint handle); void onDestroy(const Context *context); @@ -125,7 +127,7 @@ class Shader final : angle::NonCopyable, public LabeledObject void setLabel(const std::string &label) override; const std::string &getLabel() const override; - GLenum getType() const { return mType; } + ShaderType getType() const { return mType; } GLuint getHandle() const; rx::ShaderImpl *getImplementation() const { return mImplementation.get(); } @@ -165,6 +167,7 @@ class Shader final : angle::NonCopyable, public LabeledObject const std::vector &getUniformBlocks(const Context *context); const std::vector &getShaderStorageBlocks(const Context *context); const std::vector &getActiveAttributes(const Context *context); + const std::vector &getAllAttributes(const Context *context); const std::vector &getActiveOutputVariables(const Context *context); // Returns mapped name of a transform feedback varying. The original name may contain array @@ -200,7 +203,7 @@ class Shader final : angle::NonCopyable, public LabeledObject std::unique_ptr mImplementation; const gl::Limitations &mRendererLimitations; const GLuint mHandle; - const GLenum mType; + const ShaderType mType; unsigned int mRefCount; // Number of program objects this shader is attached to bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use std::string mInfoLog; @@ -213,7 +216,7 @@ class Shader final : angle::NonCopyable, public LabeledObject bool CompareShaderVar(const sh::ShaderVariable &x, const sh::ShaderVariable &y); -const char *GetShaderTypeString(GLenum type); +const char *GetShaderTypeString(ShaderType type); } // namespace gl #endif // LIBANGLE_SHADER_H_ diff --git a/gfx/angle/checkout/src/libANGLE/State.cpp b/gfx/angle/checkout/src/libANGLE/State.cpp index 719bfe8a828f..a81fe6f2aa4e 100644 --- a/gfx/angle/checkout/src/libANGLE/State.cpp +++ b/gfx/angle/checkout/src/libANGLE/State.cpp @@ -8,8 +8,8 @@ #include "libANGLE/State.h" -#include #include +#include #include "common/bitset_utils.h" #include "common/mathutil.h" @@ -38,6 +38,32 @@ GLenum ActiveQueryType(const GLenum type) namespace gl { +void UpdateBufferBinding(const Context *context, + BindingPointer *binding, + Buffer *buffer, + BufferBinding target) +{ + if (binding->get()) + (*binding)->onBindingChanged(false, target); + binding->set(context, buffer); + if (binding->get()) + (*binding)->onBindingChanged(true, target); +} + +void UpdateBufferBinding(const Context *context, + OffsetBindingPointer *binding, + Buffer *buffer, + BufferBinding target, + GLintptr offset, + GLsizeiptr size) +{ + if (binding->get()) + (*binding)->onBindingChanged(false, target); + binding->set(context, buffer, offset, size); + if (binding->get()) + (*binding)->onBindingChanged(true, target); +} + State::State() : mMaxDrawBuffers(0), mMaxCombinedTextureImageUnits(0), @@ -83,42 +109,42 @@ void State::initialize(const Context *context, bool robustResourceInit, bool programBinaryCacheEnabled) { - const Caps &caps = context->getCaps(); - const Extensions &extensions = context->getExtensions(); + const Caps &caps = context->getCaps(); + const Extensions &extensions = context->getExtensions(); const Extensions &nativeExtensions = context->getImplementation()->getNativeExtensions(); - const Version &clientVersion = context->getClientVersion(); + const Version &clientVersion = context->getClientVersion(); - mMaxDrawBuffers = caps.maxDrawBuffers; + mMaxDrawBuffers = caps.maxDrawBuffers; mMaxCombinedTextureImageUnits = caps.maxCombinedTextureImageUnits; setColorClearValue(0.0f, 0.0f, 0.0f, 0.0f); - mDepthClearValue = 1.0f; + mDepthClearValue = 1.0f; mStencilClearValue = 0; - mScissorTest = false; - mScissor.x = 0; - mScissor.y = 0; - mScissor.width = 0; + mScissorTest = false; + mScissor.x = 0; + mScissor.y = 0; + mScissor.width = 0; mScissor.height = 0; - mBlendColor.red = 0; + mBlendColor.red = 0; mBlendColor.green = 0; - mBlendColor.blue = 0; + mBlendColor.blue = 0; mBlendColor.alpha = 0; - mStencilRef = 0; + mStencilRef = 0; mStencilBackRef = 0; - mSampleCoverage = false; - mSampleCoverageValue = 1.0f; + mSampleCoverage = false; + mSampleCoverageValue = 1.0f; mSampleCoverageInvert = false; mMaxSampleMaskWords = caps.maxSampleMaskWords; mSampleMask = false; mSampleMaskValues.fill(~GLbitfield(0)); - mGenerateMipmapHint = GL_DONT_CARE; + mGenerateMipmapHint = GL_DONT_CARE; mFragmentShaderDerivativeHint = GL_DONT_CARE; mBindGeneratesResource = bindGeneratesResource; @@ -126,16 +152,16 @@ void State::initialize(const Context *context, mLineWidth = 1.0f; - mViewport.x = 0; - mViewport.y = 0; - mViewport.width = 0; + mViewport.x = 0; + mViewport.y = 0; + mViewport.width = 0; mViewport.height = 0; - mNearZ = 0.0f; - mFarZ = 1.0f; + mNearZ = 0.0f; + mFarZ = 1.0f; - mBlend.colorMaskRed = true; + mBlend.colorMaskRed = true; mBlend.colorMaskGreen = true; - mBlend.colorMaskBlue = true; + mBlend.colorMaskBlue = true; mBlend.colorMaskAlpha = true; mActiveSampler = 0; @@ -150,17 +176,17 @@ void State::initialize(const Context *context, mUniformBuffers.resize(caps.maxUniformBufferBindings); - mSamplerTextures[GL_TEXTURE_2D].resize(caps.maxCombinedTextureImageUnits); - mSamplerTextures[GL_TEXTURE_CUBE_MAP].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::_2D].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::CubeMap].resize(caps.maxCombinedTextureImageUnits); if (clientVersion >= Version(3, 0)) { // TODO: These could also be enabled via extension - mSamplerTextures[GL_TEXTURE_2D_ARRAY].resize(caps.maxCombinedTextureImageUnits); - mSamplerTextures[GL_TEXTURE_3D].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::_2DArray].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::_3D].resize(caps.maxCombinedTextureImageUnits); } if (clientVersion >= Version(3, 1)) { - mSamplerTextures[GL_TEXTURE_2D_MULTISAMPLE].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::_2DMultisample].resize(caps.maxCombinedTextureImageUnits); mAtomicCounterBuffers.resize(caps.maxAtomicCounterBufferBindings); mShaderStorageBuffers.resize(caps.maxShaderStorageBufferBindings); @@ -168,11 +194,11 @@ void State::initialize(const Context *context, } if (nativeExtensions.textureRectangle) { - mSamplerTextures[GL_TEXTURE_RECTANGLE_ANGLE].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::Rectangle].resize(caps.maxCombinedTextureImageUnits); } if (nativeExtensions.eglImageExternal || nativeExtensions.eglStreamConsumerExternal) { - mSamplerTextures[GL_TEXTURE_EXTERNAL_OES].resize(caps.maxCombinedTextureImageUnits); + mSamplerTextures[TextureType::External].resize(caps.maxCombinedTextureImageUnits); } mCompleteTextureCache.resize(caps.maxCombinedTextureImageUnits, nullptr); mCompleteTextureBindings.reserve(caps.maxCombinedTextureImageUnits); @@ -190,6 +216,7 @@ void State::initialize(const Context *context, mActiveQueries[GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN].set(context, nullptr); mActiveQueries[GL_TIME_ELAPSED_EXT].set(context, nullptr); mActiveQueries[GL_COMMANDS_COMPLETED_CHROMIUM].set(context, nullptr); + mActiveQueries[GL_PRIMITIVES_GENERATED_EXT].set(context, nullptr); mProgram = nullptr; @@ -212,18 +239,24 @@ void State::initialize(const Context *context, mPathStencilRef = 0; mPathStencilMask = std::numeric_limits::max(); - mRobustResourceInit = robustResourceInit; + mRobustResourceInit = robustResourceInit; mProgramBinaryCacheEnabled = programBinaryCacheEnabled; + + // GLES1 emulation: Initialize state for GLES1 if version + // applies + if (clientVersion < Version(2, 0)) + { + mGLES1State.initialize(context, this); + } } void State::reset(const Context *context) { for (auto &bindingVec : mSamplerTextures) { - TextureBindingVector &textureVector = bindingVec.second; - for (size_t textureIdx = 0; textureIdx < textureVector.size(); textureIdx++) + for (size_t textureIdx = 0; textureIdx < bindingVec.size(); textureIdx++) { - textureVector[textureIdx].set(context, nullptr); + bindingVec[textureIdx].set(context, nullptr); } } for (size_t samplerIdx = 0; samplerIdx < mSamplers.size(); samplerIdx++) @@ -245,7 +278,7 @@ void State::reset(const Context *context) for (auto type : angle::AllEnums()) { - mBoundBuffers[type].set(context, nullptr); + UpdateBufferBinding(context, &mBoundBuffers[type], nullptr, type); } if (mProgram) @@ -256,6 +289,8 @@ void State::reset(const Context *context) mProgramPipeline.set(context, nullptr); + if (mTransformFeedback.get()) + mTransformFeedback->onBindingChanged(false); mTransformFeedback.set(context, nullptr); for (State::ActiveQueryMap::iterator i = mActiveQueries.begin(); i != mActiveQueries.end(); i++) @@ -265,17 +300,17 @@ void State::reset(const Context *context) for (auto &buf : mUniformBuffers) { - buf.set(context, nullptr); + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::Uniform); } for (auto &buf : mAtomicCounterBuffers) { - buf.set(context, nullptr); + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::AtomicCounter); } for (auto &buf : mShaderStorageBuffers) { - buf.set(context, nullptr); + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::ShaderStorage); } angle::Matrix::setToIdentity(mPathMatrixProj); @@ -305,9 +340,9 @@ const DepthStencilState &State::getDepthStencilState() const void State::setColorClearValue(float red, float green, float blue, float alpha) { - mColorClearValue.red = red; + mColorClearValue.red = red; mColorClearValue.green = green; - mColorClearValue.blue = blue; + mColorClearValue.blue = blue; mColorClearValue.alpha = alpha; mDirtyBits.set(DIRTY_BIT_CLEAR_COLOR); } @@ -326,9 +361,9 @@ void State::setStencilClearValue(int stencil) void State::setColorMask(bool red, bool green, bool blue, bool alpha) { - mBlend.colorMaskRed = red; + mBlend.colorMaskRed = red; mBlend.colorMaskGreen = green; - mBlend.colorMaskBlue = blue; + mBlend.colorMaskBlue = blue; mBlend.colorMaskAlpha = alpha; mDirtyBits.set(DIRTY_BIT_COLOR_MASK); } @@ -386,14 +421,14 @@ void State::setDepthTest(bool enabled) void State::setDepthFunc(GLenum depthFunc) { - mDepthStencil.depthFunc = depthFunc; - mDirtyBits.set(DIRTY_BIT_DEPTH_FUNC); + mDepthStencil.depthFunc = depthFunc; + mDirtyBits.set(DIRTY_BIT_DEPTH_FUNC); } void State::setDepthRange(float zNear, float zFar) { mNearZ = zNear; - mFarZ = zFar; + mFarZ = zFar; mDirtyBits.set(DIRTY_BIT_DEPTH_RANGE); } @@ -420,25 +455,25 @@ void State::setBlend(bool enabled) void State::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha) { - mBlend.sourceBlendRGB = sourceRGB; - mBlend.destBlendRGB = destRGB; + mBlend.sourceBlendRGB = sourceRGB; + mBlend.destBlendRGB = destRGB; mBlend.sourceBlendAlpha = sourceAlpha; - mBlend.destBlendAlpha = destAlpha; + mBlend.destBlendAlpha = destAlpha; mDirtyBits.set(DIRTY_BIT_BLEND_FUNCS); } void State::setBlendColor(float red, float green, float blue, float alpha) { - mBlendColor.red = red; + mBlendColor.red = red; mBlendColor.green = green; - mBlendColor.blue = blue; + mBlendColor.blue = blue; mBlendColor.alpha = alpha; mDirtyBits.set(DIRTY_BIT_BLEND_COLOR); } void State::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation) { - mBlend.blendEquationRGB = rgbEquation; + mBlend.blendEquationRGB = rgbEquation; mBlend.blendEquationAlpha = alphaEquation; mDirtyBits.set(DIRTY_BIT_BLEND_EQUATIONS); } @@ -462,15 +497,17 @@ void State::setStencilTest(bool enabled) void State::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask) { mDepthStencil.stencilFunc = stencilFunc; - mStencilRef = (stencilRef > 0) ? stencilRef : 0; + mStencilRef = (stencilRef > 0) ? stencilRef : 0; mDepthStencil.stencilMask = stencilMask; mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_FRONT); } -void State::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask) +void State::setStencilBackParams(GLenum stencilBackFunc, + GLint stencilBackRef, + GLuint stencilBackMask) { mDepthStencil.stencilBackFunc = stencilBackFunc; - mStencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0; + mStencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0; mDepthStencil.stencilBackMask = stencilBackMask; mDirtyBits.set(DIRTY_BIT_STENCIL_FUNCS_BACK); } @@ -487,17 +524,21 @@ void State::setStencilBackWritemask(GLuint stencilBackWritemask) mDirtyBits.set(DIRTY_BIT_STENCIL_WRITEMASK_BACK); } -void State::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass) +void State::setStencilOperations(GLenum stencilFail, + GLenum stencilPassDepthFail, + GLenum stencilPassDepthPass) { - mDepthStencil.stencilFail = stencilFail; + mDepthStencil.stencilFail = stencilFail; mDepthStencil.stencilPassDepthFail = stencilPassDepthFail; mDepthStencil.stencilPassDepthPass = stencilPassDepthPass; mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_FRONT); } -void State::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass) +void State::setStencilBackOperations(GLenum stencilBackFail, + GLenum stencilBackPassDepthFail, + GLenum stencilBackPassDepthPass) { - mDepthStencil.stencilBackFail = stencilBackFail; + mDepthStencil.stencilBackFail = stencilBackFail; mDepthStencil.stencilBackPassDepthFail = stencilBackPassDepthFail; mDepthStencil.stencilBackPassDepthPass = stencilBackPassDepthPass; mDirtyBits.set(DIRTY_BIT_STENCIL_OPS_BACK); @@ -528,7 +569,7 @@ void State::setPolygonOffsetParams(GLfloat factor, GLfloat units) { // An application can pass NaN values here, so handle this gracefully mRasterizer.polygonOffsetFactor = factor != factor ? 0.0f : factor; - mRasterizer.polygonOffsetUnits = units != units ? 0.0f : units; + mRasterizer.polygonOffsetUnits = units != units ? 0.0f : units; mDirtyBits.set(DIRTY_BIT_POLYGON_OFFSET); } @@ -556,7 +597,7 @@ void State::setSampleCoverage(bool enabled) void State::setSampleCoverageParams(GLclampf value, bool invert) { - mSampleCoverageValue = value; + mSampleCoverageValue = value; mSampleCoverageInvert = invert; mDirtyBits.set(DIRTY_BIT_SAMPLE_COVERAGE); } @@ -636,9 +677,9 @@ void State::setScissorTest(bool enabled) void State::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height) { - mScissor.x = x; - mScissor.y = y; - mScissor.width = width; + mScissor.x = x; + mScissor.y = y; + mScissor.width = width; mScissor.height = height; mDirtyBits.set(DIRTY_BIT_SCISSOR); } @@ -674,32 +715,65 @@ void State::setEnableFeature(GLenum feature, bool enabled) { switch (feature) { - case GL_MULTISAMPLE_EXT: setMultisampling(enabled); break; - case GL_SAMPLE_ALPHA_TO_ONE_EXT: setSampleAlphaToOne(enabled); break; - case GL_CULL_FACE: setCullFace(enabled); break; - case GL_POLYGON_OFFSET_FILL: setPolygonOffsetFill(enabled); break; - case GL_SAMPLE_ALPHA_TO_COVERAGE: setSampleAlphaToCoverage(enabled); break; - case GL_SAMPLE_COVERAGE: setSampleCoverage(enabled); break; - case GL_SCISSOR_TEST: setScissorTest(enabled); break; - case GL_STENCIL_TEST: setStencilTest(enabled); break; - case GL_DEPTH_TEST: setDepthTest(enabled); break; - case GL_BLEND: setBlend(enabled); break; - case GL_DITHER: setDither(enabled); break; - case GL_PRIMITIVE_RESTART_FIXED_INDEX: setPrimitiveRestart(enabled); break; - case GL_RASTERIZER_DISCARD: setRasterizerDiscard(enabled); break; - case GL_SAMPLE_MASK: - setSampleMaskEnabled(enabled); - break; - case GL_DEBUG_OUTPUT_SYNCHRONOUS: - mDebug.setOutputSynchronous(enabled); - break; - case GL_DEBUG_OUTPUT: - mDebug.setOutputEnabled(enabled); - break; - case GL_FRAMEBUFFER_SRGB_EXT: - setFramebufferSRGB(enabled); - break; - default: UNREACHABLE(); + case GL_MULTISAMPLE_EXT: + setMultisampling(enabled); + break; + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + setSampleAlphaToOne(enabled); + break; + case GL_CULL_FACE: + setCullFace(enabled); + break; + case GL_POLYGON_OFFSET_FILL: + setPolygonOffsetFill(enabled); + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE: + setSampleAlphaToCoverage(enabled); + break; + case GL_SAMPLE_COVERAGE: + setSampleCoverage(enabled); + break; + case GL_SCISSOR_TEST: + setScissorTest(enabled); + break; + case GL_STENCIL_TEST: + setStencilTest(enabled); + break; + case GL_DEPTH_TEST: + setDepthTest(enabled); + break; + case GL_BLEND: + setBlend(enabled); + break; + case GL_DITHER: + setDither(enabled); + break; + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + setPrimitiveRestart(enabled); + break; + case GL_RASTERIZER_DISCARD: + setRasterizerDiscard(enabled); + break; + case GL_SAMPLE_MASK: + setSampleMaskEnabled(enabled); + break; + case GL_DEBUG_OUTPUT_SYNCHRONOUS: + mDebug.setOutputSynchronous(enabled); + break; + case GL_DEBUG_OUTPUT: + mDebug.setOutputEnabled(enabled); + break; + case GL_FRAMEBUFFER_SRGB_EXT: + setFramebufferSRGB(enabled); + break; + + // GLES1 emulation + case GL_ALPHA_TEST: + mGLES1State.mAlphaTestEnabled = enabled; + break; + + default: + UNREACHABLE(); } } @@ -707,39 +781,56 @@ bool State::getEnableFeature(GLenum feature) const { switch (feature) { - case GL_MULTISAMPLE_EXT: return isMultisamplingEnabled(); - case GL_SAMPLE_ALPHA_TO_ONE_EXT: return isSampleAlphaToOneEnabled(); - case GL_CULL_FACE: return isCullFaceEnabled(); - case GL_POLYGON_OFFSET_FILL: return isPolygonOffsetFillEnabled(); - case GL_SAMPLE_ALPHA_TO_COVERAGE: return isSampleAlphaToCoverageEnabled(); - case GL_SAMPLE_COVERAGE: return isSampleCoverageEnabled(); - case GL_SCISSOR_TEST: return isScissorTestEnabled(); - case GL_STENCIL_TEST: return isStencilTestEnabled(); - case GL_DEPTH_TEST: return isDepthTestEnabled(); - case GL_BLEND: return isBlendEnabled(); - case GL_DITHER: return isDitherEnabled(); - case GL_PRIMITIVE_RESTART_FIXED_INDEX: return isPrimitiveRestartEnabled(); - case GL_RASTERIZER_DISCARD: return isRasterizerDiscardEnabled(); - case GL_SAMPLE_MASK: - return isSampleMaskEnabled(); - case GL_DEBUG_OUTPUT_SYNCHRONOUS: - return mDebug.isOutputSynchronous(); - case GL_DEBUG_OUTPUT: - return mDebug.isOutputEnabled(); - case GL_BIND_GENERATES_RESOURCE_CHROMIUM: - return isBindGeneratesResourceEnabled(); - case GL_CLIENT_ARRAYS_ANGLE: - return areClientArraysEnabled(); - case GL_FRAMEBUFFER_SRGB_EXT: - return getFramebufferSRGB(); - case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE: - return mRobustResourceInit; - case GL_PROGRAM_CACHE_ENABLED_ANGLE: - return mProgramBinaryCacheEnabled; + case GL_MULTISAMPLE_EXT: + return isMultisamplingEnabled(); + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + return isSampleAlphaToOneEnabled(); + case GL_CULL_FACE: + return isCullFaceEnabled(); + case GL_POLYGON_OFFSET_FILL: + return isPolygonOffsetFillEnabled(); + case GL_SAMPLE_ALPHA_TO_COVERAGE: + return isSampleAlphaToCoverageEnabled(); + case GL_SAMPLE_COVERAGE: + return isSampleCoverageEnabled(); + case GL_SCISSOR_TEST: + return isScissorTestEnabled(); + case GL_STENCIL_TEST: + return isStencilTestEnabled(); + case GL_DEPTH_TEST: + return isDepthTestEnabled(); + case GL_BLEND: + return isBlendEnabled(); + case GL_DITHER: + return isDitherEnabled(); + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + return isPrimitiveRestartEnabled(); + case GL_RASTERIZER_DISCARD: + return isRasterizerDiscardEnabled(); + case GL_SAMPLE_MASK: + return isSampleMaskEnabled(); + case GL_DEBUG_OUTPUT_SYNCHRONOUS: + return mDebug.isOutputSynchronous(); + case GL_DEBUG_OUTPUT: + return mDebug.isOutputEnabled(); + case GL_BIND_GENERATES_RESOURCE_CHROMIUM: + return isBindGeneratesResourceEnabled(); + case GL_CLIENT_ARRAYS_ANGLE: + return areClientArraysEnabled(); + case GL_FRAMEBUFFER_SRGB_EXT: + return getFramebufferSRGB(); + case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE: + return mRobustResourceInit; + case GL_PROGRAM_CACHE_ENABLED_ANGLE: + return mProgramBinaryCacheEnabled; - default: - UNREACHABLE(); - return false; + // GLES1 emulation + case GL_ALPHA_TEST: + return mGLES1State.mAlphaTestEnabled; + + default: + UNREACHABLE(); + return false; } } @@ -781,9 +872,9 @@ bool State::areClientArraysEnabled() const void State::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height) { - mViewport.x = x; - mViewport.y = y; - mViewport.width = width; + mViewport.x = x; + mViewport.y = y; + mViewport.width = width; mViewport.height = height; mDirtyBits.set(DIRTY_BIT_VIEWPORT); } @@ -803,32 +894,28 @@ unsigned int State::getActiveSampler() const return static_cast(mActiveSampler); } -void State::setSamplerTexture(const Context *context, GLenum type, Texture *texture) +void State::setSamplerTexture(const Context *context, TextureType type, Texture *texture) { mSamplerTextures[type][mActiveSampler].set(context, texture); mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS); mDirtyObjects.set(DIRTY_OBJECT_PROGRAM_TEXTURES); } -Texture *State::getTargetTexture(GLenum target) const +Texture *State::getTargetTexture(TextureType type) const { - return getSamplerTexture(static_cast(mActiveSampler), target); + return getSamplerTexture(static_cast(mActiveSampler), type); } -Texture *State::getSamplerTexture(unsigned int sampler, GLenum type) const +Texture *State::getSamplerTexture(unsigned int sampler, TextureType type) const { - const auto it = mSamplerTextures.find(type); - ASSERT(it != mSamplerTextures.end()); - ASSERT(sampler < it->second.size()); - return it->second[sampler].get(); + ASSERT(sampler < mSamplerTextures[type].size()); + return mSamplerTextures[type][sampler].get(); } -GLuint State::getSamplerTextureId(unsigned int sampler, GLenum type) const +GLuint State::getSamplerTextureId(unsigned int sampler, TextureType type) const { - const auto it = mSamplerTextures.find(type); - ASSERT(it != mSamplerTextures.end()); - ASSERT(sampler < it->second.size()); - return it->second[sampler].id(); + ASSERT(sampler < mSamplerTextures[type].size()); + return mSamplerTextures[type][sampler].id(); } void State::detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture) @@ -839,21 +926,20 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures // the ResourceManager. // [OpenGL ES 2.0.24] section 3.8 page 84: - // If a texture object is deleted, it is as if all texture units which are bound to that texture object are - // rebound to texture object zero + // If a texture object is deleted, it is as if all texture units which are bound to that texture + // object are rebound to texture object zero - for (auto &bindingVec : mSamplerTextures) + for (TextureType type : angle::AllEnums()) { - GLenum textureType = bindingVec.first; - TextureBindingVector &textureVector = bindingVec.second; + TextureBindingVector &textureVector = mSamplerTextures[type]; for (BindingPointer &binding : textureVector) { if (binding.id() == texture) { - auto it = zeroTextures.find(textureType); - ASSERT(it != zeroTextures.end()); + Texture *zeroTexture = zeroTextures[type].get(); + ASSERT(zeroTexture != nullptr); // Zero textures are the "default" textures instead of NULL - binding.set(context, it->second.get()); + binding.set(context, zeroTexture); mDirtyBits.set(DIRTY_BIT_TEXTURE_BINDINGS); } } @@ -874,9 +960,9 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures } // [OpenGL ES 2.0.24] section 4.4 page 112: - // If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is - // as if Texture2DAttachment had been called, with a texture of 0, for each attachment point to which this - // image was attached in the currently bound framebuffer. + // If a texture object is deleted while its image is attached to the currently bound + // framebuffer, then it is as if Texture2DAttachment had been called, with a texture of 0, for + // each attachment point to which this image was attached in the currently bound framebuffer. if (mReadFramebuffer && mReadFramebuffer->detachTexture(context, texture)) { @@ -891,13 +977,11 @@ void State::detachTexture(const Context *context, const TextureMap &zeroTextures void State::initializeZeroTextures(const Context *context, const TextureMap &zeroTextures) { - for (const auto &zeroTexture : zeroTextures) + for (TextureType type : angle::AllEnums()) { - auto &samplerTextureArray = mSamplerTextures[zeroTexture.first]; - - for (size_t textureUnit = 0; textureUnit < samplerTextureArray.size(); ++textureUnit) + for (size_t textureUnit = 0; textureUnit < mSamplerTextures[type].size(); ++textureUnit) { - samplerTextureArray[textureUnit].set(context, zeroTexture.second.get()); + mSamplerTextures[type][textureUnit].set(context, zeroTextures[type].get()); } } } @@ -955,8 +1039,8 @@ Renderbuffer *State::getCurrentRenderbuffer() const void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) { // [OpenGL ES 2.0.24] section 4.4 page 109: - // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though BindRenderbuffer - // had been executed with the target RENDERBUFFER and name of zero. + // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though + // BindRenderbuffer had been executed with the target RENDERBUFFER and name of zero. if (mRenderbuffer.id() == renderbuffer) { @@ -964,9 +1048,10 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) } // [OpenGL ES 2.0.24] section 4.4 page 111: - // If a renderbuffer object is deleted while its image is attached to the currently bound framebuffer, - // then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of 0, for each attachment - // point to which this image was attached in the currently bound framebuffer. + // If a renderbuffer object is deleted while its image is attached to the currently bound + // framebuffer, then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of + // 0, for each attachment point to which this image was attached in the currently bound + // framebuffer. Framebuffer *readFramebuffer = mReadFramebuffer; Framebuffer *drawFramebuffer = mDrawFramebuffer; @@ -983,7 +1068,6 @@ void State::detachRenderbuffer(const Context *context, GLuint renderbuffer) mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER); } } - } void State::setReadFramebufferBinding(Framebuffer *framebuffer) @@ -1041,8 +1125,7 @@ Framebuffer *State::getDrawFramebuffer() const bool State::removeReadFramebufferBinding(GLuint framebuffer) { - if (mReadFramebuffer != nullptr && - mReadFramebuffer->id() == framebuffer) + if (mReadFramebuffer != nullptr && mReadFramebuffer->id() == framebuffer) { setReadFramebufferBinding(nullptr); return true; @@ -1053,8 +1136,7 @@ bool State::removeReadFramebufferBinding(GLuint framebuffer) bool State::removeDrawFramebufferBinding(GLuint framebuffer) { - if (mReadFramebuffer != nullptr && - mDrawFramebuffer->id() == framebuffer) + if (mReadFramebuffer != nullptr && mDrawFramebuffer->id() == framebuffer) { setDrawFramebufferBinding(nullptr); return true; @@ -1065,7 +1147,13 @@ bool State::removeDrawFramebufferBinding(GLuint framebuffer) void State::setVertexArrayBinding(VertexArray *vertexArray) { + if (mVertexArray == vertexArray) + return; + if (mVertexArray) + mVertexArray->onBindingChanged(false); mVertexArray = vertexArray; + if (vertexArray) + vertexArray->onBindingChanged(true); mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING); if (mVertexArray && mVertexArray->hasAnyDirtyBit()) @@ -1088,8 +1176,9 @@ VertexArray *State::getVertexArray() const bool State::removeVertexArrayBinding(GLuint vertexArray) { - if (mVertexArray->id() == vertexArray) + if (mVertexArray && mVertexArray->id() == vertexArray) { + mVertexArray->onBindingChanged(false); mVertexArray = nullptr; mDirtyBits.set(DIRTY_BIT_VERTEX_ARRAY_BINDING); mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY); @@ -1162,7 +1251,13 @@ Program *State::getProgram() const void State::setTransformFeedbackBinding(const Context *context, TransformFeedback *transformFeedback) { + if (transformFeedback == mTransformFeedback.get()) + return; + if (mTransformFeedback.get()) + mTransformFeedback->onBindingChanged(false); mTransformFeedback.set(context, transformFeedback); + if (mTransformFeedback.get()) + mTransformFeedback->onBindingChanged(true); mDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING); } @@ -1174,13 +1269,16 @@ TransformFeedback *State::getCurrentTransformFeedback() const bool State::isTransformFeedbackActiveUnpaused() const { TransformFeedback *curTransformFeedback = getCurrentTransformFeedback(); - return curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused(); + return curTransformFeedback && curTransformFeedback->isActive() && + !curTransformFeedback->isPaused(); } bool State::removeTransformFeedbackBinding(const Context *context, GLuint transformFeedback) { if (mTransformFeedback.id() == transformFeedback) { + if (mTransformFeedback.get()) + mTransformFeedback->onBindingChanged(false); mTransformFeedback.set(context, nullptr); return true; } @@ -1251,40 +1349,35 @@ void State::setBufferBinding(const Context *context, BufferBinding target, Buffe switch (target) { case BufferBinding::PixelPack: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); mDirtyBits.set(DIRTY_BIT_PACK_BUFFER_BINDING); break; case BufferBinding::PixelUnpack: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); mDirtyBits.set(DIRTY_BIT_UNPACK_BUFFER_BINDING); break; case BufferBinding::DrawIndirect: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); mDirtyBits.set(DIRTY_BIT_DRAW_INDIRECT_BUFFER_BINDING); break; case BufferBinding::DispatchIndirect: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); mDirtyBits.set(DIRTY_BIT_DISPATCH_INDIRECT_BUFFER_BINDING); break; - case BufferBinding::TransformFeedback: - if (mTransformFeedback.get() != nullptr) - { - mTransformFeedback->bindGenericBuffer(context, buffer); - } - break; case BufferBinding::ElementArray: getVertexArray()->setElementArrayBuffer(context, buffer); mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY); break; case BufferBinding::ShaderStorage: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); mDirtyBits.set(DIRTY_BIT_SHADER_STORAGE_BUFFER_BINDING); break; default: - mBoundBuffers[target].set(context, buffer); + UpdateBufferBinding(context, &mBoundBuffers[target], buffer, target); break; } } + void State::setIndexedBufferBinding(const Context *context, BufferBinding target, GLuint index, @@ -1298,16 +1391,19 @@ void State::setIndexedBufferBinding(const Context *context, { case BufferBinding::TransformFeedback: mTransformFeedback->bindIndexedBuffer(context, index, buffer, offset, size); + setBufferBinding(context, target, buffer); break; case BufferBinding::Uniform: - mUniformBuffers[index].set(context, buffer, offset, size); + UpdateBufferBinding(context, &mUniformBuffers[index], buffer, target, offset, size); mDirtyBits.set(DIRTY_BIT_UNIFORM_BUFFER_BINDINGS); break; case BufferBinding::AtomicCounter: - mAtomicCounterBuffers[index].set(context, buffer, offset, size); + UpdateBufferBinding(context, &mAtomicCounterBuffers[index], buffer, target, offset, + size); break; case BufferBinding::ShaderStorage: - mShaderStorageBuffers[index].set(context, buffer, offset, size); + UpdateBufferBinding(context, &mShaderStorageBuffers[index], buffer, target, offset, + size); break; default: UNREACHABLE(); @@ -1339,20 +1435,23 @@ Buffer *State::getTargetBuffer(BufferBinding target) const { case BufferBinding::ElementArray: return getVertexArray()->getElementArrayBuffer().get(); - case BufferBinding::TransformFeedback: - return mTransformFeedback->getGenericBuffer().get(); default: return mBoundBuffers[target].get(); } } -void State::detachBuffer(const Context *context, GLuint bufferName) +void State::detachBuffer(const Context *context, const Buffer *buffer) { - for (auto &buffer : mBoundBuffers) + if (!buffer->isBound()) { - if (buffer.id() == bufferName) + return; + } + GLuint bufferName = buffer->id(); + for (auto target : angle::AllEnums()) + { + if (mBoundBuffers[target].id() == bufferName) { - buffer.set(context, nullptr); + UpdateBufferBinding(context, &mBoundBuffers[target], nullptr, target); } } @@ -1363,6 +1462,30 @@ void State::detachBuffer(const Context *context, GLuint bufferName) } getVertexArray()->detachBuffer(context, bufferName); + + for (auto &buf : mUniformBuffers) + { + if (buf.id() == bufferName) + { + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::Uniform); + } + } + + for (auto &buf : mAtomicCounterBuffers) + { + if (buf.id() == bufferName) + { + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::AtomicCounter); + } + } + + for (auto &buf : mShaderStorageBuffers) + { + if (buf.id() == bufferName) + { + UpdateBufferBinding(context, &buf, nullptr, BufferBinding::ShaderStorage); + } + } } void State::setEnableVertexAttribArray(unsigned int attribNum, bool enabled) @@ -1668,67 +1791,91 @@ void State::getBooleanv(GLenum pname, GLboolean *params) { switch (pname) { - case GL_SAMPLE_COVERAGE_INVERT: *params = mSampleCoverageInvert; break; - case GL_DEPTH_WRITEMASK: *params = mDepthStencil.depthMask; break; - case GL_COLOR_WRITEMASK: - params[0] = mBlend.colorMaskRed; - params[1] = mBlend.colorMaskGreen; - params[2] = mBlend.colorMaskBlue; - params[3] = mBlend.colorMaskAlpha; - break; - case GL_CULL_FACE: - *params = mRasterizer.cullFace; - break; - case GL_POLYGON_OFFSET_FILL: *params = mRasterizer.polygonOffsetFill; break; - case GL_SAMPLE_ALPHA_TO_COVERAGE: *params = mBlend.sampleAlphaToCoverage; break; - case GL_SAMPLE_COVERAGE: *params = mSampleCoverage; break; - case GL_SAMPLE_MASK: - *params = mSampleMask; - break; - case GL_SCISSOR_TEST: *params = mScissorTest; break; - case GL_STENCIL_TEST: *params = mDepthStencil.stencilTest; break; - case GL_DEPTH_TEST: *params = mDepthStencil.depthTest; break; - case GL_BLEND: *params = mBlend.blend; break; - case GL_DITHER: *params = mBlend.dither; break; - case GL_TRANSFORM_FEEDBACK_ACTIVE: *params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE; break; - case GL_TRANSFORM_FEEDBACK_PAUSED: *params = getCurrentTransformFeedback()->isPaused() ? GL_TRUE : GL_FALSE; break; - case GL_PRIMITIVE_RESTART_FIXED_INDEX: - *params = mPrimitiveRestart; - break; - case GL_RASTERIZER_DISCARD: - *params = isRasterizerDiscardEnabled() ? GL_TRUE : GL_FALSE; - break; - case GL_DEBUG_OUTPUT_SYNCHRONOUS: - *params = mDebug.isOutputSynchronous() ? GL_TRUE : GL_FALSE; - break; - case GL_DEBUG_OUTPUT: - *params = mDebug.isOutputEnabled() ? GL_TRUE : GL_FALSE; - break; - case GL_MULTISAMPLE_EXT: - *params = mMultiSampling; - break; - case GL_SAMPLE_ALPHA_TO_ONE_EXT: - *params = mSampleAlphaToOne; - break; - case GL_BIND_GENERATES_RESOURCE_CHROMIUM: - *params = isBindGeneratesResourceEnabled() ? GL_TRUE : GL_FALSE; - break; - case GL_CLIENT_ARRAYS_ANGLE: - *params = areClientArraysEnabled() ? GL_TRUE : GL_FALSE; - break; - case GL_FRAMEBUFFER_SRGB_EXT: - *params = getFramebufferSRGB() ? GL_TRUE : GL_FALSE; - break; - case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE: - *params = mRobustResourceInit ? GL_TRUE : GL_FALSE; - break; - case GL_PROGRAM_CACHE_ENABLED_ANGLE: - *params = mProgramBinaryCacheEnabled ? GL_TRUE : GL_FALSE; - break; + case GL_SAMPLE_COVERAGE_INVERT: + *params = mSampleCoverageInvert; + break; + case GL_DEPTH_WRITEMASK: + *params = mDepthStencil.depthMask; + break; + case GL_COLOR_WRITEMASK: + params[0] = mBlend.colorMaskRed; + params[1] = mBlend.colorMaskGreen; + params[2] = mBlend.colorMaskBlue; + params[3] = mBlend.colorMaskAlpha; + break; + case GL_CULL_FACE: + *params = mRasterizer.cullFace; + break; + case GL_POLYGON_OFFSET_FILL: + *params = mRasterizer.polygonOffsetFill; + break; + case GL_SAMPLE_ALPHA_TO_COVERAGE: + *params = mBlend.sampleAlphaToCoverage; + break; + case GL_SAMPLE_COVERAGE: + *params = mSampleCoverage; + break; + case GL_SAMPLE_MASK: + *params = mSampleMask; + break; + case GL_SCISSOR_TEST: + *params = mScissorTest; + break; + case GL_STENCIL_TEST: + *params = mDepthStencil.stencilTest; + break; + case GL_DEPTH_TEST: + *params = mDepthStencil.depthTest; + break; + case GL_BLEND: + *params = mBlend.blend; + break; + case GL_DITHER: + *params = mBlend.dither; + break; + case GL_TRANSFORM_FEEDBACK_ACTIVE: + *params = getCurrentTransformFeedback()->isActive() ? GL_TRUE : GL_FALSE; + break; + case GL_TRANSFORM_FEEDBACK_PAUSED: + *params = getCurrentTransformFeedback()->isPaused() ? GL_TRUE : GL_FALSE; + break; + case GL_PRIMITIVE_RESTART_FIXED_INDEX: + *params = mPrimitiveRestart; + break; + case GL_RASTERIZER_DISCARD: + *params = isRasterizerDiscardEnabled() ? GL_TRUE : GL_FALSE; + break; + case GL_DEBUG_OUTPUT_SYNCHRONOUS: + *params = mDebug.isOutputSynchronous() ? GL_TRUE : GL_FALSE; + break; + case GL_DEBUG_OUTPUT: + *params = mDebug.isOutputEnabled() ? GL_TRUE : GL_FALSE; + break; + case GL_MULTISAMPLE_EXT: + *params = mMultiSampling; + break; + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + *params = mSampleAlphaToOne; + break; + case GL_BIND_GENERATES_RESOURCE_CHROMIUM: + *params = isBindGeneratesResourceEnabled() ? GL_TRUE : GL_FALSE; + break; + case GL_CLIENT_ARRAYS_ANGLE: + *params = areClientArraysEnabled() ? GL_TRUE : GL_FALSE; + break; + case GL_FRAMEBUFFER_SRGB_EXT: + *params = getFramebufferSRGB() ? GL_TRUE : GL_FALSE; + break; + case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE: + *params = mRobustResourceInit ? GL_TRUE : GL_FALSE; + break; + case GL_PROGRAM_CACHE_ENABLED_ANGLE: + *params = mProgramBinaryCacheEnabled ? GL_TRUE : GL_FALSE; + break; - default: - UNREACHABLE(); - break; + default: + UNREACHABLE(); + break; } } @@ -1740,51 +1887,100 @@ void State::getFloatv(GLenum pname, GLfloat *params) // case, this should make no difference to the calling application. switch (pname) { - case GL_LINE_WIDTH: *params = mLineWidth; break; - case GL_SAMPLE_COVERAGE_VALUE: *params = mSampleCoverageValue; break; - case GL_DEPTH_CLEAR_VALUE: *params = mDepthClearValue; break; - case GL_POLYGON_OFFSET_FACTOR: *params = mRasterizer.polygonOffsetFactor; break; - case GL_POLYGON_OFFSET_UNITS: *params = mRasterizer.polygonOffsetUnits; break; - case GL_DEPTH_RANGE: - params[0] = mNearZ; - params[1] = mFarZ; - break; - case GL_COLOR_CLEAR_VALUE: - params[0] = mColorClearValue.red; - params[1] = mColorClearValue.green; - params[2] = mColorClearValue.blue; - params[3] = mColorClearValue.alpha; - break; - case GL_BLEND_COLOR: - params[0] = mBlendColor.red; - params[1] = mBlendColor.green; - params[2] = mBlendColor.blue; - params[3] = mBlendColor.alpha; - break; - case GL_MULTISAMPLE_EXT: - *params = static_cast(mMultiSampling); - break; - case GL_SAMPLE_ALPHA_TO_ONE_EXT: - *params = static_cast(mSampleAlphaToOne); - break; - case GL_COVERAGE_MODULATION_CHROMIUM: - params[0] = static_cast(mCoverageModulation); - break; - default: - UNREACHABLE(); - break; + case GL_LINE_WIDTH: + *params = mLineWidth; + break; + case GL_SAMPLE_COVERAGE_VALUE: + *params = mSampleCoverageValue; + break; + case GL_DEPTH_CLEAR_VALUE: + *params = mDepthClearValue; + break; + case GL_POLYGON_OFFSET_FACTOR: + *params = mRasterizer.polygonOffsetFactor; + break; + case GL_POLYGON_OFFSET_UNITS: + *params = mRasterizer.polygonOffsetUnits; + break; + case GL_DEPTH_RANGE: + params[0] = mNearZ; + params[1] = mFarZ; + break; + case GL_COLOR_CLEAR_VALUE: + params[0] = mColorClearValue.red; + params[1] = mColorClearValue.green; + params[2] = mColorClearValue.blue; + params[3] = mColorClearValue.alpha; + break; + case GL_BLEND_COLOR: + params[0] = mBlendColor.red; + params[1] = mBlendColor.green; + params[2] = mBlendColor.blue; + params[3] = mBlendColor.alpha; + break; + case GL_MULTISAMPLE_EXT: + *params = static_cast(mMultiSampling); + break; + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + *params = static_cast(mSampleAlphaToOne); + break; + case GL_COVERAGE_MODULATION_CHROMIUM: + params[0] = static_cast(mCoverageModulation); + break; + case GL_ALPHA_TEST_REF: + *params = mGLES1State.mAlphaTestRef; + break; + case GL_CURRENT_COLOR: + { + const auto &color = mGLES1State.mCurrentColor; + params[0] = color.red; + params[1] = color.green; + params[2] = color.blue; + params[3] = color.alpha; + break; + } + case GL_CURRENT_NORMAL: + { + const auto &normal = mGLES1State.mCurrentNormal; + params[0] = normal[0]; + params[1] = normal[1]; + params[2] = normal[2]; + break; + } + case GL_CURRENT_TEXTURE_COORDS: + { + const auto &texcoord = mGLES1State.mCurrentTextureCoords[mActiveSampler]; + params[0] = texcoord.s; + params[1] = texcoord.t; + params[2] = texcoord.r; + params[3] = texcoord.q; + break; + } + case GL_MODELVIEW_MATRIX: + memcpy(params, mGLES1State.mModelviewMatrices.back().data(), 16 * sizeof(GLfloat)); + break; + case GL_PROJECTION_MATRIX: + memcpy(params, mGLES1State.mProjectionMatrices.back().data(), 16 * sizeof(GLfloat)); + break; + case GL_TEXTURE_MATRIX: + memcpy(params, mGLES1State.mTextureMatrices[mActiveSampler].back().data(), + 16 * sizeof(GLfloat)); + break; + default: + UNREACHABLE(); + break; } } -void State::getIntegerv(const Context *context, GLenum pname, GLint *params) +Error State::getIntegerv(const Context *context, GLenum pname, GLint *params) { if (pname >= GL_DRAW_BUFFER0_EXT && pname <= GL_DRAW_BUFFER15_EXT) { unsigned int colorAttachment = (pname - GL_DRAW_BUFFER0_EXT); ASSERT(colorAttachment < mMaxDrawBuffers); Framebuffer *framebuffer = mDrawFramebuffer; - *params = framebuffer->getDrawBufferState(colorAttachment); - return; + *params = framebuffer->getDrawBufferState(colorAttachment); + return NoError(); } // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation @@ -1803,88 +1999,155 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = getVertexArray()->getElementArrayBuffer().id(); break; - //case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE - case GL_DRAW_FRAMEBUFFER_BINDING_ANGLE: *params = mDrawFramebuffer->id(); break; - case GL_READ_FRAMEBUFFER_BINDING_ANGLE: *params = mReadFramebuffer->id(); break; - case GL_RENDERBUFFER_BINDING: *params = mRenderbuffer.id(); break; - case GL_VERTEX_ARRAY_BINDING: *params = mVertexArray->id(); break; - case GL_CURRENT_PROGRAM: *params = mProgram ? mProgram->id() : 0; break; - case GL_PACK_ALIGNMENT: *params = mPack.alignment; break; - case GL_PACK_REVERSE_ROW_ORDER_ANGLE: *params = mPack.reverseRowOrder; break; - case GL_PACK_ROW_LENGTH: - *params = mPack.rowLength; - break; - case GL_PACK_SKIP_ROWS: - *params = mPack.skipRows; - break; - case GL_PACK_SKIP_PIXELS: - *params = mPack.skipPixels; - break; - case GL_UNPACK_ALIGNMENT: *params = mUnpack.alignment; break; - case GL_UNPACK_ROW_LENGTH: *params = mUnpack.rowLength; break; - case GL_UNPACK_IMAGE_HEIGHT: - *params = mUnpack.imageHeight; - break; - case GL_UNPACK_SKIP_IMAGES: - *params = mUnpack.skipImages; - break; - case GL_UNPACK_SKIP_ROWS: - *params = mUnpack.skipRows; - break; - case GL_UNPACK_SKIP_PIXELS: - *params = mUnpack.skipPixels; - break; - case GL_GENERATE_MIPMAP_HINT: *params = mGenerateMipmapHint; break; - case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mFragmentShaderDerivativeHint; break; - case GL_ACTIVE_TEXTURE: - *params = (static_cast(mActiveSampler) + GL_TEXTURE0); - break; - case GL_STENCIL_FUNC: *params = mDepthStencil.stencilFunc; break; - case GL_STENCIL_REF: *params = mStencilRef; break; - case GL_STENCIL_VALUE_MASK: - *params = CastMaskValue(context, mDepthStencil.stencilMask); - break; - case GL_STENCIL_BACK_FUNC: *params = mDepthStencil.stencilBackFunc; break; - case GL_STENCIL_BACK_REF: *params = mStencilBackRef; break; - case GL_STENCIL_BACK_VALUE_MASK: - *params = CastMaskValue(context, mDepthStencil.stencilBackMask); - break; - case GL_STENCIL_FAIL: *params = mDepthStencil.stencilFail; break; - case GL_STENCIL_PASS_DEPTH_FAIL: *params = mDepthStencil.stencilPassDepthFail; break; - case GL_STENCIL_PASS_DEPTH_PASS: *params = mDepthStencil.stencilPassDepthPass; break; - case GL_STENCIL_BACK_FAIL: *params = mDepthStencil.stencilBackFail; break; - case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mDepthStencil.stencilBackPassDepthFail; break; - case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mDepthStencil.stencilBackPassDepthPass; break; - case GL_DEPTH_FUNC: *params = mDepthStencil.depthFunc; break; - case GL_BLEND_SRC_RGB: *params = mBlend.sourceBlendRGB; break; - case GL_BLEND_SRC_ALPHA: *params = mBlend.sourceBlendAlpha; break; - case GL_BLEND_DST_RGB: *params = mBlend.destBlendRGB; break; - case GL_BLEND_DST_ALPHA: *params = mBlend.destBlendAlpha; break; - case GL_BLEND_EQUATION_RGB: *params = mBlend.blendEquationRGB; break; - case GL_BLEND_EQUATION_ALPHA: *params = mBlend.blendEquationAlpha; break; - case GL_STENCIL_WRITEMASK: - *params = CastMaskValue(context, mDepthStencil.stencilWritemask); - break; - case GL_STENCIL_BACK_WRITEMASK: - *params = CastMaskValue(context, mDepthStencil.stencilBackWritemask); - break; - case GL_STENCIL_CLEAR_VALUE: *params = mStencilClearValue; break; - case GL_IMPLEMENTATION_COLOR_READ_TYPE: - *params = mReadFramebuffer->getImplementationColorReadType(context); - break; - case GL_IMPLEMENTATION_COLOR_READ_FORMAT: - *params = mReadFramebuffer->getImplementationColorReadFormat(context); - break; - case GL_SAMPLE_BUFFERS: - case GL_SAMPLES: + case GL_DRAW_FRAMEBUFFER_BINDING: + static_assert(GL_DRAW_FRAMEBUFFER_BINDING == GL_DRAW_FRAMEBUFFER_BINDING_ANGLE, + "Enum mismatch"); + *params = mDrawFramebuffer->id(); + break; + case GL_READ_FRAMEBUFFER_BINDING: + static_assert(GL_READ_FRAMEBUFFER_BINDING == GL_READ_FRAMEBUFFER_BINDING_ANGLE, + "Enum mismatch"); + *params = mReadFramebuffer->id(); + break; + case GL_RENDERBUFFER_BINDING: + *params = mRenderbuffer.id(); + break; + case GL_VERTEX_ARRAY_BINDING: + *params = mVertexArray->id(); + break; + case GL_CURRENT_PROGRAM: + *params = mProgram ? mProgram->id() : 0; + break; + case GL_PACK_ALIGNMENT: + *params = mPack.alignment; + break; + case GL_PACK_REVERSE_ROW_ORDER_ANGLE: + *params = mPack.reverseRowOrder; + break; + case GL_PACK_ROW_LENGTH: + *params = mPack.rowLength; + break; + case GL_PACK_SKIP_ROWS: + *params = mPack.skipRows; + break; + case GL_PACK_SKIP_PIXELS: + *params = mPack.skipPixels; + break; + case GL_UNPACK_ALIGNMENT: + *params = mUnpack.alignment; + break; + case GL_UNPACK_ROW_LENGTH: + *params = mUnpack.rowLength; + break; + case GL_UNPACK_IMAGE_HEIGHT: + *params = mUnpack.imageHeight; + break; + case GL_UNPACK_SKIP_IMAGES: + *params = mUnpack.skipImages; + break; + case GL_UNPACK_SKIP_ROWS: + *params = mUnpack.skipRows; + break; + case GL_UNPACK_SKIP_PIXELS: + *params = mUnpack.skipPixels; + break; + case GL_GENERATE_MIPMAP_HINT: + *params = mGenerateMipmapHint; + break; + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: + *params = mFragmentShaderDerivativeHint; + break; + case GL_ACTIVE_TEXTURE: + *params = (static_cast(mActiveSampler) + GL_TEXTURE0); + break; + case GL_STENCIL_FUNC: + *params = mDepthStencil.stencilFunc; + break; + case GL_STENCIL_REF: + *params = mStencilRef; + break; + case GL_STENCIL_VALUE_MASK: + *params = CastMaskValue(context, mDepthStencil.stencilMask); + break; + case GL_STENCIL_BACK_FUNC: + *params = mDepthStencil.stencilBackFunc; + break; + case GL_STENCIL_BACK_REF: + *params = mStencilBackRef; + break; + case GL_STENCIL_BACK_VALUE_MASK: + *params = CastMaskValue(context, mDepthStencil.stencilBackMask); + break; + case GL_STENCIL_FAIL: + *params = mDepthStencil.stencilFail; + break; + case GL_STENCIL_PASS_DEPTH_FAIL: + *params = mDepthStencil.stencilPassDepthFail; + break; + case GL_STENCIL_PASS_DEPTH_PASS: + *params = mDepthStencil.stencilPassDepthPass; + break; + case GL_STENCIL_BACK_FAIL: + *params = mDepthStencil.stencilBackFail; + break; + case GL_STENCIL_BACK_PASS_DEPTH_FAIL: + *params = mDepthStencil.stencilBackPassDepthFail; + break; + case GL_STENCIL_BACK_PASS_DEPTH_PASS: + *params = mDepthStencil.stencilBackPassDepthPass; + break; + case GL_DEPTH_FUNC: + *params = mDepthStencil.depthFunc; + break; + case GL_BLEND_SRC_RGB: + *params = mBlend.sourceBlendRGB; + break; + case GL_BLEND_SRC_ALPHA: + *params = mBlend.sourceBlendAlpha; + break; + case GL_BLEND_DST_RGB: + *params = mBlend.destBlendRGB; + break; + case GL_BLEND_DST_ALPHA: + *params = mBlend.destBlendAlpha; + break; + case GL_BLEND_EQUATION_RGB: + *params = mBlend.blendEquationRGB; + break; + case GL_BLEND_EQUATION_ALPHA: + *params = mBlend.blendEquationAlpha; + break; + case GL_STENCIL_WRITEMASK: + *params = CastMaskValue(context, mDepthStencil.stencilWritemask); + break; + case GL_STENCIL_BACK_WRITEMASK: + *params = CastMaskValue(context, mDepthStencil.stencilBackWritemask); + break; + case GL_STENCIL_CLEAR_VALUE: + *params = mStencilClearValue; + break; + case GL_IMPLEMENTATION_COLOR_READ_TYPE: + ANGLE_TRY(mReadFramebuffer->getImplementationColorReadType( + context, reinterpret_cast(params))); + break; + case GL_IMPLEMENTATION_COLOR_READ_FORMAT: + ANGLE_TRY(mReadFramebuffer->getImplementationColorReadFormat( + context, reinterpret_cast(params))); + break; + case GL_SAMPLE_BUFFERS: + case GL_SAMPLES: { Framebuffer *framebuffer = mDrawFramebuffer; - if (framebuffer->checkStatus(context) == GL_FRAMEBUFFER_COMPLETE) + bool complete = false; + ANGLE_TRY(framebuffer->isComplete(context, &complete)); + if (complete) { + GLint samples = 0; + ANGLE_TRY(framebuffer->getSamples(context, &samples)); switch (pname) { case GL_SAMPLE_BUFFERS: - if (framebuffer->getSamples(context) != 0) + if (samples != 0) { *params = 1; } @@ -1894,7 +2157,7 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) } break; case GL_SAMPLES: - *params = framebuffer->getSamples(context); + *params = samples; break; } } @@ -1904,28 +2167,28 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) } } break; - case GL_VIEWPORT: - params[0] = mViewport.x; - params[1] = mViewport.y; - params[2] = mViewport.width; - params[3] = mViewport.height; - break; - case GL_SCISSOR_BOX: - params[0] = mScissor.x; - params[1] = mScissor.y; - params[2] = mScissor.width; - params[3] = mScissor.height; - break; - case GL_CULL_FACE_MODE: - *params = ToGLenum(mRasterizer.cullMode); - break; - case GL_FRONT_FACE: - *params = mRasterizer.frontFace; - break; - case GL_RED_BITS: - case GL_GREEN_BITS: - case GL_BLUE_BITS: - case GL_ALPHA_BITS: + case GL_VIEWPORT: + params[0] = mViewport.x; + params[1] = mViewport.y; + params[2] = mViewport.width; + params[3] = mViewport.height; + break; + case GL_SCISSOR_BOX: + params[0] = mScissor.x; + params[1] = mScissor.y; + params[2] = mScissor.width; + params[3] = mScissor.height; + break; + case GL_CULL_FACE_MODE: + *params = ToGLenum(mRasterizer.cullMode); + break; + case GL_FRONT_FACE: + *params = mRasterizer.frontFace; + break; + case GL_RED_BITS: + case GL_GREEN_BITS: + case GL_BLUE_BITS: + case GL_ALPHA_BITS: { Framebuffer *framebuffer = getDrawFramebuffer(); const FramebufferAttachment *colorbuffer = framebuffer->getFirstColorbuffer(); @@ -1934,10 +2197,18 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) { switch (pname) { - case GL_RED_BITS: *params = colorbuffer->getRedSize(); break; - case GL_GREEN_BITS: *params = colorbuffer->getGreenSize(); break; - case GL_BLUE_BITS: *params = colorbuffer->getBlueSize(); break; - case GL_ALPHA_BITS: *params = colorbuffer->getAlphaSize(); break; + case GL_RED_BITS: + *params = colorbuffer->getRedSize(); + break; + case GL_GREEN_BITS: + *params = colorbuffer->getGreenSize(); + break; + case GL_BLUE_BITS: + *params = colorbuffer->getBlueSize(); + break; + case GL_ALPHA_BITS: + *params = colorbuffer->getAlphaSize(); + break; } } else @@ -1946,7 +2217,7 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) } } break; - case GL_DEPTH_BITS: + case GL_DEPTH_BITS: { const Framebuffer *framebuffer = getDrawFramebuffer(); const FramebufferAttachment *depthbuffer = framebuffer->getDepthbuffer(); @@ -1961,7 +2232,7 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) } } break; - case GL_STENCIL_BITS: + case GL_STENCIL_BITS: { const Framebuffer *framebuffer = getDrawFramebuffer(); const FramebufferAttachment *stencilbuffer = framebuffer->getStencilbuffer(); @@ -1976,99 +2247,111 @@ void State::getIntegerv(const Context *context, GLenum pname, GLint *params) } } break; - case GL_TEXTURE_BINDING_2D: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerTextureId(static_cast(mActiveSampler), GL_TEXTURE_2D); - break; - case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerTextureId(static_cast(mActiveSampler), - GL_TEXTURE_RECTANGLE_ANGLE); - break; - case GL_TEXTURE_BINDING_CUBE_MAP: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = - getSamplerTextureId(static_cast(mActiveSampler), GL_TEXTURE_CUBE_MAP); - break; - case GL_TEXTURE_BINDING_3D: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerTextureId(static_cast(mActiveSampler), GL_TEXTURE_3D); - break; - case GL_TEXTURE_BINDING_2D_ARRAY: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = - getSamplerTextureId(static_cast(mActiveSampler), GL_TEXTURE_2D_ARRAY); - break; - case GL_TEXTURE_BINDING_2D_MULTISAMPLE: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerTextureId(static_cast(mActiveSampler), - GL_TEXTURE_2D_MULTISAMPLE); - break; - case GL_TEXTURE_BINDING_EXTERNAL_OES: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerTextureId(static_cast(mActiveSampler), - GL_TEXTURE_EXTERNAL_OES); - break; - case GL_UNIFORM_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::Uniform].id(); - break; - case GL_TRANSFORM_FEEDBACK_BINDING: - *params = mTransformFeedback.id(); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - ASSERT(mTransformFeedback.get() != nullptr); - *params = mTransformFeedback->getGenericBuffer().id(); - break; - case GL_COPY_READ_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::CopyRead].id(); - break; - case GL_COPY_WRITE_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::CopyWrite].id(); - break; - case GL_PIXEL_PACK_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::PixelPack].id(); - break; - case GL_PIXEL_UNPACK_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::PixelUnpack].id(); - break; - case GL_READ_BUFFER: - *params = mReadFramebuffer->getReadBufferState(); - break; - case GL_SAMPLER_BINDING: - ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); - *params = getSamplerId(static_cast(mActiveSampler)); - break; - case GL_DEBUG_LOGGED_MESSAGES: - *params = static_cast(mDebug.getMessageCount()); - break; - case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: - *params = static_cast(mDebug.getNextMessageLength()); - break; - case GL_DEBUG_GROUP_STACK_DEPTH: - *params = static_cast(mDebug.getGroupStackDepth()); - break; - case GL_MULTISAMPLE_EXT: - *params = static_cast(mMultiSampling); - break; - case GL_SAMPLE_ALPHA_TO_ONE_EXT: - *params = static_cast(mSampleAlphaToOne); - break; - case GL_COVERAGE_MODULATION_CHROMIUM: - *params = static_cast(mCoverageModulation); - break; - case GL_ATOMIC_COUNTER_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::AtomicCounter].id(); - break; - case GL_SHADER_STORAGE_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::ShaderStorage].id(); - break; - case GL_DISPATCH_INDIRECT_BUFFER_BINDING: - *params = mBoundBuffers[BufferBinding::DispatchIndirect].id(); - break; - default: - UNREACHABLE(); - break; + case GL_TEXTURE_BINDING_2D: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = + getSamplerTextureId(static_cast(mActiveSampler), TextureType::_2D); + break; + case GL_TEXTURE_BINDING_RECTANGLE_ANGLE: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerTextureId(static_cast(mActiveSampler), + TextureType::Rectangle); + break; + case GL_TEXTURE_BINDING_CUBE_MAP: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerTextureId(static_cast(mActiveSampler), + TextureType::CubeMap); + break; + case GL_TEXTURE_BINDING_3D: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = + getSamplerTextureId(static_cast(mActiveSampler), TextureType::_3D); + break; + case GL_TEXTURE_BINDING_2D_ARRAY: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerTextureId(static_cast(mActiveSampler), + TextureType::_2DArray); + break; + case GL_TEXTURE_BINDING_2D_MULTISAMPLE: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerTextureId(static_cast(mActiveSampler), + TextureType::_2DMultisample); + break; + case GL_TEXTURE_BINDING_EXTERNAL_OES: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerTextureId(static_cast(mActiveSampler), + TextureType::External); + break; + case GL_UNIFORM_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::Uniform].id(); + break; + case GL_TRANSFORM_FEEDBACK_BINDING: + *params = mTransformFeedback.id(); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::TransformFeedback].id(); + break; + case GL_COPY_READ_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::CopyRead].id(); + break; + case GL_COPY_WRITE_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::CopyWrite].id(); + break; + case GL_PIXEL_PACK_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::PixelPack].id(); + break; + case GL_PIXEL_UNPACK_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::PixelUnpack].id(); + break; + case GL_READ_BUFFER: + *params = mReadFramebuffer->getReadBufferState(); + break; + case GL_SAMPLER_BINDING: + ASSERT(mActiveSampler < mMaxCombinedTextureImageUnits); + *params = getSamplerId(static_cast(mActiveSampler)); + break; + case GL_DEBUG_LOGGED_MESSAGES: + *params = static_cast(mDebug.getMessageCount()); + break; + case GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH: + *params = static_cast(mDebug.getNextMessageLength()); + break; + case GL_DEBUG_GROUP_STACK_DEPTH: + *params = static_cast(mDebug.getGroupStackDepth()); + break; + case GL_MULTISAMPLE_EXT: + *params = static_cast(mMultiSampling); + break; + case GL_SAMPLE_ALPHA_TO_ONE_EXT: + *params = static_cast(mSampleAlphaToOne); + break; + case GL_COVERAGE_MODULATION_CHROMIUM: + *params = static_cast(mCoverageModulation); + break; + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::AtomicCounter].id(); + break; + case GL_SHADER_STORAGE_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::ShaderStorage].id(); + break; + case GL_DISPATCH_INDIRECT_BUFFER_BINDING: + *params = mBoundBuffers[BufferBinding::DispatchIndirect].id(); + break; + case GL_ALPHA_TEST_FUNC: + *params = ToGLenum(mGLES1State.mAlphaTestFunc); + break; + case GL_CLIENT_ACTIVE_TEXTURE: + *params = mGLES1State.mClientActiveTexture + GL_TEXTURE0; + break; + case GL_MATRIX_MODE: + *params = ToGLenum(mGLES1State.mMatrixMode); + break; + default: + UNREACHABLE(); + break; } + + return NoError(); } void State::getPointerv(GLenum pname, void **params) const @@ -2091,65 +2374,65 @@ void State::getIntegeri_v(GLenum target, GLuint index, GLint *data) { switch (target) { - case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: - ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); - *data = mTransformFeedback->getIndexedBuffer(index).id(); - break; - case GL_UNIFORM_BUFFER_BINDING: - ASSERT(static_cast(index) < mUniformBuffers.size()); - *data = mUniformBuffers[index].id(); - break; - case GL_ATOMIC_COUNTER_BUFFER_BINDING: - ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); - *data = mAtomicCounterBuffers[index].id(); - break; - case GL_SHADER_STORAGE_BUFFER_BINDING: - ASSERT(static_cast(index) < mShaderStorageBuffers.size()); - *data = mShaderStorageBuffers[index].id(); - break; - case GL_VERTEX_BINDING_BUFFER: - ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); - *data = mVertexArray->getVertexBinding(index).getBuffer().id(); - break; - case GL_VERTEX_BINDING_DIVISOR: - ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); - *data = mVertexArray->getVertexBinding(index).getDivisor(); - break; - case GL_VERTEX_BINDING_OFFSET: - ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); - *data = static_cast(mVertexArray->getVertexBinding(index).getOffset()); - break; - case GL_VERTEX_BINDING_STRIDE: - ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); - *data = mVertexArray->getVertexBinding(index).getStride(); - break; - case GL_SAMPLE_MASK_VALUE: - ASSERT(static_cast(index) < mSampleMaskValues.size()); - *data = mSampleMaskValues[index]; - break; - case GL_IMAGE_BINDING_NAME: - ASSERT(static_cast(index) < mImageUnits.size()); - *data = mImageUnits[index].texture.id(); - break; - case GL_IMAGE_BINDING_LEVEL: - ASSERT(static_cast(index) < mImageUnits.size()); - *data = mImageUnits[index].level; - break; - case GL_IMAGE_BINDING_LAYER: - ASSERT(static_cast(index) < mImageUnits.size()); - *data = mImageUnits[index].layer; - break; - case GL_IMAGE_BINDING_ACCESS: - ASSERT(static_cast(index) < mImageUnits.size()); - *data = mImageUnits[index].access; - break; - case GL_IMAGE_BINDING_FORMAT: - ASSERT(static_cast(index) < mImageUnits.size()); - *data = mImageUnits[index].format; - break; - default: - UNREACHABLE(); - break; + case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: + ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); + *data = mTransformFeedback->getIndexedBuffer(index).id(); + break; + case GL_UNIFORM_BUFFER_BINDING: + ASSERT(static_cast(index) < mUniformBuffers.size()); + *data = mUniformBuffers[index].id(); + break; + case GL_ATOMIC_COUNTER_BUFFER_BINDING: + ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); + *data = mAtomicCounterBuffers[index].id(); + break; + case GL_SHADER_STORAGE_BUFFER_BINDING: + ASSERT(static_cast(index) < mShaderStorageBuffers.size()); + *data = mShaderStorageBuffers[index].id(); + break; + case GL_VERTEX_BINDING_BUFFER: + ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); + *data = mVertexArray->getVertexBinding(index).getBuffer().id(); + break; + case GL_VERTEX_BINDING_DIVISOR: + ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); + *data = mVertexArray->getVertexBinding(index).getDivisor(); + break; + case GL_VERTEX_BINDING_OFFSET: + ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); + *data = static_cast(mVertexArray->getVertexBinding(index).getOffset()); + break; + case GL_VERTEX_BINDING_STRIDE: + ASSERT(static_cast(index) < mVertexArray->getMaxBindings()); + *data = mVertexArray->getVertexBinding(index).getStride(); + break; + case GL_SAMPLE_MASK_VALUE: + ASSERT(static_cast(index) < mSampleMaskValues.size()); + *data = mSampleMaskValues[index]; + break; + case GL_IMAGE_BINDING_NAME: + ASSERT(static_cast(index) < mImageUnits.size()); + *data = mImageUnits[index].texture.id(); + break; + case GL_IMAGE_BINDING_LEVEL: + ASSERT(static_cast(index) < mImageUnits.size()); + *data = mImageUnits[index].level; + break; + case GL_IMAGE_BINDING_LAYER: + ASSERT(static_cast(index) < mImageUnits.size()); + *data = mImageUnits[index].layer; + break; + case GL_IMAGE_BINDING_ACCESS: + ASSERT(static_cast(index) < mImageUnits.size()); + *data = mImageUnits[index].access; + break; + case GL_IMAGE_BINDING_FORMAT: + ASSERT(static_cast(index) < mImageUnits.size()); + *data = mImageUnits[index].format; + break; + default: + UNREACHABLE(); + break; } } @@ -2157,41 +2440,41 @@ void State::getInteger64i_v(GLenum target, GLuint index, GLint64 *data) { switch (target) { - case GL_TRANSFORM_FEEDBACK_BUFFER_START: - ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); - *data = mTransformFeedback->getIndexedBuffer(index).getOffset(); - break; - case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: - ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); - *data = mTransformFeedback->getIndexedBuffer(index).getSize(); - break; - case GL_UNIFORM_BUFFER_START: - ASSERT(static_cast(index) < mUniformBuffers.size()); - *data = mUniformBuffers[index].getOffset(); - break; - case GL_UNIFORM_BUFFER_SIZE: - ASSERT(static_cast(index) < mUniformBuffers.size()); - *data = mUniformBuffers[index].getSize(); - break; - case GL_ATOMIC_COUNTER_BUFFER_START: - ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); - *data = mAtomicCounterBuffers[index].getOffset(); - break; - case GL_ATOMIC_COUNTER_BUFFER_SIZE: - ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); - *data = mAtomicCounterBuffers[index].getSize(); - break; - case GL_SHADER_STORAGE_BUFFER_START: - ASSERT(static_cast(index) < mShaderStorageBuffers.size()); - *data = mShaderStorageBuffers[index].getOffset(); - break; - case GL_SHADER_STORAGE_BUFFER_SIZE: - ASSERT(static_cast(index) < mShaderStorageBuffers.size()); - *data = mShaderStorageBuffers[index].getSize(); - break; - default: - UNREACHABLE(); - break; + case GL_TRANSFORM_FEEDBACK_BUFFER_START: + ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); + *data = mTransformFeedback->getIndexedBuffer(index).getOffset(); + break; + case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: + ASSERT(static_cast(index) < mTransformFeedback->getIndexedBufferCount()); + *data = mTransformFeedback->getIndexedBuffer(index).getSize(); + break; + case GL_UNIFORM_BUFFER_START: + ASSERT(static_cast(index) < mUniformBuffers.size()); + *data = mUniformBuffers[index].getOffset(); + break; + case GL_UNIFORM_BUFFER_SIZE: + ASSERT(static_cast(index) < mUniformBuffers.size()); + *data = mUniformBuffers[index].getSize(); + break; + case GL_ATOMIC_COUNTER_BUFFER_START: + ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); + *data = mAtomicCounterBuffers[index].getOffset(); + break; + case GL_ATOMIC_COUNTER_BUFFER_SIZE: + ASSERT(static_cast(index) < mAtomicCounterBuffers.size()); + *data = mAtomicCounterBuffers[index].getSize(); + break; + case GL_SHADER_STORAGE_BUFFER_START: + ASSERT(static_cast(index) < mShaderStorageBuffers.size()); + *data = mShaderStorageBuffers[index].getOffset(); + break; + case GL_SHADER_STORAGE_BUFFER_SIZE: + ASSERT(static_cast(index) < mShaderStorageBuffers.size()); + *data = mShaderStorageBuffers[index].getSize(); + break; + default: + UNREACHABLE(); + break; } } @@ -2214,7 +2497,7 @@ bool State::hasMappedBuffer(BufferBinding target) const if (target == BufferBinding::Array) { const VertexArray *vao = getVertexArray(); - const auto &vertexAttribs = vao->getVertexAttributes(); + const auto &vertexAttribs = vao->getVertexAttributes(); const auto &vertexBindings = vao->getVertexBindings(); for (size_t attribIndex : vao->getEnabledAttributesMask()) { @@ -2235,31 +2518,32 @@ bool State::hasMappedBuffer(BufferBinding target) const } } -void State::syncDirtyObjects(const Context *context) +Error State::syncDirtyObjects(const Context *context) { if (!mDirtyObjects.any()) - return; + return NoError(); - syncDirtyObjects(context, mDirtyObjects); + return syncDirtyObjects(context, mDirtyObjects); } -void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset) +Error State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset) { - for (auto dirtyObject : bitset) + const DirtyObjects &dirtyObjects = mDirtyObjects & bitset; + for (auto dirtyObject : dirtyObjects) { switch (dirtyObject) { case DIRTY_OBJECT_READ_FRAMEBUFFER: ASSERT(mReadFramebuffer); - mReadFramebuffer->syncState(context); + ANGLE_TRY(mReadFramebuffer->syncState(context)); break; case DIRTY_OBJECT_DRAW_FRAMEBUFFER: ASSERT(mDrawFramebuffer); - mDrawFramebuffer->syncState(context); + ANGLE_TRY(mDrawFramebuffer->syncState(context)); break; case DIRTY_OBJECT_VERTEX_ARRAY: ASSERT(mVertexArray); - mVertexArray->syncState(context); + ANGLE_TRY(mVertexArray->syncState(context)); break; case DIRTY_OBJECT_PROGRAM_TEXTURES: syncProgramTextures(context); @@ -2271,7 +2555,8 @@ void State::syncDirtyObjects(const Context *context, const DirtyObjects &bitset) } } - mDirtyObjects &= ~bitset; + mDirtyObjects &= ~dirtyObjects; + return NoError(); } void State::syncProgramTextures(const Context *context) @@ -2296,7 +2581,7 @@ void State::syncProgramTextures(const Context *context) if (samplerBinding.unreferenced) continue; - GLenum textureType = samplerBinding.textureType; + TextureType textureType = samplerBinding.textureType; for (GLuint textureUnitIndex : samplerBinding.boundTextureUnits) { Texture *texture = getSamplerTexture(textureUnitIndex, textureType); @@ -2320,7 +2605,7 @@ void State::syncProgramTextures(const Context *context) } // Bind the texture unconditionally, to recieve completeness change notifications. - mCompleteTextureBindings[textureUnitIndex].bind(texture); + mCompleteTextureBindings[textureUnitIndex].bind(texture->getSubject()); mActiveTexturesMask.set(textureUnitIndex); newActiveTextures.set(textureUnitIndex); @@ -2349,7 +2634,7 @@ void State::syncProgramTextures(const Context *context) } } -void State::syncDirtyObject(const Context *context, GLenum target) +Error State::syncDirtyObject(const Context *context, GLenum target) { DirtyObjects localSet; @@ -2375,7 +2660,7 @@ void State::syncDirtyObject(const Context *context, GLenum target) break; } - syncDirtyObjects(context, localSet); + return syncDirtyObjects(context, localSet); } void State::setObjectDirty(GLenum target) @@ -2404,6 +2689,26 @@ void State::setObjectDirty(GLenum target) } } +void State::setFramebufferDirty(const Framebuffer *framebuffer) const +{ + if (framebuffer == mReadFramebuffer) + { + mDirtyObjects.set(DIRTY_OBJECT_READ_FRAMEBUFFER); + } + if (framebuffer == mDrawFramebuffer) + { + mDirtyObjects.set(DIRTY_OBJECT_DRAW_FRAMEBUFFER); + } +} + +void State::setVertexArrayDirty(const VertexArray *vertexArray) const +{ + if (vertexArray == mVertexArray) + { + mDirtyObjects.set(DIRTY_OBJECT_VERTEX_ARRAY); + } +} + void State::onProgramExecutableChange(Program *program) { // OpenGL Spec: @@ -2464,6 +2769,8 @@ Error State::clearUnclearedActiveTextures(const Context *context) return NoError(); } + ASSERT(!mDirtyObjects.any()); + for (auto textureIndex : mActiveTexturesMask) { Texture *texture = mCompleteTextureCache[textureIndex]; @@ -2485,4 +2792,13 @@ AttributesMask State::getAndResetDirtyCurrentValues() const return retVal; } +bool State::isCurrentTransformFeedback(const TransformFeedback *tf) const +{ + return tf == mTransformFeedback.get(); +} +bool State::isCurrentVertexArray(const VertexArray *va) const +{ + return va == mVertexArray; +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/State.h b/gfx/angle/checkout/src/libANGLE/State.h index af80fa1ac40e..e6657f721cfd 100644 --- a/gfx/angle/checkout/src/libANGLE/State.h +++ b/gfx/angle/checkout/src/libANGLE/State.h @@ -16,6 +16,7 @@ #include "common/angleutils.h" #include "common/bitset_utils.h" #include "libANGLE/Debug.h" +#include "libANGLE/GLES1State.h" #include "libANGLE/Program.h" #include "libANGLE/ProgramPipeline.h" #include "libANGLE/RefCountObject.h" @@ -174,10 +175,10 @@ class State : public angle::ObserverInterface, angle::NonCopyable // Texture binding & active texture unit manipulation void setActiveSampler(unsigned int active); unsigned int getActiveSampler() const; - void setSamplerTexture(const Context *context, GLenum type, Texture *texture); - Texture *getTargetTexture(GLenum target) const; - Texture *getSamplerTexture(unsigned int sampler, GLenum type) const; - GLuint getSamplerTextureId(unsigned int sampler, GLenum type) const; + void setSamplerTexture(const Context *context, TextureType type, Texture *texture); + Texture *getTargetTexture(TextureType type) const; + Texture *getSamplerTexture(unsigned int sampler, TextureType type) const; + GLuint getSamplerTextureId(unsigned int sampler, TextureType type) const; void detachTexture(const Context *context, const TextureMap &zeroTextures, GLuint texture); void initializeZeroTextures(const Context *context, const TextureMap &zeroTextures); @@ -244,7 +245,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable const OffsetBindingPointer &getIndexedShaderStorageBuffer(size_t index) const; // Detach a buffer from all bindings - void detachBuffer(const Context *context, GLuint bufferName); + void detachBuffer(const Context *context, const Buffer *buffer); // Vertex attrib manipulation void setEnableVertexAttribArray(unsigned int attribNum, bool enabled); @@ -333,7 +334,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable // State query functions void getBooleanv(GLenum pname, GLboolean *params); void getFloatv(GLenum pname, GLfloat *params); - void getIntegerv(const Context *context, GLenum pname, GLint *params); + Error getIntegerv(const Context *context, GLenum pname, GLint *params); void getPointerv(GLenum pname, void **params) const; void getIntegeri_v(GLenum target, GLuint index, GLint *data); void getInteger64i_v(GLenum target, GLuint index, GLint64 *data); @@ -440,10 +441,12 @@ class State : public angle::ObserverInterface, angle::NonCopyable using DirtyObjects = angle::BitSet; void clearDirtyObjects() { mDirtyObjects.reset(); } void setAllDirtyObjects() { mDirtyObjects.set(); } - void syncDirtyObjects(const Context *context); - void syncDirtyObjects(const Context *context, const DirtyObjects &bitset); - void syncDirtyObject(const Context *context, GLenum target); + Error syncDirtyObjects(const Context *context); + Error syncDirtyObjects(const Context *context, const DirtyObjects &bitset); + Error syncDirtyObject(const Context *context, GLenum target); void setObjectDirty(GLenum target); + void setFramebufferDirty(const Framebuffer *framebuffer) const; + void setVertexArrayDirty(const VertexArray *vertexArray) const; // This actually clears the current value dirty bits. // TODO(jmadill): Pass mutable dirty bits into Impl. @@ -469,6 +472,12 @@ class State : public angle::ObserverInterface, angle::NonCopyable Error clearUnclearedActiveTextures(const Context *context); + bool isCurrentTransformFeedback(const TransformFeedback *tf) const; + bool isCurrentVertexArray(const VertexArray *va) const; + + GLES1State &gles1() { return mGLES1State; } + const GLES1State &gles1() const { return mGLES1State; } + private: void syncProgramTextures(const Context *context); @@ -524,7 +533,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable size_t mActiveSampler; // Active texture unit selector - GL_TEXTURE0 typedef std::vector> TextureBindingVector; - typedef std::map TextureBindingMap; + typedef angle::PackedEnumMap TextureBindingMap; TextureBindingMap mSamplerTextures; // Texture Completeness Caching @@ -536,7 +545,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable // // Note this requires that we also invalidate the completeness cache manually on events like // re-binding textures/samplers or a change in the program. For more information see the - // signal_utils.h header and the design doc linked there. + // Observer.h header and the design doc linked there. // A cache of complete textures. nullptr indicates unbound or incomplete. // Don't use BindingPointer because this cache is only valid within a draw call. @@ -556,10 +565,9 @@ class State : public angle::ObserverInterface, angle::NonCopyable typedef std::map> ActiveQueryMap; ActiveQueryMap mActiveQueries; - // Stores the currently bound buffer for each binding point. It has entries for the element - // array buffer and the transform feedback buffer but these should not be used. Instead these - // bind points are respectively owned by current the vertex array object and the current - // transform feedback object. + // Stores the currently bound buffer for each binding point. It has an entry for the element + // array buffer but it should not be used. Instead this bind point is owned by the current + // vertex array object. using BoundBufferMap = angle::PackedEnumMap>; BoundBufferMap mBoundBuffers; @@ -570,9 +578,7 @@ class State : public angle::ObserverInterface, angle::NonCopyable BindingPointer mTransformFeedback; - BindingPointer mPixelUnpackBuffer; PixelUnpackState mUnpack; - BindingPointer mPixelPackBuffer; PixelPackState mPack; bool mPrimitiveRestart; @@ -600,8 +606,11 @@ class State : public angle::ObserverInterface, angle::NonCopyable // GL_ANGLE_program_cache_control bool mProgramBinaryCacheEnabled; + // GLES1 emulation: state specific to GLES1 + GLES1State mGLES1State; + DirtyBits mDirtyBits; - DirtyObjects mDirtyObjects; + mutable DirtyObjects mDirtyObjects; mutable AttributesMask mDirtyCurrentValues; }; diff --git a/gfx/angle/checkout/src/libANGLE/Stream.cpp b/gfx/angle/checkout/src/libANGLE/Stream.cpp index 58cca5ec88ac..387795524c1f 100644 --- a/gfx/angle/checkout/src/libANGLE/Stream.cpp +++ b/gfx/angle/checkout/src/libANGLE/Stream.cpp @@ -121,7 +121,7 @@ Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER); if (bufferType == EGL_RGB_BUFFER) { - mPlanes[0].texture = glState.getTargetTexture(GL_TEXTURE_EXTERNAL_OES); + mPlanes[0].texture = glState.getTargetTexture(gl::TextureType::External); ASSERT(mPlanes[0].texture != nullptr); mPlanes[0].texture->bindStream(this); mConsumerType = ConsumerType::GLTextureRGB; @@ -138,7 +138,7 @@ Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl if (mPlanes[i].textureUnit != EGL_NONE) { mPlanes[i].texture = - glState.getSamplerTexture(mPlanes[i].textureUnit, GL_TEXTURE_EXTERNAL_OES); + glState.getSamplerTexture(mPlanes[i].textureUnit, gl::TextureType::External); ASSERT(mPlanes[i].texture != nullptr); } } diff --git a/gfx/angle/checkout/src/libANGLE/Surface.cpp b/gfx/angle/checkout/src/libANGLE/Surface.cpp index aff7131da691..7ca82a86c10a 100644 --- a/gfx/angle/checkout/src/libANGLE/Surface.cpp +++ b/gfx/angle/checkout/src/libANGLE/Surface.cpp @@ -156,7 +156,7 @@ void Surface::postSwap(const gl::Context *context) if (mRobustResourceInitialization && mSwapBehavior != EGL_BUFFER_PRESERVED) { mInitState = gl::InitState::MayNeedInit; - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStorageChange(context); } } diff --git a/gfx/angle/checkout/src/libANGLE/Texture.cpp b/gfx/angle/checkout/src/libANGLE/Texture.cpp index a8200b37c63d..d7953aee62d9 100644 --- a/gfx/angle/checkout/src/libANGLE/Texture.cpp +++ b/gfx/angle/checkout/src/libANGLE/Texture.cpp @@ -31,23 +31,11 @@ bool IsPointSampled(const SamplerState &samplerState) samplerState.minFilter == GL_NEAREST_MIPMAP_NEAREST)); } -size_t GetImageDescIndex(GLenum target, size_t level) +size_t GetImageDescIndex(TextureTarget target, size_t level) { - return IsCubeMapTextureTarget(target) ? ((level * 6) + CubeMapTextureTargetToLayerIndex(target)) - : level; -} - -ImageIndex GetImageIndexFromDescIndex(GLenum target, size_t descIndex) -{ - if (target == GL_TEXTURE_CUBE_MAP) - { - size_t faceIndex = descIndex % 6; - size_t mipIndex = descIndex / 6; - return ImageIndex::MakeCube(LayerIndexToCubeMapTextureTarget(faceIndex), - static_cast(mipIndex)); - } - - return ImageIndex::MakeGeneric(target, static_cast(descIndex)); + return TextureTargetToType(target) == TextureType::CubeMap + ? (level * 6 + CubeMapTextureTargetToFaceIndex(target)) + : level; } InitState DetermineInitState(const Context *context, const uint8_t *pixels) @@ -83,10 +71,7 @@ bool IsMipmapFiltered(const SamplerState &samplerState) } SwizzleState::SwizzleState() - : swizzleRed(GL_INVALID_INDEX), - swizzleGreen(GL_INVALID_INDEX), - swizzleBlue(GL_INVALID_INDEX), - swizzleAlpha(GL_INVALID_INDEX) + : swizzleRed(GL_RED), swizzleGreen(GL_GREEN), swizzleBlue(GL_BLUE), swizzleAlpha(GL_ALPHA) { } @@ -112,18 +97,18 @@ bool SwizzleState::operator!=(const SwizzleState &other) const return !(*this == other); } -TextureState::TextureState(GLenum target) - : mTarget(target), - mSwizzleState(GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA), - mSamplerState(SamplerState::CreateDefaultForTarget(target)), +TextureState::TextureState(TextureType type) + : mType(type), + mSamplerState(SamplerState::CreateDefaultForTarget(type)), mBaseLevel(0), mMaxLevel(1000), mDepthStencilTextureMode(GL_DEPTH_COMPONENT), mImmutableFormat(false), mImmutableLevels(0), mUsage(GL_NONE), - mImageDescs((IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1) * - (target == GL_TEXTURE_CUBE_MAP ? 6 : 1)), + mImageDescs((IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1) * (type == TextureType::CubeMap ? 6 : 1)), + mCropRect(0, 0, 0, 0), + mGenerateMipmapHint(GL_FALSE), mInitState(InitState::MayNeedInit) { } @@ -167,9 +152,9 @@ GLuint TextureState::getMipmapMaxLevel() const { const ImageDesc &baseImageDesc = getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel()); GLuint expectedMipLevels = 0; - if (mTarget == GL_TEXTURE_3D) + if (mType == TextureType::_3D) { - const int maxDim = std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height), + const int maxDim = std::max(std::max(baseImageDesc.size.width, baseImageDesc.size.height), baseImageDesc.size.depth); expectedMipLevels = static_cast(log2(maxDim)); } @@ -209,18 +194,20 @@ bool TextureState::setMaxLevel(GLuint maxLevel) // For OpenGL ES2 the base level is always zero. bool TextureState::isCubeComplete() const { - ASSERT(mTarget == GL_TEXTURE_CUBE_MAP); + ASSERT(mType == TextureType::CubeMap); - const ImageDesc &baseImageDesc = - getImageDesc(FirstCubeMapTextureTarget, getEffectiveBaseLevel()); + angle::EnumIterator face = kCubeMapTextureTargetMin; + const ImageDesc &baseImageDesc = getImageDesc(*face, getEffectiveBaseLevel()); if (baseImageDesc.size.width == 0 || baseImageDesc.size.width != baseImageDesc.size.height) { return false; } - for (GLenum face = FirstCubeMapTextureTarget + 1; face <= LastCubeMapTextureTarget; face++) + ++face; + + for (; face != kAfterCubeMapTextureTargetMax; ++face) { - const ImageDesc &faceImageDesc = getImageDesc(face, getEffectiveBaseLevel()); + const ImageDesc &faceImageDesc = getImageDesc(*face, getEffectiveBaseLevel()); if (faceImageDesc.size.width != baseImageDesc.size.width || faceImageDesc.size.height != baseImageDesc.size.height || !Format::SameSized(faceImageDesc.format, baseImageDesc.format)) @@ -232,6 +219,32 @@ bool TextureState::isCubeComplete() const return true; } +const ImageDesc &TextureState::getBaseLevelDesc() const +{ + ASSERT(mType != TextureType::CubeMap || isCubeComplete()); + return getImageDesc(getBaseImageTarget(), getEffectiveBaseLevel()); +} + +void TextureState::setCrop(const gl::Rectangle& rect) +{ + mCropRect = rect; +} + +const gl::Rectangle& TextureState::getCrop() const +{ + return mCropRect; +} + +void TextureState::setGenerateMipmapHint(GLenum hint) +{ + mGenerateMipmapHint = hint; +} + +GLenum TextureState::getGenerateMipmapHint() const +{ + return mGenerateMipmapHint; +} + bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, const ContextState &data) const { @@ -249,7 +262,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, // handled by the above condition. ASSERT(mBaseLevel < IMPLEMENTATION_MAX_TEXTURE_LEVELS || mImmutableFormat); - if (mTarget == GL_TEXTURE_CUBE_MAP && baseImageDesc.size.width != baseImageDesc.size.height) + if (mType == TextureType::CubeMap && baseImageDesc.size.width != baseImageDesc.size.height) { return false; } @@ -259,7 +272,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, // is NEAREST_MIPMAP_LINEAR and magFilter is LINEAR(table 20.11,). For multismaple texture, // filter state of multisample texture is ignored(11.1.3.3). So it shouldn't be judged as // incomplete texture. So, we ignore filtering for multisample texture completeness here. - if (mTarget != GL_TEXTURE_2D_MULTISAMPLE && + if (mType != TextureType::_2DMultisample && !baseImageDesc.format.info->filterSupport(data.getClientVersion(), data.getExtensions()) && !IsPointSampled(samplerState)) { @@ -275,7 +288,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, } } - if (mTarget != GL_TEXTURE_2D_MULTISAMPLE && IsMipmapFiltered(samplerState)) + if (mType != TextureType::_2DMultisample && IsMipmapFiltered(samplerState)) { if (!npotSupport) { @@ -292,7 +305,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, } else { - if (mTarget == GL_TEXTURE_CUBE_MAP && !isCubeComplete()) + if (mType == TextureType::CubeMap && !isCubeComplete()) { return false; } @@ -306,7 +319,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, // texture, the texture will be considered incomplete. // Sampler object state which does not affect sampling for the type of texture bound to a // texture unit, such as TEXTURE_WRAP_R for an external texture, does not affect completeness. - if (mTarget == GL_TEXTURE_EXTERNAL_OES) + if (mType == TextureType::External) { if (samplerState.wrapS != GL_CLAMP_TO_EDGE || samplerState.wrapT != GL_CLAMP_TO_EDGE) { @@ -324,7 +337,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, // depth and stencil format (see table 3.13), the value of TEXTURE_COMPARE_- // MODE is NONE, and either the magnification filter is not NEAREST or the mini- // fication filter is neither NEAREST nor NEAREST_MIPMAP_NEAREST. - if (mTarget != GL_TEXTURE_2D_MULTISAMPLE && baseImageDesc.format.info->depthBits > 0 && + if (mType != TextureType::_2DMultisample && baseImageDesc.format.info->depthBits > 0 && data.getClientMajorVersion() >= 3) { // Note: we restrict this validation to sized types. For the OES_depth_textures @@ -351,7 +364,7 @@ bool TextureState::computeSamplerCompleteness(const SamplerState &samplerState, // For multismaple texture, filter state of multisample texture is ignored(11.1.3.3). // So it shouldn't be judged as incomplete texture. So, we ignore filtering for multisample // texture completeness here. - if (mTarget != GL_TEXTURE_2D_MULTISAMPLE && baseImageDesc.format.info->depthBits > 0 && + if (mType != TextureType::_2DMultisample && baseImageDesc.format.info->depthBits > 0 && mDepthStencilTextureMode == GL_STENCIL_INDEX) { if ((samplerState.minFilter != GL_NEAREST && @@ -371,9 +384,9 @@ bool TextureState::computeMipmapCompleteness() const for (GLuint level = getEffectiveBaseLevel(); level <= maxLevel; level++) { - if (mTarget == GL_TEXTURE_CUBE_MAP) + if (mType == TextureType::CubeMap) { - for (GLenum face = FirstCubeMapTextureTarget; face <= LastCubeMapTextureTarget; face++) + for (TextureTarget face : AllCubeFaceTextureTargets()) { if (!computeLevelCompleteness(face, level)) { @@ -383,7 +396,7 @@ bool TextureState::computeMipmapCompleteness() const } else { - if (!computeLevelCompleteness(mTarget, level)) + if (!computeLevelCompleteness(NonCubeTextureTypeToTarget(mType), level)) { return false; } @@ -393,7 +406,7 @@ bool TextureState::computeMipmapCompleteness() const return true; } -bool TextureState::computeLevelCompleteness(GLenum target, size_t level) const +bool TextureState::computeLevelCompleteness(TextureTarget target, size_t level) const { ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS); @@ -433,14 +446,14 @@ bool TextureState::computeLevelCompleteness(GLenum target, size_t level) const return false; } - if (mTarget == GL_TEXTURE_3D) + if (mType == TextureType::_3D) { if (levelImageDesc.size.depth != std::max(1, baseImageDesc.size.depth >> relativeLevel)) { return false; } } - else if (mTarget == GL_TEXTURE_2D_ARRAY) + else if (mType == TextureType::_2DArray) { if (levelImageDesc.size.depth != baseImageDesc.size.depth) { @@ -451,9 +464,10 @@ bool TextureState::computeLevelCompleteness(GLenum target, size_t level) const return true; } -GLenum TextureState::getBaseImageTarget() const +TextureTarget TextureState::getBaseImageTarget() const { - return mTarget == GL_TEXTURE_CUBE_MAP ? FirstCubeMapTextureTarget : mTarget; + return mType == TextureType::CubeMap ? kCubeMapTextureTargetMin + : NonCubeTextureTypeToTarget(mType); } ImageDesc::ImageDesc() @@ -479,14 +493,14 @@ ImageDesc::ImageDesc(const Extents &size, { } -const ImageDesc &TextureState::getImageDesc(GLenum target, size_t level) const +const ImageDesc &TextureState::getImageDesc(TextureTarget target, size_t level) const { size_t descIndex = GetImageDescIndex(target, level); ASSERT(descIndex < mImageDescs.size()); return mImageDescs[descIndex]; } -void TextureState::setImageDesc(GLenum target, size_t level, const ImageDesc &desc) +void TextureState::setImageDesc(TextureTarget target, size_t level, const ImageDesc &desc) { size_t descIndex = GetImageDescIndex(target, level); ASSERT(descIndex < mImageDescs.size()); @@ -513,21 +527,21 @@ void TextureState::setImageDescChain(GLuint baseLevel, int relativeLevel = (level - baseLevel); Extents levelSize(std::max(baseSize.width >> relativeLevel, 1), std::max(baseSize.height >> relativeLevel, 1), - (mTarget == GL_TEXTURE_2D_ARRAY) + (mType == TextureType::_2DArray) ? baseSize.depth : std::max(baseSize.depth >> relativeLevel, 1)); ImageDesc levelInfo(levelSize, format, initState); - if (mTarget == GL_TEXTURE_CUBE_MAP) + if (mType == TextureType::CubeMap) { - for (GLenum face = FirstCubeMapTextureTarget; face <= LastCubeMapTextureTarget; face++) + for (TextureTarget face : AllCubeFaceTextureTargets()) { setImageDesc(face, level, levelInfo); } } else { - setImageDesc(mTarget, level, levelInfo); + setImageDesc(NonCubeTextureTypeToTarget(mType), level, levelInfo); } } } @@ -538,12 +552,12 @@ void TextureState::setImageDescChainMultisample(Extents baseSize, bool fixedSampleLocations, InitState initState) { - ASSERT(mTarget == GL_TEXTURE_2D_MULTISAMPLE); + ASSERT(mType == TextureType::_2DMultisample); ImageDesc levelInfo(baseSize, format, samples, fixedSampleLocations, initState); - setImageDesc(mTarget, 0, levelInfo); + setImageDesc(TextureTarget::_2DMultisample, 0, levelInfo); } -void TextureState::clearImageDesc(GLenum target, size_t level) +void TextureState::clearImageDesc(TextureTarget target, size_t level) { setImageDesc(target, level, ImageDesc()); } @@ -556,9 +570,9 @@ void TextureState::clearImageDescs() } } -Texture::Texture(rx::GLImplFactory *factory, GLuint id, GLenum target) +Texture::Texture(rx::GLImplFactory *factory, GLuint id, TextureType type) : egl::ImageSibling(id), - mState(target), + mState(type), mTexture(factory->createTexture(mState)), mLabel(), mBoundSurface(nullptr), @@ -604,9 +618,9 @@ const std::string &Texture::getLabel() const return mLabel; } -GLenum Texture::getTarget() const +TextureType Texture::getType() const { - return mState.mTarget; + return mState.mType; } void Texture::setSwizzleRed(GLenum swizzleRed) @@ -851,45 +865,39 @@ const TextureState &Texture::getTextureState() const return mState; } -size_t Texture::getWidth(GLenum target, size_t level) const +size_t Texture::getWidth(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).size.width; } -size_t Texture::getHeight(GLenum target, size_t level) const +size_t Texture::getHeight(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).size.height; } -size_t Texture::getDepth(GLenum target, size_t level) const +size_t Texture::getDepth(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).size.depth; } -const Format &Texture::getFormat(GLenum target, size_t level) const +const Format &Texture::getFormat(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).format; } -GLsizei Texture::getSamples(GLenum target, size_t level) const +GLsizei Texture::getSamples(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).samples; } -bool Texture::getFixedSampleLocations(GLenum target, size_t level) const +bool Texture::getFixedSampleLocations(TextureTarget target, size_t level) const { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); return mState.getImageDesc(target, level).fixedSampleLocations; } @@ -916,29 +924,30 @@ egl::Stream *Texture::getBoundStream() const void Texture::signalDirty(const Context *context, InitState initState) { mState.mInitState = initState; - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStorageChange(context); invalidateCompletenessCache(); } Error Texture::setImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, const Extents &size, GLenum format, GLenum type, const uint8_t *pixels) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); ANGLE_TRY(orphanImages(context)); - ANGLE_TRY(mTexture->setImage(context, target, level, internalFormat, size, format, type, - unpackState, pixels)); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + ANGLE_TRY(mTexture->setImage(context, index, internalFormat, size, format, type, unpackState, + pixels)); InitState initState = DetermineInitState(context, pixels); mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat, type), initState)); @@ -949,39 +958,41 @@ Error Texture::setImage(const Context *context, Error Texture::setSubImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Box &area, GLenum format, GLenum type, const uint8_t *pixels) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); ANGLE_TRY(ensureSubImageInitialized(context, target, level, area)); - return mTexture->setSubImage(context, target, level, area, format, type, unpackState, pixels); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + return mTexture->setSubImage(context, index, area, format, type, unpackState, pixels); } Error Texture::setCompressedImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, const Extents &size, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); ANGLE_TRY(orphanImages(context)); - ANGLE_TRY(mTexture->setCompressedImage(context, target, level, internalFormat, size, - unpackState, imageSize, pixels)); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + ANGLE_TRY(mTexture->setCompressedImage(context, index, internalFormat, size, unpackState, + imageSize, pixels)); InitState initState = DetermineInitState(context, pixels); mState.setImageDesc(target, level, ImageDesc(size, Format(internalFormat), initState)); @@ -992,31 +1003,31 @@ Error Texture::setCompressedImage(const Context *context, Error Texture::setCompressedSubImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Box &area, GLenum format, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); ANGLE_TRY(ensureSubImageInitialized(context, target, level, area)); - return mTexture->setCompressedSubImage(context, target, level, area, format, unpackState, - imageSize, pixels); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + return mTexture->setCompressedSubImage(context, index, area, format, unpackState, imageSize, + pixels); } Error Texture::copyImage(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Rectangle &sourceArea, GLenum internalFormat, Framebuffer *source) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); @@ -1029,7 +1040,9 @@ Error Texture::copyImage(const Context *context, Box destBox(0, 0, 0, sourceArea.width, sourceArea.height, 1); ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox)); - ANGLE_TRY(mTexture->copyImage(context, target, level, sourceArea, internalFormat, source)); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + ANGLE_TRY(mTexture->copyImage(context, index, sourceArea, internalFormat, source)); const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE); @@ -1045,14 +1058,13 @@ Error Texture::copyImage(const Context *context, } Error Texture::copySubImage(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Offset &destOffset, const Rectangle &sourceArea, Framebuffer *source) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); // Ensure source FBO is initialized. ANGLE_TRY(source->ensureReadAttachmentInitialized(context, GL_COLOR_BUFFER_BIT)); @@ -1060,22 +1072,24 @@ Error Texture::copySubImage(const Context *context, Box destBox(destOffset.x, destOffset.y, destOffset.y, sourceArea.width, sourceArea.height, 1); ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox)); - return mTexture->copySubImage(context, target, level, destOffset, sourceArea, source); + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + return mTexture->copySubImage(context, index, destOffset, sourceArea, source); } Error Texture::copyTexture(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, GLenum type, - size_t sourceLevel, + GLint sourceLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, bool unpackUnmultiplyAlpha, Texture *source) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); + ASSERT(source->getType() != TextureType::CubeMap); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); @@ -1085,11 +1099,13 @@ Error Texture::copyTexture(const Context *context, // Note: we don't have a way to notify which portions of the image changed currently. ANGLE_TRY(source->ensureInitialized(context)); - ANGLE_TRY(mTexture->copyTexture(context, target, level, internalFormat, type, sourceLevel, - unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha, - source)); + ImageIndex index = ImageIndex::MakeGeneric(target, level); - const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0); + ANGLE_TRY(mTexture->copyTexture(context, index, internalFormat, type, sourceLevel, unpackFlipY, + unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source)); + + const auto &sourceDesc = + source->mState.getImageDesc(NonCubeTextureTypeToTarget(source->getType()), 0); const InternalFormat &internalFormatInfo = GetInternalFormatInfo(internalFormat, type); mState.setImageDesc( target, level, @@ -1101,18 +1117,17 @@ Error Texture::copyTexture(const Context *context, } Error Texture::copySubTexture(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Offset &destOffset, - size_t sourceLevel, + GLint sourceLevel, const Rectangle &sourceArea, bool unpackFlipY, bool unpackPremultiplyAlpha, bool unpackUnmultiplyAlpha, Texture *source) { - ASSERT(target == mState.mTarget || - (mState.mTarget == GL_TEXTURE_CUBE_MAP && IsCubeMapTextureTarget(target))); + ASSERT(TextureTargetToType(target) == mState.mType); // Ensure source is initialized. ANGLE_TRY(source->ensureInitialized(context)); @@ -1120,7 +1135,9 @@ Error Texture::copySubTexture(const Context *context, Box destBox(destOffset.x, destOffset.y, destOffset.y, sourceArea.width, sourceArea.height, 1); ANGLE_TRY(ensureSubImageInitialized(context, target, level, destBox)); - return mTexture->copySubTexture(context, target, level, destOffset, sourceLevel, sourceArea, + ImageIndex index = ImageIndex::MakeGeneric(target, level); + + return mTexture->copySubTexture(context, index, destOffset, sourceLevel, sourceArea, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha, source); } @@ -1133,26 +1150,27 @@ Error Texture::copyCompressedTexture(const Context *context, const Texture *sour ANGLE_TRY(mTexture->copyCompressedTexture(context, source)); - ASSERT(source->getTarget() != GL_TEXTURE_CUBE_MAP && getTarget() != GL_TEXTURE_CUBE_MAP); - const auto &sourceDesc = source->mState.getImageDesc(source->getTarget(), 0); - mState.setImageDesc(getTarget(), 0, sourceDesc); + ASSERT(source->getType() != TextureType::CubeMap && getType() != TextureType::CubeMap); + const auto &sourceDesc = + source->mState.getImageDesc(NonCubeTextureTypeToTarget(source->getType()), 0); + mState.setImageDesc(NonCubeTextureTypeToTarget(getType()), 0, sourceDesc); return NoError(); } Error Texture::setStorage(const Context *context, - GLenum target, + TextureType type, GLsizei levels, GLenum internalFormat, const Extents &size) { - ASSERT(target == mState.mTarget); + ASSERT(type == mState.mType); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); ANGLE_TRY(orphanImages(context)); - ANGLE_TRY(mTexture->setStorage(context, target, levels, internalFormat, size)); + ANGLE_TRY(mTexture->setStorage(context, type, levels, internalFormat, size)); mState.mImmutableFormat = true; mState.mImmutableLevels = static_cast(levels); @@ -1173,19 +1191,19 @@ Error Texture::setStorage(const Context *context, } Error Texture::setStorageMultisample(const Context *context, - GLenum target, + TextureType type, GLsizei samples, GLint internalFormat, const Extents &size, bool fixedSampleLocations) { - ASSERT(target == mState.mTarget); + ASSERT(type == mState.mType); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); ANGLE_TRY(orphanImages(context)); - ANGLE_TRY(mTexture->setStorageMultisample(context, target, samples, internalFormat, size, + ANGLE_TRY(mTexture->setStorageMultisample(context, type, samples, internalFormat, size, fixedSampleLocations)); mState.mImmutableFormat = true; @@ -1214,25 +1232,36 @@ Error Texture::generateMipmap(const Context *context) const GLuint baseLevel = mState.getEffectiveBaseLevel(); const GLuint maxLevel = mState.getMipmapMaxLevel(); - if (maxLevel > baseLevel) + if (maxLevel <= baseLevel) { - syncState(); - const ImageDesc &baseImageInfo = - mState.getImageDesc(mState.getBaseImageTarget(), baseLevel); - - // Clear the base image immediately if necessary. - if (context->isRobustResourceInitEnabled() && - baseImageInfo.initState == InitState::MayNeedInit) - { - ANGLE_TRY(initializeContents( - context, GetImageIndexFromDescIndex(mState.getBaseImageTarget(), baseLevel))); - } - - ANGLE_TRY(mTexture->generateMipmap(context)); - - mState.setImageDescChain(baseLevel, maxLevel, baseImageInfo.size, baseImageInfo.format, - InitState::Initialized); + return NoError(); } + syncState(); + + // Clear the base image(s) immediately if needed + if (context->isRobustResourceInitEnabled()) + { + ImageIndexIterator it = + ImageIndexIterator::MakeGeneric(mState.mType, baseLevel, baseLevel + 1); + while (it.hasNext()) + { + const ImageIndex index = it.next(); + const ImageDesc &desc = mState.getImageDesc(index.target, index.mipIndex); + + if (desc.initState == InitState::MayNeedInit) + { + ANGLE_TRY(initializeContents(context, index)); + } + } + } + + ANGLE_TRY(mTexture->generateMipmap(context)); + + // Propagate the format and size of the bsae mip to the smaller ones. Cube maps are guaranteed + // to have faces of the same size and format so any faces can be picked. + const ImageDesc &baseImageInfo = mState.getImageDesc(mState.getBaseImageTarget(), baseLevel); + mState.setImageDescChain(baseLevel, maxLevel, baseImageInfo.size, baseImageInfo.format, + InitState::Initialized); signalDirty(context, InitState::Initialized); @@ -1252,10 +1281,10 @@ Error Texture::bindTexImageFromSurface(const Context *context, egl::Surface *sur mBoundSurface = surface; // Set the image info to the size and format of the surface - ASSERT(mState.mTarget == GL_TEXTURE_2D || mState.mTarget == GL_TEXTURE_RECTANGLE_ANGLE); + ASSERT(mState.mType == TextureType::_2D || mState.mType == TextureType::Rectangle); Extents size(surface->getWidth(), surface->getHeight(), 1); ImageDesc desc(size, surface->getBindTexImageFormat(), InitState::Initialized); - mState.setImageDesc(mState.mTarget, 0, desc); + mState.setImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0, desc); signalDirty(context, InitState::Initialized); return NoError(); } @@ -1267,8 +1296,8 @@ Error Texture::releaseTexImageFromSurface(const Context *context) ANGLE_TRY(mTexture->releaseTexImage(context)); // Erase the image info for level 0 - ASSERT(mState.mTarget == GL_TEXTURE_2D || mState.mTarget == GL_TEXTURE_RECTANGLE_ANGLE); - mState.clearImageDesc(mState.mTarget, 0); + ASSERT(mState.mType == TextureType::_2D || mState.mType == TextureType::Rectangle); + mState.clearImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0); signalDirty(context, InitState::Initialized); return NoError(); } @@ -1282,7 +1311,7 @@ void Texture::bindStream(egl::Stream *stream) mBoundStream = stream; - ASSERT(mState.mTarget == GL_TEXTURE_EXTERNAL_OES); + ASSERT(mState.mType == TextureType::External); } void Texture::releaseStream() @@ -1295,10 +1324,10 @@ Error Texture::acquireImageFromStream(const Context *context, const egl::Stream::GLTextureDescription &desc) { ASSERT(mBoundStream != nullptr); - ANGLE_TRY(mTexture->setImageExternal(context, mState.mTarget, mBoundStream, desc)); + ANGLE_TRY(mTexture->setImageExternal(context, mState.mType, mBoundStream, desc)); Extents size(desc.width, desc.height, 1); - mState.setImageDesc(mState.mTarget, 0, + mState.setImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0, ImageDesc(size, Format(desc.internalFormat), InitState::Initialized)); signalDirty(context, InitState::Initialized); return NoError(); @@ -1307,11 +1336,11 @@ Error Texture::acquireImageFromStream(const Context *context, Error Texture::releaseImageFromStream(const Context *context) { ASSERT(mBoundStream != nullptr); - ANGLE_TRY(mTexture->setImageExternal(context, mState.mTarget, nullptr, + ANGLE_TRY(mTexture->setImageExternal(context, mState.mType, nullptr, egl::Stream::GLTextureDescription())); // Set to incomplete - mState.clearImageDesc(mState.mTarget, 0); + mState.clearImageDesc(NonCubeTextureTypeToTarget(mState.mType), 0); signalDirty(context, InitState::Initialized); return NoError(); } @@ -1329,16 +1358,16 @@ Error Texture::releaseTexImageInternal(const Context *context) return NoError(); } -Error Texture::setEGLImageTarget(const Context *context, GLenum target, egl::Image *imageTarget) +Error Texture::setEGLImageTarget(const Context *context, TextureType type, egl::Image *imageTarget) { - ASSERT(target == mState.mTarget); - ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_EXTERNAL_OES); + ASSERT(type == mState.mType); + ASSERT(type == TextureType::_2D || type == TextureType::External); // Release from previous calls to eglBindTexImage, to avoid calling the Impl after ANGLE_TRY(releaseTexImageInternal(context)); ANGLE_TRY(orphanImages(context)); - ANGLE_TRY(mTexture->setEGLImageTarget(context, target, imageTarget)); + ANGLE_TRY(mTexture->setEGLImageTarget(context, type, imageTarget)); setTargetImage(context, imageTarget); @@ -1348,7 +1377,8 @@ Error Texture::setEGLImageTarget(const Context *context, GLenum target, egl::Ima auto initState = imageTarget->sourceInitState(); mState.clearImageDescs(); - mState.setImageDesc(target, 0, ImageDesc(size, imageTarget->getFormat(), initState)); + mState.setImageDesc(NonCubeTextureTypeToTarget(type), 0, + ImageDesc(size, imageTarget->getFormat(), initState)); signalDirty(context, initState); return NoError(); @@ -1369,6 +1399,26 @@ GLsizei Texture::getAttachmentSamples(const ImageIndex &imageIndex) const return getSamples(imageIndex.target, 0); } +void Texture::setCrop(const gl::Rectangle& rect) +{ + mState.setCrop(rect); +} + +const gl::Rectangle& Texture::getCrop() const +{ + return mState.getCrop(); +} + +void Texture::setGenerateMipmapHint(GLenum hint) +{ + mState.setGenerateMipmapHint(hint); +} + +GLenum Texture::getGenerateMipmapHint() const +{ + return mState.getGenerateMipmapHint(); +} + void Texture::onAttach(const Context *context) { addRef(); @@ -1432,16 +1482,18 @@ Error Texture::ensureInitialized(const Context *context) bool anyDirty = false; - for (size_t descIndex = 0; descIndex < mState.mImageDescs.size(); ++descIndex) + ImageIndexIterator it = + ImageIndexIterator::MakeGeneric(mState.mType, 0, IMPLEMENTATION_MAX_TEXTURE_LEVELS + 1); + while (it.hasNext()) { - auto &imageDesc = mState.mImageDescs[descIndex]; - if (imageDesc.initState == InitState::MayNeedInit) + const ImageIndex index = it.next(); + ImageDesc &desc = mState.mImageDescs[GetImageDescIndex(index.target, index.mipIndex)]; + if (desc.initState == InitState::MayNeedInit) { ASSERT(mState.mInitState == InitState::MayNeedInit); - const auto &imageIndex = GetImageIndexFromDescIndex(mState.mTarget, descIndex); - ANGLE_TRY(initializeContents(context, imageIndex)); - imageDesc.initState = InitState::Initialized; - anyDirty = true; + ANGLE_TRY(initializeContents(context, index)); + desc.initState = InitState::Initialized; + anyDirty = true; } } if (anyDirty) @@ -1471,7 +1523,7 @@ void Texture::setInitState(const ImageIndex &imageIndex, InitState initState) } Error Texture::ensureSubImageInitialized(const Context *context, - GLenum target, + TextureTarget target, size_t level, const gl::Box &area) { @@ -1482,7 +1534,7 @@ Error Texture::ensureSubImageInitialized(const Context *context, // Pre-initialize the texture contents if necessary. // TODO(jmadill): Check if area overlaps the entire texture. - const auto &imageIndex = GetImageIndexFromDescIndex(target, level); + ImageIndex imageIndex = ImageIndex::MakeGeneric(target, static_cast(level)); const auto &desc = mState.getImageDesc(imageIndex); if (desc.initState == InitState::MayNeedInit) { diff --git a/gfx/angle/checkout/src/libANGLE/Texture.h b/gfx/angle/checkout/src/libANGLE/Texture.h index 9293cd0bedac..b77ea8562253 100644 --- a/gfx/angle/checkout/src/libANGLE/Texture.h +++ b/gfx/angle/checkout/src/libANGLE/Texture.h @@ -9,8 +9,8 @@ #ifndef LIBANGLE_TEXTURE_H_ #define LIBANGLE_TEXTURE_H_ -#include #include +#include #include "angle_gl.h" #include "common/Optional.h" @@ -90,7 +90,7 @@ struct SwizzleState final // State from Table 6.9 (state per texture object) in the OpenGL ES 3.0.2 spec. struct TextureState final : private angle::NonCopyable { - TextureState(GLenum target); + TextureState(TextureType type); ~TextureState(); bool swizzleRequired() const; @@ -106,15 +106,26 @@ struct TextureState final : private angle::NonCopyable bool isCubeComplete() const; - const ImageDesc &getImageDesc(GLenum target, size_t level) const; + const ImageDesc &getImageDesc(TextureTarget target, size_t level) const; const ImageDesc &getImageDesc(const ImageIndex &imageIndex) const; - GLenum getTarget() const { return mTarget; } + TextureType getType() const { return mType; }; const SwizzleState &getSwizzleState() const { return mSwizzleState; } const SamplerState &getSamplerState() const { return mSamplerState; } GLenum getUsage() const { return mUsage; } GLenum getDepthStencilTextureMode() const { return mDepthStencilTextureMode; } + // Returns the desc of the base level. Only valid for cube-complete/mip-complete textures. + const ImageDesc &getBaseLevelDesc() const; + + // GLES1 emulation: For GL_OES_draw_texture + void setCrop(const gl::Rectangle& rect); + const gl::Rectangle& getCrop() const; + + // GLES1 emulation: Auto-mipmap generation is a texparameter + void setGenerateMipmapHint(GLenum hint); + GLenum getGenerateMipmapHint() const; + private: // Texture needs access to the ImageDesc functions. friend class Texture; @@ -125,11 +136,11 @@ struct TextureState final : private angle::NonCopyable bool computeSamplerCompleteness(const SamplerState &samplerState, const ContextState &data) const; bool computeMipmapCompleteness() const; - bool computeLevelCompleteness(GLenum target, size_t level) const; + bool computeLevelCompleteness(TextureTarget target, size_t level) const; - GLenum getBaseImageTarget() const; + TextureTarget getBaseImageTarget() const; - void setImageDesc(GLenum target, size_t level, const ImageDesc &desc); + void setImageDesc(TextureTarget target, size_t level, const ImageDesc &desc); void setImageDescChain(GLuint baselevel, GLuint maxLevel, Extents baseSize, @@ -141,10 +152,10 @@ struct TextureState final : private angle::NonCopyable bool fixedSampleLocations, InitState initState); - void clearImageDesc(GLenum target, size_t level); + void clearImageDesc(TextureTarget target, size_t level); void clearImageDescs(); - const GLenum mTarget; + const TextureType mType; SwizzleState mSwizzleState; @@ -162,17 +173,24 @@ struct TextureState final : private angle::NonCopyable GLenum mUsage; std::vector mImageDescs; + + // GLES1 emulation: Texture crop rectangle + // For GL_OES_draw_texture + gl::Rectangle mCropRect; + + // GLES1 emulation: Generate-mipmap hint per texture + GLenum mGenerateMipmapHint; + InitState mInitState; }; bool operator==(const TextureState &a, const TextureState &b); bool operator!=(const TextureState &a, const TextureState &b); -class Texture final : public egl::ImageSibling, - public LabeledObject +class Texture final : public egl::ImageSibling, public LabeledObject { public: - Texture(rx::GLImplFactory *factory, GLuint id, GLenum target); + Texture(rx::GLImplFactory *factory, GLuint id, TextureType type); ~Texture() override; Error onDestroy(const Context *context) override; @@ -180,7 +198,7 @@ class Texture final : public egl::ImageSibling, void setLabel(const std::string &label) override; const std::string &getLabel() const override; - GLenum getTarget() const; + TextureType getType() const; void setSwizzleRed(GLenum swizzleRed); GLenum getSwizzleRed() const; @@ -247,12 +265,12 @@ class Texture final : public egl::ImageSibling, const TextureState &getTextureState() const; - size_t getWidth(GLenum target, size_t level) const; - size_t getHeight(GLenum target, size_t level) const; - size_t getDepth(GLenum target, size_t level) const; - GLsizei getSamples(GLenum target, size_t level) const; - bool getFixedSampleLocations(GLenum target, size_t level) const; - const Format &getFormat(GLenum target, size_t level) const; + size_t getWidth(TextureTarget target, size_t level) const; + size_t getHeight(TextureTarget target, size_t level) const; + size_t getDepth(TextureTarget target, size_t level) const; + GLsizei getSamples(TextureTarget target, size_t level) const; + bool getFixedSampleLocations(TextureTarget target, size_t level) const; + const Format &getFormat(TextureTarget target, size_t level) const; // Returns the value called "q" in the GLES 3.0.4 spec section 3.8.10. GLuint getMipmapMaxLevel() const; @@ -261,8 +279,8 @@ class Texture final : public egl::ImageSibling, Error setImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, const Extents &size, GLenum format, @@ -270,8 +288,8 @@ class Texture final : public egl::ImageSibling, const uint8_t *pixels); Error setSubImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Box &area, GLenum format, GLenum type, @@ -279,49 +297,49 @@ class Texture final : public egl::ImageSibling, Error setCompressedImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, const Extents &size, size_t imageSize, const uint8_t *pixels); Error setCompressedSubImage(const Context *context, const PixelUnpackState &unpackState, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Box &area, GLenum format, size_t imageSize, const uint8_t *pixels); Error copyImage(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Rectangle &sourceArea, GLenum internalFormat, Framebuffer *source); Error copySubImage(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Offset &destOffset, const Rectangle &sourceArea, Framebuffer *source); Error copyTexture(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, GLenum internalFormat, GLenum type, - size_t sourceLevel, + GLint sourceLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, bool unpackUnmultiplyAlpha, Texture *source); Error copySubTexture(const Context *context, - GLenum target, - size_t level, + TextureTarget target, + GLint level, const Offset &destOffset, - size_t sourceLevel, + GLint sourceLevel, const Rectangle &sourceArea, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -330,19 +348,19 @@ class Texture final : public egl::ImageSibling, Error copyCompressedTexture(const Context *context, const Texture *source); Error setStorage(const Context *context, - GLenum target, + TextureType type, GLsizei levels, GLenum internalFormat, const Extents &size); Error setStorageMultisample(const Context *context, - GLenum target, + TextureType type, GLsizei samples, GLint internalformat, const Extents &size, bool fixedSampleLocations); - Error setEGLImageTarget(const Context *context, GLenum target, egl::Image *imageTarget); + Error setEGLImageTarget(const Context *context, TextureType type, egl::Image *imageTarget); Error generateMipmap(const Context *context); @@ -360,6 +378,12 @@ class Texture final : public egl::ImageSibling, const Format &getAttachmentFormat(GLenum binding, const ImageIndex &imageIndex) const override; GLsizei getAttachmentSamples(const ImageIndex &imageIndex) const override; + // GLES1 emulation + void setCrop(const gl::Rectangle& rect); + const gl::Rectangle& getCrop() const; + void setGenerateMipmapHint(GLenum generate); + GLenum getGenerateMipmapHint() const; + void onAttach(const Context *context) override; void onDetach(const Context *context) override; GLuint getId() const override; @@ -425,7 +449,7 @@ class Texture final : public egl::ImageSibling, Error releaseTexImageInternal(const Context *context); Error ensureSubImageInitialized(const Context *context, - GLenum target, + TextureTarget target, size_t level, const gl::Box &area); diff --git a/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp b/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp index 99235debd4cc..0471b5ba3a5e 100644 --- a/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp +++ b/gfx/angle/checkout/src/libANGLE/TransformFeedback.cpp @@ -6,23 +6,54 @@ #include "libANGLE/TransformFeedback.h" +#include "common/mathutil.h" #include "libANGLE/Buffer.h" #include "libANGLE/Caps.h" +#include "libANGLE/Context.h" #include "libANGLE/ContextState.h" #include "libANGLE/Program.h" #include "libANGLE/renderer/GLImplFactory.h" #include "libANGLE/renderer/TransformFeedbackImpl.h" +#include + namespace gl { +angle::CheckedNumeric GetVerticesNeededForDraw(GLenum primitiveMode, + GLsizei count, + GLsizei primcount) +{ + if (count < 0 || primcount < 0) + { + return 0; + } + // Transform feedback only outputs complete primitives, so we need to round down to the nearest + // complete primitive before multiplying by the number of instances. + angle::CheckedNumeric checkedCount = count; + angle::CheckedNumeric checkedPrimcount = primcount; + switch (primitiveMode) + { + case GL_TRIANGLES: + return checkedPrimcount * (checkedCount - checkedCount % 3); + case GL_LINES: + return checkedPrimcount * (checkedCount - checkedCount % 2); + case GL_POINTS: + return checkedPrimcount * checkedCount; + default: + NOTREACHED(); + return checkedPrimcount * checkedCount; + } +} + TransformFeedbackState::TransformFeedbackState(size_t maxIndexedBuffers) : mLabel(), mActive(false), mPrimitiveMode(GL_NONE), mPaused(false), + mVerticesDrawn(0), + mVertexCapacity(0), mProgram(nullptr), - mGenericBuffer(), mIndexedBuffers(maxIndexedBuffers) { } @@ -31,11 +62,6 @@ TransformFeedbackState::~TransformFeedbackState() { } -const BindingPointer &TransformFeedbackState::getGenericBuffer() const -{ - return mGenericBuffer; -} - const OffsetBindingPointer &TransformFeedbackState::getIndexedBuffer(size_t idx) const { return mIndexedBuffers[idx]; @@ -56,6 +82,7 @@ TransformFeedback::TransformFeedback(rx::GLImplFactory *implFactory, GLuint id, Error TransformFeedback::onDestroy(const Context *context) { + ASSERT(!context || !context->isCurrentTransformFeedback(this)); if (mState.mProgram) { mState.mProgram->release(context); @@ -63,7 +90,6 @@ Error TransformFeedback::onDestroy(const Context *context) } ASSERT(!mState.mProgram); - mState.mGenericBuffer.set(context, nullptr); for (size_t i = 0; i < mState.mIndexedBuffers.size(); i++) { mState.mIndexedBuffers[i].set(context, nullptr); @@ -92,15 +118,37 @@ void TransformFeedback::begin(const Context *context, GLenum primitiveMode, Prog mState.mActive = true; mState.mPrimitiveMode = primitiveMode; mState.mPaused = false; + mState.mVerticesDrawn = 0; mImplementation->begin(primitiveMode); bindProgram(context, program); + + if (program) + { + // Compute the number of vertices we can draw before overflowing the bound buffers. + auto strides = program->getTransformFeedbackStrides(); + ASSERT(strides.size() <= mState.mIndexedBuffers.size() && !strides.empty()); + GLsizeiptr minCapacity = std::numeric_limits::max(); + for (size_t index = 0; index < strides.size(); index++) + { + GLsizeiptr capacity = + GetBoundBufferAvailableSize(mState.mIndexedBuffers[index]) / strides[index]; + minCapacity = std::min(minCapacity, capacity); + } + mState.mVertexCapacity = minCapacity; + } + else + { + mState.mVertexCapacity = 0; + } } void TransformFeedback::end(const Context *context) { - mState.mActive = false; - mState.mPrimitiveMode = GL_NONE; - mState.mPaused = false; + mState.mActive = false; + mState.mPrimitiveMode = GL_NONE; + mState.mPaused = false; + mState.mVerticesDrawn = 0; + mState.mVertexCapacity = 0; mImplementation->end(); if (mState.mProgram) { @@ -136,6 +184,30 @@ GLenum TransformFeedback::getPrimitiveMode() const return mState.mPrimitiveMode; } +bool TransformFeedback::checkBufferSpaceForDraw(GLsizei count, GLsizei primcount) const +{ + auto vertices = + mState.mVerticesDrawn + GetVerticesNeededForDraw(mState.mPrimitiveMode, count, primcount); + return vertices.IsValid() && vertices.ValueOrDie() <= mState.mVertexCapacity; +} + +void TransformFeedback::onVerticesDrawn(const Context *context, GLsizei count, GLsizei primcount) +{ + ASSERT(mState.mActive && !mState.mPaused); + // All draws should be validated with checkBufferSpaceForDraw so ValueOrDie should never fail. + mState.mVerticesDrawn = + (mState.mVerticesDrawn + GetVerticesNeededForDraw(mState.mPrimitiveMode, count, primcount)) + .ValueOrDie(); + + for (auto &buffer : mState.mIndexedBuffers) + { + if (buffer.get() != nullptr) + { + buffer->onTransformFeedback(context); + } + } +} + void TransformFeedback::bindProgram(const Context *context, Program *program) { if (mState.mProgram != program) @@ -157,33 +229,22 @@ bool TransformFeedback::hasBoundProgram(GLuint program) const return mState.mProgram != nullptr && mState.mProgram->id() == program; } -void TransformFeedback::bindGenericBuffer(const Context *context, Buffer *buffer) -{ - mState.mGenericBuffer.set(context, buffer); - mImplementation->bindGenericBuffer(mState.mGenericBuffer); -} - void TransformFeedback::detachBuffer(const Context *context, GLuint bufferName) { + bool isBound = context->isCurrentTransformFeedback(this); for (size_t index = 0; index < mState.mIndexedBuffers.size(); index++) { if (mState.mIndexedBuffers[index].id() == bufferName) { + if (isBound) + { + mState.mIndexedBuffers[index]->onBindingChanged(false, + BufferBinding::TransformFeedback); + } mState.mIndexedBuffers[index].set(context, nullptr); mImplementation->bindIndexedBuffer(index, mState.mIndexedBuffers[index]); } } - - if (mState.mGenericBuffer.id() == bufferName) - { - mState.mGenericBuffer.set(context, nullptr); - mImplementation->bindGenericBuffer(mState.mGenericBuffer); - } -} - -const BindingPointer &TransformFeedback::getGenericBuffer() const -{ - return mState.mGenericBuffer; } void TransformFeedback::bindIndexedBuffer(const Context *context, @@ -193,7 +254,17 @@ void TransformFeedback::bindIndexedBuffer(const Context *context, size_t size) { ASSERT(index < mState.mIndexedBuffers.size()); + bool isBound = context && context->isCurrentTransformFeedback(this); + if (isBound && mState.mIndexedBuffers[index].get()) + { + mState.mIndexedBuffers[index]->onBindingChanged(false, BufferBinding::TransformFeedback); + } mState.mIndexedBuffers[index].set(context, buffer, offset, size); + if (isBound && buffer) + { + buffer->onBindingChanged(true, BufferBinding::TransformFeedback); + } + mImplementation->bindIndexedBuffer(index, mState.mIndexedBuffers[index]); } @@ -208,6 +279,18 @@ size_t TransformFeedback::getIndexedBufferCount() const return mState.mIndexedBuffers.size(); } +bool TransformFeedback::buffersBoundForOtherUse() const +{ + for (auto &buffer : mState.mIndexedBuffers) + { + if (buffer.get() && buffer->isBoundForTransformFeedbackAndOtherUse()) + { + return true; + } + } + return false; +} + rx::TransformFeedbackImpl *TransformFeedback::getImplementation() { return mImplementation; @@ -218,4 +301,14 @@ const rx::TransformFeedbackImpl *TransformFeedback::getImplementation() const return mImplementation; } +void TransformFeedback::onBindingChanged(bool bound) +{ + for (auto &buffer : mState.mIndexedBuffers) + { + if (buffer.get()) + { + buffer->onBindingChanged(bound, BufferBinding::TransformFeedback); + } + } +} } diff --git a/gfx/angle/checkout/src/libANGLE/TransformFeedback.h b/gfx/angle/checkout/src/libANGLE/TransformFeedback.h index 2b35d43f9a1f..d470f91056b7 100644 --- a/gfx/angle/checkout/src/libANGLE/TransformFeedback.h +++ b/gfx/angle/checkout/src/libANGLE/TransformFeedback.h @@ -33,7 +33,6 @@ class TransformFeedbackState final : angle::NonCopyable TransformFeedbackState(size_t maxIndexedBuffers); ~TransformFeedbackState(); - const BindingPointer &getGenericBuffer() const; const OffsetBindingPointer &getIndexedBuffer(size_t idx) const; const std::vector> &getIndexedBuffers() const; @@ -45,10 +44,11 @@ class TransformFeedbackState final : angle::NonCopyable bool mActive; GLenum mPrimitiveMode; bool mPaused; + GLsizeiptr mVerticesDrawn; + GLsizeiptr mVertexCapacity; Program *mProgram; - BindingPointer mGenericBuffer; std::vector> mIndexedBuffers; }; @@ -70,12 +70,17 @@ class TransformFeedback final : public RefCountObject, public LabeledObject bool isActive() const; bool isPaused() const; GLenum getPrimitiveMode() const; + // Validates that the vertices produced by a draw call will fit in the bound transform feedback + // buffers. + bool checkBufferSpaceForDraw(GLsizei count, GLsizei primcount) const; + // This must be called after each draw call when transform feedback is enabled to keep track of + // how many vertices have been written to the buffers. This information is needed by + // checkBufferSpaceForDraw because each draw call appends vertices to the buffers starting just + // after the last vertex of the previous draw call. + void onVerticesDrawn(const Context *context, GLsizei count, GLsizei primcount); bool hasBoundProgram(GLuint program) const; - void bindGenericBuffer(const Context *context, Buffer *buffer); - const BindingPointer &getGenericBuffer() const; - void bindIndexedBuffer(const Context *context, size_t index, Buffer *buffer, @@ -84,11 +89,16 @@ class TransformFeedback final : public RefCountObject, public LabeledObject const OffsetBindingPointer &getIndexedBuffer(size_t index) const; size_t getIndexedBufferCount() const; + // Returns true if any buffer bound to this object is also bound to another target. + bool buffersBoundForOtherUse() const; + void detachBuffer(const Context *context, GLuint bufferName); rx::TransformFeedbackImpl *getImplementation(); const rx::TransformFeedbackImpl *getImplementation() const; + void onBindingChanged(bool bound); + private: void bindProgram(const Context *context, Program *program); diff --git a/gfx/angle/checkout/src/libANGLE/Uniform.cpp b/gfx/angle/checkout/src/libANGLE/Uniform.cpp index dee8eee91522..31cbc0969531 100644 --- a/gfx/angle/checkout/src/libANGLE/Uniform.cpp +++ b/gfx/angle/checkout/src/libANGLE/Uniform.cpp @@ -13,44 +13,37 @@ namespace gl { -StaticallyUsed::StaticallyUsed() - : vertexStaticUse(false), fragmentStaticUse(false), computeStaticUse(false) +ActiveVariable::ActiveVariable() { } -StaticallyUsed::~StaticallyUsed() +ActiveVariable::~ActiveVariable() { } -StaticallyUsed::StaticallyUsed(const StaticallyUsed &rhs) = default; -StaticallyUsed &StaticallyUsed::operator=(const StaticallyUsed &rhs) = default; +ActiveVariable::ActiveVariable(const ActiveVariable &rhs) = default; +ActiveVariable &ActiveVariable::operator=(const ActiveVariable &rhs) = default; -void StaticallyUsed::setStaticUse(GLenum shaderType, bool used) +void ActiveVariable::setActive(ShaderType shaderType, bool used) { - switch (shaderType) - { - case GL_VERTEX_SHADER: - vertexStaticUse = used; - break; - - case GL_FRAGMENT_SHADER: - fragmentStaticUse = used; - break; - - case GL_COMPUTE_SHADER: - computeStaticUse = used; - break; - - default: - UNREACHABLE(); - } + ASSERT(shaderType != ShaderType::InvalidEnum); + mActiveUseBits.set(shaderType, used); } -void StaticallyUsed::unionReferencesWith(const StaticallyUsed &other) +bool ActiveVariable::isActive(ShaderType shaderType) const { - vertexStaticUse |= other.vertexStaticUse; - fragmentStaticUse |= other.fragmentStaticUse; - computeStaticUse |= other.computeStaticUse; + ASSERT(shaderType != ShaderType::InvalidEnum); + return mActiveUseBits[shaderType]; +} + +void ActiveVariable::unionReferencesWith(const ActiveVariable &other) +{ + mActiveUseBits |= other.mActiveUseBits; +} + +ShaderType ActiveVariable::getFirstShaderTypeWhereActive() const +{ + return static_cast(gl::ScanForward(mActiveUseBits.bits())); } LinkedUniform::LinkedUniform() @@ -92,7 +85,7 @@ LinkedUniform::LinkedUniform(const sh::Uniform &uniform) LinkedUniform::LinkedUniform(const LinkedUniform &uniform) : sh::Uniform(uniform), - StaticallyUsed(uniform), + ActiveVariable(uniform), typeInfo(uniform.typeInfo), bufferIndex(uniform.bufferIndex), blockInfo(uniform.blockInfo) @@ -102,7 +95,7 @@ LinkedUniform::LinkedUniform(const LinkedUniform &uniform) LinkedUniform &LinkedUniform::operator=(const LinkedUniform &uniform) { sh::Uniform::operator=(uniform); - StaticallyUsed::operator=(uniform); + ActiveVariable::operator=(uniform); typeInfo = uniform.typeInfo; bufferIndex = uniform.bufferIndex; blockInfo = uniform.blockInfo; diff --git a/gfx/angle/checkout/src/libANGLE/Uniform.h b/gfx/angle/checkout/src/libANGLE/Uniform.h index 14c39387a688..a3ca589b80a8 100644 --- a/gfx/angle/checkout/src/libANGLE/Uniform.h +++ b/gfx/angle/checkout/src/libANGLE/Uniform.h @@ -20,24 +20,25 @@ namespace gl { struct UniformTypeInfo; -struct StaticallyUsed +struct ActiveVariable { - StaticallyUsed(); - StaticallyUsed(const StaticallyUsed &rhs); - virtual ~StaticallyUsed(); + ActiveVariable(); + ActiveVariable(const ActiveVariable &rhs); + virtual ~ActiveVariable(); - StaticallyUsed &operator=(const StaticallyUsed &rhs); + ActiveVariable &operator=(const ActiveVariable &rhs); - void setStaticUse(GLenum shaderType, bool used); - void unionReferencesWith(const StaticallyUsed &other); + ShaderType getFirstShaderTypeWhereActive() const; + void setActive(ShaderType shaderType, bool used); + void unionReferencesWith(const ActiveVariable &other); + bool isActive(ShaderType shaderType) const; - bool vertexStaticUse; - bool fragmentStaticUse; - bool computeStaticUse; + private: + ShaderBitSet mActiveUseBits; }; // Helper struct representing a single shader uniform -struct LinkedUniform : public sh::Uniform, public StaticallyUsed +struct LinkedUniform : public sh::Uniform, public ActiveVariable { LinkedUniform(); LinkedUniform(GLenum type, @@ -69,7 +70,7 @@ struct LinkedUniform : public sh::Uniform, public StaticallyUsed sh::BlockMemberInfo blockInfo; }; -struct BufferVariable : public sh::ShaderVariable, public StaticallyUsed +struct BufferVariable : public sh::ShaderVariable, public ActiveVariable { BufferVariable(); BufferVariable(GLenum type, @@ -88,7 +89,7 @@ struct BufferVariable : public sh::ShaderVariable, public StaticallyUsed // Parent struct for atomic counter, uniform block, and shader storage block buffer, which all // contain a group of shader variables, and have a GL buffer backed. -struct ShaderVariableBuffer : public StaticallyUsed +struct ShaderVariableBuffer : public ActiveVariable { ShaderVariableBuffer(); ShaderVariableBuffer(const ShaderVariableBuffer &other); diff --git a/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp b/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp index 41c677f5aa59..e88c01916c9c 100644 --- a/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp +++ b/gfx/angle/checkout/src/libANGLE/VaryingPacking.cpp @@ -292,10 +292,13 @@ bool VaryingPacking::collectAndPackUserVaryings(gl::InfoLog &infoLog, const sh::Varying *output = ref.second.fragment; // Only pack statically used varyings that have a matched input or output, plus special - // builtins. + // builtins. Note that we pack all statically used user-defined varyings even if they are + // not active. GLES specs are a bit vague on whether it's allowed to only pack active + // varyings, though GLES 3.1 spec section 11.1.2.1 says that "device-dependent + // optimizations" may be used to make vertex shader outputs fit. if ((input && output && output->staticUse) || - (input && input->isBuiltIn() && input->staticUse) || - (output && output->isBuiltIn() && output->staticUse)) + (input && input->isBuiltIn() && input->active) || + (output && output->isBuiltIn() && output->active)) { const sh::Varying *varying = output ? output : input; diff --git a/gfx/angle/checkout/src/libANGLE/VertexArray.cpp b/gfx/angle/checkout/src/libANGLE/VertexArray.cpp index 55fb1b274bc4..0735c2a39b5e 100644 --- a/gfx/angle/checkout/src/libANGLE/VertexArray.cpp +++ b/gfx/angle/checkout/src/libANGLE/VertexArray.cpp @@ -9,6 +9,7 @@ #include "libANGLE/VertexArray.h" #include "libANGLE/Buffer.h" #include "libANGLE/Context.h" +#include "libANGLE/renderer/BufferImpl.h" #include "libANGLE/renderer/GLImplFactory.h" #include "libANGLE/renderer/VertexArrayImpl.h" @@ -36,16 +37,24 @@ VertexArray::VertexArray(rx::GLImplFactory *factory, size_t maxAttribBindings) : mId(id), mState(maxAttribs, maxAttribBindings), - mVertexArray(factory->createVertexArray(mState)) + mVertexArray(factory->createVertexArray(mState)), + mElementArrayBufferObserverBinding(this, maxAttribBindings) { + for (size_t attribIndex = 0; attribIndex < maxAttribBindings; ++attribIndex) + { + mArrayBufferObserverBindings.emplace_back(this, attribIndex); + } } void VertexArray::onDestroy(const Context *context) { + bool isBound = context->isCurrentVertexArray(this); for (auto &binding : mState.mVertexBindings) { - binding.setBuffer(context, nullptr); + binding.setBuffer(context, nullptr, isBound); } + if (isBound && mState.mElementArrayBuffer.get()) + mState.mElementArrayBuffer->onBindingChanged(false, BufferBinding::ElementArray); mState.mElementArrayBuffer.set(context, nullptr); mVertexArray->destroy(context); SafeDelete(mVertexArray); @@ -74,16 +83,19 @@ const std::string &VertexArray::getLabel() const void VertexArray::detachBuffer(const Context *context, GLuint bufferName) { + bool isBound = context->isCurrentVertexArray(this); for (auto &binding : mState.mVertexBindings) { if (binding.getBuffer().id() == bufferName) { - binding.setBuffer(context, nullptr); + binding.setBuffer(context, nullptr, isBound); } } if (mState.mElementArrayBuffer.id() == bufferName) { + if (isBound && mState.mElementArrayBuffer.get()) + mState.mElementArrayBuffer->onBindingChanged(false, BufferBinding::Array); mState.mElementArrayBuffer.set(context, nullptr); } } @@ -105,7 +117,19 @@ size_t VertexArray::GetVertexIndexFromDirtyBit(size_t dirtyBit) static_assert(gl::MAX_VERTEX_ATTRIBS == gl::MAX_VERTEX_ATTRIB_BINDINGS, "The stride of vertex attributes should equal to that of vertex bindings."); ASSERT(dirtyBit > DIRTY_BIT_ELEMENT_ARRAY_BUFFER); - return (dirtyBit - DIRTY_BIT_ATTRIB_0_ENABLED) % gl::MAX_VERTEX_ATTRIBS; + return (dirtyBit - DIRTY_BIT_ATTRIB_0) % gl::MAX_VERTEX_ATTRIBS; +} + +void VertexArray::setDirtyAttribBit(size_t attribIndex, DirtyAttribBitType dirtyAttribBit) +{ + mDirtyBits.set(DIRTY_BIT_ATTRIB_0 + attribIndex); + mDirtyAttribBits[attribIndex].set(dirtyAttribBit); +} + +void VertexArray::setDirtyBindingBit(size_t bindingIndex, DirtyBindingBitType dirtyBindingBit) +{ + mDirtyBits.set(DIRTY_BIT_BINDING_0 + bindingIndex); + mDirtyBindingBits[bindingIndex].set(dirtyBindingBit); } void VertexArray::bindVertexBufferImpl(const Context *context, @@ -115,12 +139,15 @@ void VertexArray::bindVertexBufferImpl(const Context *context, GLsizei stride) { ASSERT(bindingIndex < getMaxBindings()); + bool isBound = context->isCurrentVertexArray(this); VertexBinding *binding = &mState.mVertexBindings[bindingIndex]; - binding->setBuffer(context, boundBuffer); + binding->setBuffer(context, boundBuffer, isBound); binding->setOffset(offset); binding->setStride(stride); + + updateObserverBinding(bindingIndex); } void VertexArray::bindVertexBuffer(const Context *context, @@ -130,8 +157,7 @@ void VertexArray::bindVertexBuffer(const Context *context, GLsizei stride) { bindVertexBufferImpl(context, bindingIndex, boundBuffer, offset, stride); - - mDirtyBits.set(DIRTY_BIT_BINDING_0_BUFFER + bindingIndex); + setDirtyBindingBit(bindingIndex, DIRTY_BINDING_BUFFER); } void VertexArray::setVertexAttribBinding(const Context *context, @@ -146,8 +172,9 @@ void VertexArray::setVertexAttribBinding(const Context *context, ASSERT(context->getClientVersion() >= ES_3_1); mState.mVertexAttributes[attribIndex].bindingIndex = bindingIndex; - mDirtyBits.set(DIRTY_BIT_ATTRIB_0_BINDING + attribIndex); + setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_BINDING); } + mState.mVertexAttributes[attribIndex].bindingIndex = static_cast(bindingIndex); } void VertexArray::setVertexBindingDivisor(size_t bindingIndex, GLuint divisor) @@ -155,8 +182,7 @@ void VertexArray::setVertexBindingDivisor(size_t bindingIndex, GLuint divisor) ASSERT(bindingIndex < getMaxBindings()); mState.mVertexBindings[bindingIndex].setDivisor(divisor); - - mDirtyBits.set(DIRTY_BIT_BINDING_0_DIVISOR + bindingIndex); + setDirtyBindingBit(bindingIndex, DIRTY_BINDING_DIVISOR); } void VertexArray::setVertexAttribFormatImpl(size_t attribIndex, @@ -187,8 +213,7 @@ void VertexArray::setVertexAttribFormat(size_t attribIndex, GLuint relativeOffset) { setVertexAttribFormatImpl(attribIndex, size, type, normalized, pureInteger, relativeOffset); - - mDirtyBits.set(DIRTY_BIT_ATTRIB_0_FORMAT + attribIndex); + setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_FORMAT); } void VertexArray::setVertexAttribDivisor(const Context *context, size_t attribIndex, GLuint divisor) @@ -207,7 +232,7 @@ void VertexArray::enableAttribute(size_t attribIndex, bool enabledState) mState.mVertexAttributesTypeMask.setIndex( GetVertexAttributeBaseType(mState.mVertexAttributes[attribIndex]), attribIndex); - mDirtyBits.set(DIRTY_BIT_ATTRIB_0_ENABLED + attribIndex); + setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_ENABLED); // Update state cache mState.mEnabledAttributesMask.set(attribIndex, enabledState); @@ -239,22 +264,84 @@ void VertexArray::setVertexAttribPointer(const Context *context, bindVertexBufferImpl(context, attribIndex, boundBuffer, offset, effectiveStride); - mDirtyBits.set(DIRTY_BIT_ATTRIB_0_POINTER + attribIndex); + setDirtyAttribBit(attribIndex, DIRTY_ATTRIB_POINTER); } void VertexArray::setElementArrayBuffer(const Context *context, Buffer *buffer) { + bool isBound = context->isCurrentVertexArray(this); + if (isBound && mState.mElementArrayBuffer.get()) + mState.mElementArrayBuffer->onBindingChanged(false, BufferBinding::ElementArray); mState.mElementArrayBuffer.set(context, buffer); + if (isBound && mState.mElementArrayBuffer.get()) + mState.mElementArrayBuffer->onBindingChanged(true, BufferBinding::ElementArray); + mElementArrayBufferObserverBinding.bind(buffer ? buffer->getImplementation() : nullptr); mDirtyBits.set(DIRTY_BIT_ELEMENT_ARRAY_BUFFER); } -void VertexArray::syncState(const Context *context) +gl::Error VertexArray::syncState(const Context *context) { if (mDirtyBits.any()) { - mVertexArray->syncState(context, mDirtyBits); + mDirtyBitsGuard = mDirtyBits; + ANGLE_TRY( + mVertexArray->syncState(context, mDirtyBits, mDirtyAttribBits, mDirtyBindingBits)); mDirtyBits.reset(); + mDirtyBitsGuard.reset(); + + // This is a bit of an implementation hack - but since we know the implementation + // details of the dirty bit class it should always have the same effect as iterating + // individual attribs. We could also look into schemes where iterating the dirty + // bit set also resets it as you pass through it. + memset(&mDirtyAttribBits, 0, sizeof(mDirtyAttribBits)); + memset(&mDirtyBindingBits, 0, sizeof(mDirtyBindingBits)); + } + return gl::NoError(); +} + +void VertexArray::onBindingChanged(bool bound) +{ + if (mState.mElementArrayBuffer.get()) + mState.mElementArrayBuffer->onBindingChanged(bound, BufferBinding::ElementArray); + for (auto &binding : mState.mVertexBindings) + { + binding.onContainerBindingChanged(bound); } } +VertexArray::DirtyBitType VertexArray::getDirtyBitFromIndex(bool contentsChanged, + angle::SubjectIndex index) const +{ + if (index == mArrayBufferObserverBindings.size()) + { + return contentsChanged ? DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA + : DIRTY_BIT_ELEMENT_ARRAY_BUFFER; + } + else + { + // Note: this currently just gets the top-level dirty bit. + ASSERT(index < mArrayBufferObserverBindings.size()); + return static_cast( + (contentsChanged ? DIRTY_BIT_BUFFER_DATA_0 : DIRTY_BIT_BINDING_0) + index); + } +} + +void VertexArray::onSubjectStateChange(const gl::Context *context, + angle::SubjectIndex index, + angle::SubjectMessage message) +{ + bool contentsChanged = (message == angle::SubjectMessage::CONTENTS_CHANGED); + DirtyBitType dirtyBit = getDirtyBitFromIndex(contentsChanged, index); + ASSERT(!mDirtyBitsGuard.valid() || mDirtyBitsGuard.value().test(dirtyBit)); + mDirtyBits.set(dirtyBit); + context->getGLState().setVertexArrayDirty(this); +} + +void VertexArray::updateObserverBinding(size_t bindingIndex) +{ + Buffer *boundBuffer = mState.mVertexBindings[bindingIndex].getBuffer().get(); + mArrayBufferObserverBindings[bindingIndex].bind(boundBuffer ? boundBuffer->getImplementation() + : nullptr); +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/VertexArray.h b/gfx/angle/checkout/src/libANGLE/VertexArray.h index 99dabf7cdded..6ceb0802a5bc 100644 --- a/gfx/angle/checkout/src/libANGLE/VertexArray.h +++ b/gfx/angle/checkout/src/libANGLE/VertexArray.h @@ -13,9 +13,10 @@ #ifndef LIBANGLE_VERTEXARRAY_H_ #define LIBANGLE_VERTEXARRAY_H_ -#include "libANGLE/RefCountObject.h" #include "libANGLE/Constants.h" #include "libANGLE/Debug.h" +#include "libANGLE/Observer.h" +#include "libANGLE/RefCountObject.h" #include "libANGLE/State.h" #include "libANGLE/VertexAttribute.h" @@ -72,7 +73,7 @@ class VertexArrayState final : angle::NonCopyable ComponentTypeMask mVertexAttributesTypeMask; }; -class VertexArray final : public LabeledObject +class VertexArray final : public angle::ObserverInterface, public LabeledObject { public: VertexArray(rx::GLImplFactory *factory, GLuint id, size_t maxAttribs, size_t maxAttribBindings); @@ -153,58 +154,96 @@ class VertexArray final : public LabeledObject return mState.getEnabledAttributesMask(); } + // Observer implementation + void onSubjectStateChange(const gl::Context *context, + angle::SubjectIndex index, + angle::SubjectMessage message) override; + + // Dirty bits for VertexArrays use a heirarchical design. At the top level, each attribute + // has a single dirty bit. Then an array of MAX_ATTRIBS dirty bits each has a dirty bit for + // enabled/pointer/format/binding. Bindings are handled similarly. Note that because the + // total number of dirty bits is 33, it will not be as fast on a 32-bit machine, which + // can't support the advanced 64-bit scanning intrinsics. We could consider packing the + // binding and attribute bits together if this becomes a problem. enum DirtyBitType { DIRTY_BIT_ELEMENT_ARRAY_BUFFER, + DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA, - // Reserve bits for enabled flags - DIRTY_BIT_ATTRIB_0_ENABLED, - DIRTY_BIT_ATTRIB_MAX_ENABLED = DIRTY_BIT_ATTRIB_0_ENABLED + gl::MAX_VERTEX_ATTRIBS, + // Dirty bits for attributes. + DIRTY_BIT_ATTRIB_0, + DIRTY_BIT_ATTRIB_MAX = DIRTY_BIT_ATTRIB_0 + gl::MAX_VERTEX_ATTRIBS, - // Reserve bits for attrib pointers - DIRTY_BIT_ATTRIB_0_POINTER = DIRTY_BIT_ATTRIB_MAX_ENABLED, - DIRTY_BIT_ATTRIB_MAX_POINTER = DIRTY_BIT_ATTRIB_0_POINTER + gl::MAX_VERTEX_ATTRIBS, + // Dirty bits for bindings. + DIRTY_BIT_BINDING_0 = DIRTY_BIT_ATTRIB_MAX, + DIRTY_BIT_BINDING_MAX = DIRTY_BIT_BINDING_0 + gl::MAX_VERTEX_ATTRIB_BINDINGS, - // Reserve bits for changes to VertexAttribFormat - DIRTY_BIT_ATTRIB_0_FORMAT = DIRTY_BIT_ATTRIB_MAX_POINTER, - DIRTY_BIT_ATTRIB_MAX_FORMAT = DIRTY_BIT_ATTRIB_0_FORMAT + gl::MAX_VERTEX_ATTRIBS, + // We keep separate dirty bits for bound buffers whose data changed since last update. + DIRTY_BIT_BUFFER_DATA_0 = DIRTY_BIT_BINDING_MAX, + DIRTY_BIT_BUFFER_DATA_MAX = DIRTY_BIT_BUFFER_DATA_0 + gl::MAX_VERTEX_ATTRIB_BINDINGS, - // Reserve bits for changes to VertexAttribBinding - DIRTY_BIT_ATTRIB_0_BINDING = DIRTY_BIT_ATTRIB_MAX_FORMAT, - DIRTY_BIT_ATTRIB_MAX_BINDING = DIRTY_BIT_ATTRIB_0_BINDING + gl::MAX_VERTEX_ATTRIBS, - - // Reserve bits for changes to BindVertexBuffer - DIRTY_BIT_BINDING_0_BUFFER = DIRTY_BIT_ATTRIB_MAX_BINDING, - DIRTY_BIT_BINDING_MAX_BUFFER = DIRTY_BIT_BINDING_0_BUFFER + gl::MAX_VERTEX_ATTRIB_BINDINGS, - - // Reserve bits for binding divisors - DIRTY_BIT_BINDING_0_DIVISOR = DIRTY_BIT_BINDING_MAX_BUFFER, - DIRTY_BIT_BINDING_MAX_DIVISOR = - DIRTY_BIT_BINDING_0_DIVISOR + gl::MAX_VERTEX_ATTRIB_BINDINGS, - - DIRTY_BIT_UNKNOWN = DIRTY_BIT_BINDING_MAX_DIVISOR, + DIRTY_BIT_UNKNOWN = DIRTY_BIT_BUFFER_DATA_MAX, DIRTY_BIT_MAX = DIRTY_BIT_UNKNOWN, }; + // We want to keep the number of dirty bits within 64 to keep iteration times fast. + static_assert(DIRTY_BIT_MAX <= 64, "Too many vertex array dirty bits."); + + enum DirtyAttribBitType + { + DIRTY_ATTRIB_ENABLED, + DIRTY_ATTRIB_POINTER, + DIRTY_ATTRIB_FORMAT, + DIRTY_ATTRIB_BINDING, + DIRTY_ATTRIB_UNKNOWN, + DIRTY_ATTRIB_MAX = DIRTY_ATTRIB_UNKNOWN, + }; + + enum DirtyBindingBitType + { + DIRTY_BINDING_BUFFER, + DIRTY_BINDING_DIVISOR, + DIRTY_BINDING_UNKNOWN, + DIRTY_BINDING_MAX = DIRTY_BINDING_UNKNOWN, + }; + using DirtyBits = angle::BitSet; + using DirtyAttribBits = angle::BitSet; + using DirtyBindingBits = angle::BitSet; + using DirtyAttribBitsArray = std::array; + using DirtyBindingBitsArray = std::array; static size_t GetVertexIndexFromDirtyBit(size_t dirtyBit); - void syncState(const Context *context); + gl::Error syncState(const Context *context); bool hasAnyDirtyBit() const { return mDirtyBits.any(); } ComponentTypeMask getAttributesTypeMask() const { return mState.mVertexAttributesTypeMask; } AttributesMask getAttributesMask() const { return mState.mEnabledAttributesMask; } + void onBindingChanged(bool bound); + private: ~VertexArray() override; + void setDirtyAttribBit(size_t attribIndex, DirtyAttribBitType dirtyAttribBit); + void setDirtyBindingBit(size_t bindingIndex, DirtyBindingBitType dirtyBindingBit); + + void updateObserverBinding(size_t bindingIndex); + DirtyBitType getDirtyBitFromIndex(bool contentsChanged, angle::SubjectIndex index) const; + GLuint mId; VertexArrayState mState; DirtyBits mDirtyBits; + DirtyAttribBitsArray mDirtyAttribBits; + DirtyBindingBitsArray mDirtyBindingBits; + Optional mDirtyBitsGuard; rx::VertexArrayImpl *mVertexArray; + + std::vector mArrayBufferObserverBindings; + angle::ObserverBinding mElementArrayBufferObserverBinding; }; } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp b/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp index 20f7452fa531..0cb5788205e4 100644 --- a/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp +++ b/gfx/angle/checkout/src/libANGLE/VertexAttribute.cpp @@ -38,6 +38,21 @@ VertexBinding &VertexBinding::operator=(VertexBinding &&binding) return *this; } +void VertexBinding::setBuffer(const gl::Context *context, Buffer *bufferIn, bool containerIsBound) +{ + if (mBuffer.get() && containerIsBound) + mBuffer->onBindingChanged(false, BufferBinding::Array); + mBuffer.set(context, bufferIn); + if (mBuffer.get() && containerIsBound) + mBuffer->onBindingChanged(true, BufferBinding::Array); +} + +void VertexBinding::onContainerBindingChanged(bool bound) +{ + if (mBuffer.get()) + mBuffer->onBindingChanged(bound, BufferBinding::Array); +} + VertexAttribute::VertexAttribute(GLuint bindingIndex) : enabled(false), type(GL_FLOAT), diff --git a/gfx/angle/checkout/src/libANGLE/VertexAttribute.h b/gfx/angle/checkout/src/libANGLE/VertexAttribute.h index 754c46cbab0d..d442b9920e23 100644 --- a/gfx/angle/checkout/src/libANGLE/VertexAttribute.h +++ b/gfx/angle/checkout/src/libANGLE/VertexAttribute.h @@ -37,7 +37,8 @@ class VertexBinding final : angle::NonCopyable void setOffset(GLintptr offsetIn) { mOffset = offsetIn; } const BindingPointer &getBuffer() const { return mBuffer; } - void setBuffer(const gl::Context *context, Buffer *bufferIn) { mBuffer.set(context, bufferIn); } + void setBuffer(const gl::Context *context, Buffer *bufferIn, bool containerIsBound); + void onContainerBindingChanged(bool bound); private: GLuint mStride; diff --git a/gfx/angle/checkout/src/libANGLE/angletypes.cpp b/gfx/angle/checkout/src/libANGLE/angletypes.cpp index b6f61c2f9033..8b614b9d1fa8 100644 --- a/gfx/angle/checkout/src/libANGLE/angletypes.cpp +++ b/gfx/angle/checkout/src/libANGLE/angletypes.cpp @@ -151,13 +151,13 @@ SamplerState::SamplerState() SamplerState::SamplerState(const SamplerState &other) = default; // static -SamplerState SamplerState::CreateDefaultForTarget(GLenum target) +SamplerState SamplerState::CreateDefaultForTarget(TextureType type) { SamplerState state; // According to OES_EGL_image_external and ARB_texture_rectangle: For external textures, the // default min filter is GL_LINEAR and the default s and t wrap modes are GL_CLAMP_TO_EDGE. - if (target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE) + if (type == TextureType::External || type == TextureType::Rectangle) { state.minFilter = GL_LINEAR; state.wrapS = GL_CLAMP_TO_EDGE; @@ -311,7 +311,7 @@ unsigned long ComponentTypeMask::to_ulong() const void ComponentTypeMask::from_ulong(unsigned long mask) { - mTypeMask = mask; + mTypeMask = angle::BitSet(mask); } bool ComponentTypeMask::Validate(unsigned long outputTypes, @@ -342,4 +342,33 @@ bool ComponentTypeMask::Validate(unsigned long outputTypes, return (outputTypes & inputMask) == ((inputTypes & outputMask) & inputMask); } +GLsizeiptr GetBoundBufferAvailableSize(const OffsetBindingPointer &binding) +{ + Buffer *buffer = binding.get(); + if (buffer) + { + if (binding.getSize() == 0) + return static_cast(buffer->getSize()); + angle::CheckedNumeric offset = binding.getOffset(); + angle::CheckedNumeric size = binding.getSize(); + angle::CheckedNumeric bufferSize = buffer->getSize(); + auto end = offset + size; + auto clampedSize = size; + auto difference = end - bufferSize; + if (!difference.IsValid()) + { + return 0; + } + if (difference.ValueOrDie() > 0) + { + clampedSize = size - difference; + } + return clampedSize.ValueOrDefault(0); + } + else + { + return 0; + } +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/angletypes.h b/gfx/angle/checkout/src/libANGLE/angletypes.h index 035c8fae595b..9c97b05fd002 100644 --- a/gfx/angle/checkout/src/libANGLE/angletypes.h +++ b/gfx/angle/checkout/src/libANGLE/angletypes.h @@ -9,7 +9,9 @@ #ifndef LIBANGLE_ANGLETYPES_H_ #define LIBANGLE_ANGLETYPES_H_ +#include "common/Color.h" #include "common/bitset_utils.h" +#include "common/vector_utils.h" #include "libANGLE/Constants.h" #include "libANGLE/Error.h" #include "libANGLE/PackedGLEnums.h" @@ -40,19 +42,10 @@ enum PrimitiveType PrimitiveType GetPrimitiveType(GLenum drawMode); -enum ShaderType -{ - SHADER_VERTEX, - SHADER_FRAGMENT, - SHADER_GEOMETRY, - SHADER_COMPUTE, - SHADER_TYPE_MAX -}; - struct Rectangle { Rectangle() : x(0), y(0), width(0), height(0) {} - Rectangle(int x_in, int y_in, int width_in, int height_in) + constexpr Rectangle(int x_in, int y_in, int width_in, int height_in) : x(x_in), y(y_in), width(width_in), height(height_in) { } @@ -75,12 +68,12 @@ bool ClipRectangle(const Rectangle &source, const Rectangle &clip, Rectangle *in struct Offset { + Offset() : x(0), y(0), z(0) {} + Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) {} + int x; int y; int z; - - Offset() : x(0), y(0), z(0) { } - Offset(int x_in, int y_in, int z_in) : x(x_in), y(y_in), z(z_in) { } }; bool operator==(const Offset &a, const Offset &b); @@ -88,17 +81,17 @@ bool operator!=(const Offset &a, const Offset &b); struct Extents { - int width; - int height; - int depth; - - Extents() : width(0), height(0), depth(0) { } - Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) { } + Extents() : width(0), height(0), depth(0) {} + Extents(int width_, int height_, int depth_) : width(width_), height(height_), depth(depth_) {} Extents(const Extents &other) = default; Extents &operator=(const Extents &other) = default; bool empty() const { return (width * height * depth) == 0; } + + int width; + int height; + int depth; }; bool operator==(const Extents &lhs, const Extents &rhs); @@ -106,18 +99,29 @@ bool operator!=(const Extents &lhs, const Extents &rhs); struct Box { + Box() : x(0), y(0), z(0), width(0), height(0), depth(0) {} + Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) + : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) + { + } + Box(const Offset &offset, const Extents &size) + : x(offset.x), + y(offset.y), + z(offset.z), + width(size.width), + height(size.height), + depth(size.depth) + { + } + bool operator==(const Box &other) const; + bool operator!=(const Box &other) const; + int x; int y; int z; int width; int height; int depth; - - Box() : x(0), y(0), z(0), width(0), height(0), depth(0) { } - Box(int x_in, int y_in, int z_in, int width_in, int height_in, int depth_in) : x(x_in), y(y_in), z(z_in), width(width_in), height(height_in), depth(depth_in) { } - Box(const Offset &offset, const Extents &size) : x(offset.x), y(offset.y), z(offset.z), width(size.width), height(size.height), depth(size.depth) { } - bool operator==(const Box &other) const; - bool operator!=(const Box &other) const; }; struct RasterizerState final @@ -204,7 +208,7 @@ struct SamplerState final SamplerState(); SamplerState(const SamplerState &other); - static SamplerState CreateDefaultForTarget(GLenum target); + static SamplerState CreateDefaultForTarget(TextureType type); GLenum minFilter; GLenum magFilter; @@ -316,7 +320,7 @@ using ContextID = uintptr_t; constexpr size_t CUBE_FACE_COUNT = 6; -using TextureMap = std::map>; +using TextureMap = angle::PackedEnumMap>; template using AttachmentArray = std::array; @@ -327,6 +331,11 @@ using DrawBuffersArray = std::array; template using AttribArray = std::array; +// OffsetBindingPointer.getSize() returns the size specified by the user, which may be larger than +// the size of the bound buffer. This function reduces the returned size to fit the bound buffer if +// necessary. Returns 0 if no buffer is bound or if integer overflow occurs. +GLsizeiptr GetBoundBufferAvailableSize(const OffsetBindingPointer &binding); + } // namespace gl namespace rx @@ -336,12 +345,14 @@ namespace rx #if __has_feature(cxx_rtti) #define ANGLE_HAS_DYNAMIC_CAST 1 #endif -#elif !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || defined(__GXX_RTTI)) +#elif !defined(NDEBUG) && (!defined(_MSC_VER) || defined(_CPPRTTI)) && \ + (!defined(__GNUC__) || __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || \ + defined(__GXX_RTTI)) #define ANGLE_HAS_DYNAMIC_CAST 1 #endif #ifdef ANGLE_HAS_DYNAMIC_CAST -#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast(obj) != nullptr) +#define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (dynamic_cast(obj) != nullptr) #undef ANGLE_HAS_DYNAMIC_CAST #else #define ANGLE_HAS_DYNAMIC_TYPE(type, obj) (obj != nullptr) @@ -351,15 +362,15 @@ namespace rx template inline DestT *GetAs(SrcT *src) { - ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT*, src)); - return static_cast(src); + ASSERT(ANGLE_HAS_DYNAMIC_TYPE(DestT *, src)); + return static_cast(src); } template inline const DestT *GetAs(const SrcT *src) { - ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT*, src)); - return static_cast(src); + ASSERT(ANGLE_HAS_DYNAMIC_TYPE(const DestT *, src)); + return static_cast(src); } #undef ANGLE_HAS_DYNAMIC_TYPE @@ -501,4 +512,4 @@ class ContextState; } // namespace gl -#endif // LIBANGLE_ANGLETYPES_H_ +#endif // LIBANGLE_ANGLETYPES_H_ diff --git a/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h b/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h index 6df390a097a4..f899b8846d76 100644 --- a/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h +++ b/gfx/angle/checkout/src/libANGLE/entry_points_enum_autogen.h @@ -29,9 +29,11 @@ enum class EntryPoint BindBufferBase, BindBufferRange, BindFramebuffer, + BindFramebufferOES, BindImageTexture, BindProgramPipeline, BindRenderbuffer, + BindRenderbufferOES, BindSampler, BindTexture, BindTransformFeedback, @@ -48,6 +50,7 @@ enum class EntryPoint BufferData, BufferSubData, CheckFramebufferStatus, + CheckFramebufferStatusOES, Clear, ClearBufferfi, ClearBufferfv, @@ -87,11 +90,13 @@ enum class EntryPoint DeleteBuffers, DeleteFencesNV, DeleteFramebuffers, + DeleteFramebuffersOES, DeleteProgram, DeleteProgramPipelines, DeleteQueries, DeleteQueriesEXT, DeleteRenderbuffers, + DeleteRenderbuffersOES, DeleteSamplers, DeleteShader, DeleteSync, @@ -149,7 +154,9 @@ enum class EntryPoint Fogxv, FramebufferParameteri, FramebufferRenderbuffer, + FramebufferRenderbufferOES, FramebufferTexture2D, + FramebufferTexture2DOES, FramebufferTextureLayer, FrontFace, Frustumf, @@ -157,16 +164,19 @@ enum class EntryPoint GenBuffers, GenFencesNV, GenFramebuffers, + GenFramebuffersOES, GenProgramPipelines, GenQueries, GenQueriesEXT, GenRenderbuffers, + GenRenderbuffersOES, GenSamplers, GenTextures, GenTransformFeedbacks, GenVertexArrays, GenVertexArraysOES, GenerateMipmap, + GenerateMipmapOES, GetActiveAttrib, GetActiveUniform, GetActiveUniformBlockName, @@ -189,6 +199,7 @@ enum class EntryPoint GetFloatv, GetFragDataLocation, GetFramebufferAttachmentParameteriv, + GetFramebufferAttachmentParameterivOES, GetFramebufferParameteriv, GetGraphicsResetStatusEXT, GetInteger64i_v, @@ -224,6 +235,7 @@ enum class EntryPoint GetQueryiv, GetQueryivEXT, GetRenderbufferParameteriv, + GetRenderbufferParameterivOES, GetSamplerParameterfv, GetSamplerParameteriv, GetShaderInfoLog, @@ -236,6 +248,9 @@ enum class EntryPoint GetTexEnvfv, GetTexEnviv, GetTexEnvxv, + GetTexGenfvOES, + GetTexGenivOES, + GetTexGenxvOES, GetTexLevelParameterfv, GetTexLevelParameteriv, GetTexParameterfv, @@ -264,11 +279,13 @@ enum class EntryPoint IsEnabled, IsFenceNV, IsFramebuffer, + IsFramebufferOES, IsProgram, IsProgramPipeline, IsQuery, IsQueryEXT, IsRenderbuffer, + IsRenderbufferOES, IsSampler, IsShader, IsSync, @@ -376,6 +393,7 @@ enum class EntryPoint RenderbufferStorage, RenderbufferStorageMultisample, RenderbufferStorageMultisampleANGLE, + RenderbufferStorageOES, ResumeTransformFeedback, Rotatef, Rotatex, @@ -407,6 +425,12 @@ enum class EntryPoint TexEnviv, TexEnvx, TexEnvxv, + TexGenfOES, + TexGenfvOES, + TexGeniOES, + TexGenivOES, + TexGenxOES, + TexGenxvOES, TexImage2D, TexImage3D, TexParameterf, diff --git a/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp index 149f79f45822..d530dbd1101a 100644 --- a/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp +++ b/gfx/angle/checkout/src/libANGLE/es3_copy_conversion_table_autogen.cpp @@ -1,7 +1,7 @@ // GENERATED FILE - DO NOT EDIT. // Generated by gen_copy_conversion_table.py using data from es3_copy_conversion_formats.json. // -// Copyright 2017 The ANGLE Project Authors. All rights reserved. +// Copyright 2018 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // diff --git a/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp b/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp index a7f3ebafc829..3a64ae1a5df1 100644 --- a/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp +++ b/gfx/angle/checkout/src/libANGLE/format_map_autogen.cpp @@ -2,7 +2,7 @@ // Generated by gen_format_map.py using data from format_map_data.json. // ES3 format info from es3_format_type_combinations.json. // -// Copyright 2017 The ANGLE Project Authors. All rights reserved. +// Copyright 2018 The ANGLE Project Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // diff --git a/gfx/angle/checkout/src/libANGLE/formatutils.cpp b/gfx/angle/checkout/src/libANGLE/formatutils.cpp index 2170cb43deaa..1792f75d5366 100644 --- a/gfx/angle/checkout/src/libANGLE/formatutils.cpp +++ b/gfx/angle/checkout/src/libANGLE/formatutils.cpp @@ -674,9 +674,9 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() AddRGBAFormat(&map, GL_RG8_SNORM, true, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RGB8, true, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported); AddRGBAFormat(&map, GL_RGB8_SNORM, true, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); - AddRGBAFormat(&map, GL_RGB565, true, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddRGBAFormat(&map, GL_RGBA4, true, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddRGBAFormat(&map, GL_RGB5_A1, true, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGB565, true, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGBA4, true, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGB5_A1, true, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA8, true, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, RequireESOrExt<3, 0, &Extensions::rgb8rgba8>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA8_SNORM, true, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, RequireES<3, 0>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RGB10_A2, true, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<3, 0>, RequireES<3, 0>, AlwaysSupported); @@ -737,7 +737,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() // Depth stencil formats // | Internal format |sized| D |S | X | Format | Type | Component type | Supported | Renderable | Filterable | - AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, true, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>); + AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT16, true, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireES<1, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>); AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT24, true, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>); AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32F, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<3, 0>, RequireES<3, 0>, RequireESOrExt<3, 0, &Extensions::depthTextures>); AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT32_OES, true, 32, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, RequireExtOrExt<&Extensions::depthTextures, &Extensions::depth32>, AlwaysSupported ); @@ -828,7 +828,7 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() // - All other stencil formats (all depth-stencil) are either float or normalized // - It affects only validation of internalformat in RenderbufferStorageMultisample. // | Internal format |sized|D |S |X | Format | Type | Component type | Supported | Renderable | Filterable | - AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, NeverSupported); + AddDepthStencilFormat(&map, GL_STENCIL_INDEX8, true, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireES<1, 0>, NeverSupported); // From GL_ANGLE_lossy_etc_decode // | Internal format |W |H |BS |CC| Format | Type | SRGB | Supported | Renderable | Filterable | @@ -855,13 +855,13 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() AddRGBAFormat(&map, GL_RED, false, 8, 0, 0, 0, 0, GL_RED, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported ); AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireExt<&Extensions::textureRG>, AlwaysSupported, AlwaysSupported); AddRGBAFormat(&map, GL_RG, false, 8, 8, 0, 0, 0, GL_RG, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported ); - AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, AlwaysSupported, AlwaysSupported); - AddRGBAFormat(&map, GL_RGB, false, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, AlwaysSupported, AlwaysSupported); + AddRGBAFormat(&map, GL_RGB, false, 5, 6, 5, 0, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported ); - AddRGBAFormat(&map, GL_RGBA, false, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddRGBAFormat(&map, GL_RGBA, false, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddRGBAFormat(&map, GL_RGBA, false, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGBA, false, 4, 4, 4, 4, 0, GL_RGBA, GL_UNSIGNED_SHORT_4_4_4_4, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGBA, false, 5, 5, 5, 1, 0, GL_RGBA, GL_UNSIGNED_SHORT_5_5_5_1, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddRGBAFormat(&map, GL_RGBA, false, 10, 10, 10, 2, 0, GL_RGBA, GL_UNSIGNED_INT_2_10_10_10_REV, GL_UNSIGNED_NORMALIZED, false, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); AddRGBAFormat(&map, GL_RGBA, false, 8, 8, 8, 8, 0, GL_RGBA, GL_BYTE, GL_SIGNED_NORMALIZED, false, NeverSupported, NeverSupported, NeverSupported ); AddRGBAFormat(&map, GL_SRGB, false, 8, 8, 8, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, NeverSupported, AlwaysSupported); AddRGBAFormat(&map, GL_SRGB_ALPHA_EXT, false, 8, 8, 8, 8, 0, GL_RGBA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, true, RequireExt<&Extensions::sRGB>, RequireExt<&Extensions::sRGB>, AlwaysSupported); @@ -915,9 +915,9 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() // Unsized luminance alpha formats // | Internal format |sized | L | A | Format | Type | Component type | Supported | Renderable | Filterable | - AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported ); - AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported ); - AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, NeverSupported, AlwaysSupported ); + AddLUMAFormat(&map, GL_ALPHA, false, 0, 8, GL_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported, AlwaysSupported ); + AddLUMAFormat(&map, GL_LUMINANCE, false, 8, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported, AlwaysSupported ); + AddLUMAFormat(&map, GL_LUMINANCE_ALPHA, false, 8, 8, GL_LUMINANCE_ALPHA, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, NeverSupported, AlwaysSupported ); AddLUMAFormat(&map, GL_ALPHA, false, 0, 16, GL_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>); AddLUMAFormat(&map, GL_LUMINANCE, false, 16, 0, GL_LUMINANCE, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>); AddLUMAFormat(&map, GL_LUMINANCE_ALPHA ,false, 16, 16, GL_LUMINANCE_ALPHA, GL_HALF_FLOAT_OES, GL_FLOAT, RequireExt<&Extensions::textureHalfFloat>, NeverSupported, RequireExt<&Extensions::textureHalfFloatLinear>); @@ -927,12 +927,12 @@ static InternalFormatInfoMap BuildInternalFormatInfoMap() // Unsized depth stencil formats // | Internal format |sized | D |S | X | Format | Type | Component type | Supported | Renderable | Filterable | - AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); - AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<2, 0>, RequireES<2, 0>, AlwaysSupported); + AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 16, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 24, 0, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); + AddDepthStencilFormat(&map, GL_DEPTH_COMPONENT, false, 32, 0, 0, GL_DEPTH_COMPONENT, GL_FLOAT, GL_FLOAT, RequireES<1, 0>, RequireES<1, 0>, AlwaysSupported); AddDepthStencilFormat(&map, GL_DEPTH_STENCIL, false, 24, 8, 0, GL_DEPTH_STENCIL, GL_UNSIGNED_INT_24_8, GL_UNSIGNED_NORMALIZED, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported); AddDepthStencilFormat(&map, GL_DEPTH_STENCIL, false, 32, 8, 24, GL_DEPTH_STENCIL, GL_FLOAT_32_UNSIGNED_INT_24_8_REV, GL_FLOAT, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, RequireESOrExt<3, 0, &Extensions::packedDepthStencil>, AlwaysSupported); - AddDepthStencilFormat(&map, GL_STENCIL, false, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<2, 0>, RequireES<2, 0>, NeverSupported); + AddDepthStencilFormat(&map, GL_STENCIL, false, 0, 8, 0, GL_STENCIL, GL_UNSIGNED_BYTE, GL_UNSIGNED_NORMALIZED, RequireES<1, 0>, RequireES<1, 0>, NeverSupported); // clang-format on return map; @@ -1069,9 +1069,17 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type) return typeIter->second; } -ErrorOrResult InternalFormat::computeRowPitch(GLsizei width, - GLint alignment, - GLint rowLength) const +GLuint InternalFormat::computePixelBytes(GLenum formatType) const +{ + const auto &typeInfo = GetTypeInfo(formatType); + GLuint components = typeInfo.specialInterpretation ? 1u : componentCount; + return components * typeInfo.bytes; +} + +ErrorOrResult InternalFormat::computeRowPitch(GLenum formatType, + GLsizei width, + GLint alignment, + GLint rowLength) const { // Compressed images do not use pack/unpack parameters. if (compressed) @@ -1081,7 +1089,7 @@ ErrorOrResult InternalFormat::computeRowPitch(GLsizei width, } CheckedNumeric checkedWidth(rowLength > 0 ? rowLength : width); - CheckedNumeric checkedRowBytes = checkedWidth * pixelBytes; + CheckedNumeric checkedRowBytes = checkedWidth * computePixelBytes(formatType); ASSERT(alignment > 0 && isPow2(alignment)); CheckedNumeric checkedAlignment(alignment); @@ -1092,7 +1100,7 @@ ErrorOrResult InternalFormat::computeRowPitch(GLsizei width, ErrorOrResult InternalFormat::computeDepthPitch(GLsizei height, GLint imageHeight, - GLuint rowPitch) + GLuint rowPitch) const { GLuint rows = (imageHeight > 0 ? static_cast(imageHeight) : static_cast(height)); @@ -1103,14 +1111,15 @@ ErrorOrResult InternalFormat::computeDepthPitch(GLsizei height, return depthPitch.ValueOrDie(); } -ErrorOrResult InternalFormat::computeDepthPitch(GLsizei width, - GLsizei height, - GLint alignment, - GLint rowLength, - GLint imageHeight) const +ErrorOrResult InternalFormat::computeDepthPitch(GLenum formatType, + GLsizei width, + GLsizei height, + GLint alignment, + GLint rowLength, + GLint imageHeight) const { GLuint rowPitch = 0; - ANGLE_TRY_RESULT(computeRowPitch(width, alignment, rowLength), rowPitch); + ANGLE_TRY_RESULT(computeRowPitch(formatType, width, alignment, rowLength), rowPitch); return computeDepthPitch(height, imageHeight, rowPitch); } @@ -1130,7 +1139,8 @@ ErrorOrResult InternalFormat::computeCompressedImageSize(const Extents & return bytes.ValueOrDie(); } -ErrorOrResult InternalFormat::computeSkipBytes(GLuint rowPitch, +ErrorOrResult InternalFormat::computeSkipBytes(GLenum formatType, + GLuint rowPitch, GLuint depthPitch, const PixelStoreStateBase &state, bool is3D) const @@ -1140,7 +1150,7 @@ ErrorOrResult InternalFormat::computeSkipBytes(GLuint rowPitch, CheckedNumeric checkedSkipImages(static_cast(state.skipImages)); CheckedNumeric checkedSkipRows(static_cast(state.skipRows)); CheckedNumeric checkedSkipPixels(static_cast(state.skipPixels)); - CheckedNumeric checkedPixelBytes(pixelBytes); + CheckedNumeric checkedPixelBytes(computePixelBytes(formatType)); auto checkedSkipImagesBytes = checkedSkipImages * checkedDepthPitch; if (!is3D) { @@ -1153,12 +1163,13 @@ ErrorOrResult InternalFormat::computeSkipBytes(GLuint rowPitch, } ErrorOrResult InternalFormat::computePackUnpackEndByte( + GLenum formatType, const Extents &size, const PixelStoreStateBase &state, bool is3D) const { GLuint rowPitch = 0; - ANGLE_TRY_RESULT(computeRowPitch(size.width, state.alignment, state.rowLength), + ANGLE_TRY_RESULT(computeRowPitch(formatType, size.width, state.alignment, state.rowLength), rowPitch); GLuint depthPitch = 0; @@ -1174,7 +1185,7 @@ ErrorOrResult InternalFormat::computePackUnpackEndByte( } else if (size.height != 0 && (!is3D || size.depth != 0)) { - CheckedNumeric bytes = pixelBytes; + CheckedNumeric bytes = computePixelBytes(formatType); checkedCopyBytes += size.width * bytes; CheckedNumeric heightMinusOne = size.height - 1; @@ -1188,7 +1199,8 @@ ErrorOrResult InternalFormat::computePackUnpackEndByte( } CheckedNumeric checkedSkipBytes = 0; - ANGLE_TRY_RESULT(computeSkipBytes(rowPitch, depthPitch, state, is3D), checkedSkipBytes); + ANGLE_TRY_RESULT(computeSkipBytes(formatType, rowPitch, depthPitch, state, is3D), + checkedSkipBytes); CheckedNumeric endByte = checkedCopyBytes + checkedSkipBytes; diff --git a/gfx/angle/checkout/src/libANGLE/formatutils.h b/gfx/angle/checkout/src/libANGLE/formatutils.h index 2f1d6bee7148..ebab7a9643fc 100644 --- a/gfx/angle/checkout/src/libANGLE/formatutils.h +++ b/gfx/angle/checkout/src/libANGLE/formatutils.h @@ -53,13 +53,17 @@ struct InternalFormat InternalFormat(); InternalFormat(const InternalFormat &other); - ErrorOrResult computeRowPitch(GLsizei width, + GLuint computePixelBytes(GLenum formatType) const; + + ErrorOrResult computeRowPitch(GLenum formatType, + GLsizei width, GLint alignment, GLint rowLength) const; - static ErrorOrResult computeDepthPitch(GLsizei height, - GLint imageHeight, - GLuint rowPitch); - ErrorOrResult computeDepthPitch(GLsizei width, + ErrorOrResult computeDepthPitch(GLsizei height, + GLint imageHeight, + GLuint rowPitch) const; + ErrorOrResult computeDepthPitch(GLenum formatType, + GLsizei width, GLsizei height, GLint alignment, GLint rowLength, @@ -67,14 +71,16 @@ struct InternalFormat ErrorOrResult computeCompressedImageSize(const Extents &size) const; - ErrorOrResult computeSkipBytes(GLuint rowPitch, + ErrorOrResult computeSkipBytes(GLenum formatType, + GLuint rowPitch, GLuint depthPitch, const PixelStoreStateBase &state, bool is3D) const; - ErrorOrResult computePackUnpackEndByte(const Extents &size, - const PixelStoreStateBase &state, - bool is3D) const; + ErrorOrResult computePackUnpackEndByte(GLenum formatType, + const Extents &size, + const PixelStoreStateBase &state, + bool is3D) const; bool isLUMA() const; GLenum getReadPixelsFormat() const; @@ -160,11 +166,6 @@ const InternalFormat &GetInternalFormatInfo(GLenum internalFormat, GLenum type); // format is valid. GLenum GetUnsizedFormat(GLenum internalFormat); -inline const InternalFormat &GetPackFormatInfo(GLenum internalFormat, GLenum type) -{ - return GetInternalFormatInfo(GetUnsizedFormat(internalFormat), type); -} - typedef std::set FormatSet; const FormatSet &GetAllSizedInternalFormats(); diff --git a/gfx/angle/checkout/src/libANGLE/params.cpp b/gfx/angle/checkout/src/libANGLE/params.cpp index a89d87e0a916..a77435c4a42e 100644 --- a/gfx/angle/checkout/src/libANGLE/params.cpp +++ b/gfx/angle/checkout/src/libANGLE/params.cpp @@ -18,26 +18,146 @@ namespace gl // static constexpr ParamTypeInfo ParamsBase::TypeInfo; -constexpr ParamTypeInfo HasIndexRange::TypeInfo; +constexpr ParamTypeInfo DrawCallParams::TypeInfo; -HasIndexRange::HasIndexRange() - : ParamsBase(nullptr), mContext(nullptr), mCount(0), mType(GL_NONE), mIndices(nullptr) +// DrawCallParams implementation. +// Called by DrawArrays. +DrawCallParams::DrawCallParams(GLenum mode, + GLint firstVertex, + GLsizei vertexCount, + GLsizei instances) + : mMode(mode), + mFirstVertex(firstVertex), + mVertexCount(vertexCount), + mIndexCount(0), + mBaseVertex(0), + mType(GL_NONE), + mIndices(nullptr), + mInstances(instances), + mIndirect(nullptr) { } -HasIndexRange::HasIndexRange(Context *context, GLsizei count, GLenum type, const void *indices) - : ParamsBase(context), mContext(context), mCount(count), mType(type), mIndices(indices) +// Called by DrawElements. +DrawCallParams::DrawCallParams(GLenum mode, + GLint indexCount, + GLenum type, + const void *indices, + GLint baseVertex, + GLsizei instances) + : mMode(mode), + mFirstVertex(0), + mVertexCount(0), + mIndexCount(indexCount), + mBaseVertex(baseVertex), + mType(type), + mIndices(indices), + mInstances(instances), + mIndirect(nullptr) { } -const Optional &HasIndexRange::getIndexRange() const +// Called by DrawArraysIndirect. +DrawCallParams::DrawCallParams(GLenum mode, const void *indirect) + : mMode(mode), + mFirstVertex(0), + mVertexCount(0), + mIndexCount(0), + mBaseVertex(0), + mType(GL_NONE), + mIndices(nullptr), + mInstances(0), + mIndirect(indirect) { - if (mIndexRange.valid() || !mContext) +} + +// Called by DrawElementsIndirect. +DrawCallParams::DrawCallParams(GLenum mode, GLenum type, const void *indirect) + : mMode(mode), + mFirstVertex(0), + mVertexCount(0), + mIndexCount(0), + mBaseVertex(0), + mType(type), + mIndices(nullptr), + mInstances(0), + mIndirect(indirect) +{ +} + +GLenum DrawCallParams::mode() const +{ + return mMode; +} + +GLint DrawCallParams::firstVertex() const +{ + // In some cases we can know the first vertex will be fixed at zero, if we're on the "fast + // path". In these cases the index range is not resolved. If the first vertex is not zero, + // however, then it must be because the index range is resolved. This only applies to the + // D3D11 back-end currently. + ASSERT(mFirstVertex == 0 || (!isDrawElements() || mIndexRange.valid())); + return mFirstVertex; +} + +size_t DrawCallParams::vertexCount() const +{ + ASSERT(!isDrawElements() || mIndexRange.valid()); + return mVertexCount; +} + +GLsizei DrawCallParams::indexCount() const +{ + ASSERT(isDrawElements()); + return mIndexCount; +} + +GLint DrawCallParams::baseVertex() const +{ + return mBaseVertex; +} + +GLenum DrawCallParams::type() const +{ + ASSERT(isDrawElements()); + return mType; +} + +const void *DrawCallParams::indices() const +{ + return mIndices; +} + +GLsizei DrawCallParams::instances() const +{ + return mInstances; +} + +const void *DrawCallParams::indirect() const +{ + return mIndirect; +} + +bool DrawCallParams::isDrawElements() const +{ + return (mType != GL_NONE); +} + +bool DrawCallParams::isDrawIndirect() const +{ + // This is a bit of a hack - it's quite possible for a direct call to have a zero count, but we + // assume these calls are filtered out before they make it to this code. + return (mIndexCount == 0 && mVertexCount == 0); +} + +Error DrawCallParams::ensureIndexRangeResolved(const Context *context) const +{ + if (mIndexRange.valid() || !isDrawElements()) { - return mIndexRange; + return NoError(); } - const State &state = mContext->getGLState(); + const State &state = context->getGLState(); const gl::VertexArray *vao = state.getVertexArray(); gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); @@ -46,23 +166,28 @@ const Optional &HasIndexRange::getIndexRange() const { uintptr_t offset = reinterpret_cast(mIndices); IndexRange indexRange; - Error error = - elementArrayBuffer->getIndexRange(mContext, mType, static_cast(offset), mCount, - state.isPrimitiveRestartEnabled(), &indexRange); - if (error.isError()) - { - mContext->handleError(error); - return mIndexRange; - } - + ANGLE_TRY(elementArrayBuffer->getIndexRange(context, mType, static_cast(offset), + mIndexCount, state.isPrimitiveRestartEnabled(), + &indexRange)); mIndexRange = indexRange; } else { - mIndexRange = ComputeIndexRange(mType, mIndices, mCount, state.isPrimitiveRestartEnabled()); + mIndexRange = + ComputeIndexRange(mType, mIndices, mIndexCount, state.isPrimitiveRestartEnabled()); } - return mIndexRange; + const IndexRange &indexRange = mIndexRange.value(); + mFirstVertex = mBaseVertex + static_cast(indexRange.start); + mVertexCount = indexRange.vertexCount(); + + return NoError(); +} + +const IndexRange &DrawCallParams::getIndexRange() const +{ + ASSERT(isDrawElements() && mIndexRange.valid()); + return mIndexRange.value(); } } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/params.h b/gfx/angle/checkout/src/libANGLE/params.h index dad9c9c68d9e..3fa023e540d8 100644 --- a/gfx/angle/checkout/src/libANGLE/params.h +++ b/gfx/angle/checkout/src/libANGLE/params.h @@ -14,6 +14,7 @@ #include "common/Optional.h" #include "common/angleutils.h" #include "common/mathutil.h" +#include "libANGLE/Error.h" #include "libANGLE/entry_points_enum_autogen.h" namespace gl @@ -68,28 +69,78 @@ ANGLE_INLINE void ParamsBase::Factory(EntryPointParamType *objBuffer, ArgsT. new (objBuffer) EntryPointParamType(args...); } -class HasIndexRange : public ParamsBase +// Helper class that encompasses draw call parameters. It uses the HasIndexRange +// helper class to only pull index range info lazily to prevent unnecessary readback. +// It is also used when syncing state for the VertexArray implementation, since the +// vertex and index buffer updates depend on draw call parameters. +class DrawCallParams final : angle::NonCopyable { public: - // Dummy placeholder that can't generate an index range. - HasIndexRange(); - HasIndexRange(Context *context, GLsizei count, GLenum type, const void *indices); + // Called by DrawArrays. + DrawCallParams(GLenum mode, GLint firstVertex, GLsizei vertexCount, GLsizei instances); + + // Called by DrawElements. + DrawCallParams(GLenum mode, + GLint indexCount, + GLenum type, + const void *indices, + GLint baseVertex, + GLsizei instances); + + // Called by DrawArraysIndirect. + DrawCallParams(GLenum mode, const void *indirect); + + // Called by DrawElementsIndirect. + DrawCallParams(GLenum mode, GLenum type, const void *indirect); + + GLenum mode() const; + + // This value is the sum of 'baseVertex' and the first indexed vertex for DrawElements calls. + GLint firstVertex() const; + + size_t vertexCount() const; + GLsizei indexCount() const; + GLint baseVertex() const; + GLenum type() const; + const void *indices() const; + GLsizei instances() const; + const void *indirect() const; + + Error ensureIndexRangeResolved(const Context *context) const; + bool isDrawElements() const; + bool isDrawIndirect() const; + + // ensureIndexRangeResolved must be called first. + const IndexRange &getIndexRange() const; + + template + T getClampedVertexCount() const; template - static void Factory(HasIndexRange *objBuffer, ArgsT... args); + static void Factory(DrawCallParams *objBuffer, ArgsT... args); - const Optional &getIndexRange() const; - - ANGLE_PARAM_TYPE_INFO(HasIndexRange, ParamsBase); + ANGLE_PARAM_TYPE_INFO(DrawCallParams, ParamsBase); private: - Context *mContext; - GLsizei mCount; - GLenum mType; - const GLvoid *mIndices; + GLenum mMode; mutable Optional mIndexRange; + mutable GLint mFirstVertex; + mutable size_t mVertexCount; + GLint mIndexCount; + GLint mBaseVertex; + GLenum mType; + const void *mIndices; + GLsizei mInstances; + const void *mIndirect; }; +template +T DrawCallParams::getClampedVertexCount() const +{ + constexpr size_t kMax = static_cast(std::numeric_limits::max()); + return static_cast(mVertexCount > kMax ? kMax : mVertexCount); +} + // Entry point funcs essentially re-map different entry point parameter arrays into // the format the parameter type class expects. For example, for HasIndexRange, for the // various indexed draw calls, they drop parameters that aren't useful and re-arrange @@ -103,59 +154,118 @@ template<> struct EntryPointParam \ \ template<> inline void CLASS::Factory(__VA_ARGS__) -ANGLE_ENTRY_POINT_FUNC(DrawElements, - HasIndexRange, - HasIndexRange *objBuffer, +ANGLE_ENTRY_POINT_FUNC(DrawArrays, + DrawCallParams, + DrawCallParams *objBuffer, Context *context, - GLenum /*mode*/, + GLenum mode, + GLint first, + GLsizei count) +{ + return ParamsBase::Factory(objBuffer, mode, first, count, 0); +} + +ANGLE_ENTRY_POINT_FUNC(DrawArraysInstanced, + DrawCallParams, + DrawCallParams *objBuffer, + Context *context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei instanceCount) +{ + return ParamsBase::Factory(objBuffer, mode, first, count, + instanceCount); +} + +ANGLE_ENTRY_POINT_FUNC(DrawArraysInstancedANGLE, + DrawCallParams, + DrawCallParams *objBuffer, + Context *context, + GLenum mode, + GLint first, + GLsizei count, + GLsizei instanceCount) +{ + return ParamsBase::Factory(objBuffer, mode, first, count, + instanceCount); +} + +ANGLE_ENTRY_POINT_FUNC(DrawArraysIndirect, + DrawCallParams, + DrawCallParams *objBuffer, + Context *context, + GLenum mode, + const void *indirect) +{ + return ParamsBase::Factory(objBuffer, mode, indirect); +} + +ANGLE_ENTRY_POINT_FUNC(DrawElementsIndirect, + DrawCallParams, + DrawCallParams *objBuffer, + Context *context, + GLenum mode, + GLenum type, + const void *indirect) +{ + return ParamsBase::Factory(objBuffer, mode, type, indirect); +} + +ANGLE_ENTRY_POINT_FUNC(DrawElements, + DrawCallParams, + DrawCallParams *objBuffer, + Context *context, + GLenum mode, GLsizei count, GLenum type, const void *indices) { - return ParamsBase::Factory(objBuffer, context, count, type, indices); + return ParamsBase::Factory(objBuffer, mode, count, type, indices, 0, + 0); } ANGLE_ENTRY_POINT_FUNC(DrawElementsInstanced, - HasIndexRange, - HasIndexRange *objBuffer, + DrawCallParams, + DrawCallParams *objBuffer, Context *context, - GLenum /*mode*/, + GLenum mode, GLsizei count, GLenum type, const void *indices, - GLsizei /*instanceCount*/) + GLsizei instanceCount) { - return ParamsBase::Factory(objBuffer, context, count, type, - indices); + return ParamsBase::Factory(objBuffer, mode, count, type, + indices, 0, instanceCount); } ANGLE_ENTRY_POINT_FUNC(DrawElementsInstancedANGLE, - HasIndexRange, - HasIndexRange *objBuffer, + DrawCallParams, + DrawCallParams *objBuffer, Context *context, - GLenum /*mode*/, + GLenum mode, GLsizei count, GLenum type, const void *indices, - GLsizei /*instanceCount*/) + GLsizei instanceCount) { - return ParamsBase::Factory(objBuffer, context, count, - type, indices); + return ParamsBase::Factory(objBuffer, mode, count, type, + indices, 0, instanceCount); } ANGLE_ENTRY_POINT_FUNC(DrawRangeElements, - HasIndexRange, - HasIndexRange *objBuffer, + DrawCallParams, + DrawCallParams *objBuffer, Context *context, - GLenum /*mode*/, + GLenum mode, GLuint /*start*/, GLuint /*end*/, GLsizei count, GLenum type, const void *indices) { - return ParamsBase::Factory(objBuffer, context, count, type, - indices); + return ParamsBase::Factory(objBuffer, mode, count, type, indices, + 0, 0); } #undef ANGLE_ENTRY_POINT_FUNC diff --git a/gfx/angle/checkout/src/libANGLE/queryconversions.cpp b/gfx/angle/checkout/src/libANGLE/queryconversions.cpp index 78d219365ec8..fd5034e59695 100644 --- a/gfx/angle/checkout/src/libANGLE/queryconversions.cpp +++ b/gfx/angle/checkout/src/libANGLE/queryconversions.cpp @@ -10,8 +10,8 @@ #include -#include "libANGLE/Context.h" #include "common/utilities.h" +#include "libANGLE/Context.h" namespace gl { @@ -31,14 +31,22 @@ QueryT CastFromStateValueToInt(GLenum pname, NativeT value) if (nativeType == GL_FLOAT) { - // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from Table 4.5 - if (pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR) + // RGBA color values and DepthRangeF values are converted to integer using Equation 2.4 from + // Table 4.5 + switch (pname) { - return clampCast(ExpandFloatToInteger(static_cast(value))); - } - else - { - return clampCast(std::round(value)); + case GL_DEPTH_RANGE: + case GL_COLOR_CLEAR_VALUE: + case GL_DEPTH_CLEAR_VALUE: + case GL_BLEND_COLOR: + // GLES1 emulation: + // Also, several GLES1.x values need to be converted to integer with + // ExpandFloatToInteger rather than rounding. See GLES 1.1 spec 6.1.2 "Data + // Conversions". + case GL_ALPHA_TEST_REF: + return clampCast(ExpandFloatToInteger(static_cast(value))); + default: + return clampCast(std::round(value)); } } @@ -151,8 +159,11 @@ template GLuint CastQueryValueTo(GLenum pname, GLint value); template GLuint CastQueryValueTo(GLenum pname, GLfloat value); template -void CastStateValues(Context *context, GLenum nativeType, GLenum pname, - unsigned int numParams, QueryT *outParams) +void CastStateValues(Context *context, + GLenum nativeType, + GLenum pname, + unsigned int numParams, + QueryT *outParams) { if (nativeType == GL_INT) { @@ -171,7 +182,8 @@ void CastStateValues(Context *context, GLenum nativeType, GLenum pname, for (unsigned int i = 0; i < numParams; ++i) { - outParams[i] = (boolParams[i] == GL_FALSE ? static_cast(0) : static_cast(1)); + outParams[i] = + (boolParams[i] == GL_FALSE ? static_cast(0) : static_cast(1)); } } else if (nativeType == GL_FLOAT) @@ -194,7 +206,8 @@ void CastStateValues(Context *context, GLenum nativeType, GLenum pname, outParams[i] = CastFromStateValue(pname, int64Params[i]); } } - else UNREACHABLE(); + else + UNREACHABLE(); } // Explicit template instantiation (how we export template functions in different files) diff --git a/gfx/angle/checkout/src/libANGLE/queryutils.cpp b/gfx/angle/checkout/src/libANGLE/queryutils.cpp index 9370f4f6557f..04792c675c8b 100644 --- a/gfx/angle/checkout/src/libANGLE/queryutils.cpp +++ b/gfx/angle/checkout/src/libANGLE/queryutils.cpp @@ -33,7 +33,7 @@ namespace template void QueryTexLevelParameterBase(const Texture *texture, - GLenum target, + TextureTarget target, GLint level, GLenum pname, ParamType *params) @@ -727,13 +727,13 @@ void GetShaderVariableBufferResourceProperty(const ShaderVariableBuffer &buffer, } break; case GL_REFERENCED_BY_VERTEX_SHADER: - params[(*outputPosition)++] = static_cast(buffer.vertexStaticUse); + params[(*outputPosition)++] = static_cast(buffer.isActive(ShaderType::Vertex)); break; case GL_REFERENCED_BY_FRAGMENT_SHADER: - params[(*outputPosition)++] = static_cast(buffer.fragmentStaticUse); + params[(*outputPosition)++] = static_cast(buffer.isActive(ShaderType::Fragment)); break; case GL_REFERENCED_BY_COMPUTE_SHADER: - params[(*outputPosition)++] = static_cast(buffer.computeStaticUse); + params[(*outputPosition)++] = static_cast(buffer.isActive(ShaderType::Compute)); break; default: UNREACHABLE(); @@ -848,8 +848,19 @@ void QueryFramebufferAttachmentParameteriv(const Context *context, break; case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: - *params = attachmentObject->cubeMapFace(); - break; + { + TextureTarget face = attachmentObject->cubeMapFace(); + if (face != TextureTarget::InvalidEnum) + { + *params = ToGLenum(attachmentObject->cubeMapFace()); + } + else + { + // This happens when the attachment isn't a texture cube map face + *params = GL_NONE; + } + } + break; case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE: *params = attachmentObject->getRedSize(); @@ -1008,6 +1019,18 @@ void QueryProgramiv(const Context *context, const Program *program, GLenum pname case GL_ACTIVE_ATOMIC_COUNTER_BUFFERS: *params = program->getActiveAtomicCounterBufferCount(); break; + case GL_GEOMETRY_LINKED_INPUT_TYPE_EXT: + *params = program->getGeometryShaderInputPrimitiveType(); + break; + case GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT: + *params = program->getGeometryShaderOutputPrimitiveType(); + break; + case GL_GEOMETRY_LINKED_VERTICES_OUT_EXT: + *params = program->getGeometryShaderMaxVertices(); + break; + case GL_GEOMETRY_SHADER_INVOCATIONS_EXT: + *params = program->getGeometryShaderInvocations(); + break; default: UNREACHABLE(); break; @@ -1075,7 +1098,7 @@ void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint * switch (pname) { case GL_SHADER_TYPE: - *params = shader->getType(); + *params = static_cast(ToGLenum(shader->getType())); return; case GL_DELETE_STATUS: *params = shader->isFlaggedForDeletion(); @@ -1099,7 +1122,7 @@ void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint * } void QueryTexLevelParameterfv(const Texture *texture, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLfloat *params) @@ -1108,7 +1131,7 @@ void QueryTexLevelParameterfv(const Texture *texture, } void QueryTexLevelParameteriv(const Texture *texture, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLint *params) @@ -1402,13 +1425,13 @@ GLint GetUniformResourceProperty(const Program *program, GLuint index, const GLe return static_cast(uniform.blockInfo.isRowMajorMatrix); case GL_REFERENCED_BY_VERTEX_SHADER: - return uniform.vertexStaticUse; + return uniform.isActive(ShaderType::Vertex); case GL_REFERENCED_BY_FRAGMENT_SHADER: - return uniform.fragmentStaticUse; + return uniform.isActive(ShaderType::Fragment); case GL_REFERENCED_BY_COMPUTE_SHADER: - return uniform.computeStaticUse; + return uniform.isActive(ShaderType::Compute); case GL_ATOMIC_COUNTER_BUFFER_INDEX: return (uniform.isAtomicCounter() ? uniform.bufferIndex : -1); @@ -1445,13 +1468,13 @@ GLint GetBufferVariableResourceProperty(const Program *program, GLuint index, co return static_cast(bufferVariable.blockInfo.isRowMajorMatrix); case GL_REFERENCED_BY_VERTEX_SHADER: - return bufferVariable.vertexStaticUse; + return bufferVariable.isActive(ShaderType::Vertex); case GL_REFERENCED_BY_FRAGMENT_SHADER: - return bufferVariable.fragmentStaticUse; + return bufferVariable.isActive(ShaderType::Fragment); case GL_REFERENCED_BY_COMPUTE_SHADER: - return bufferVariable.computeStaticUse; + return bufferVariable.isActive(ShaderType::Compute); case GL_TOP_LEVEL_ARRAY_SIZE: return bufferVariable.topLevelArraySize; diff --git a/gfx/angle/checkout/src/libANGLE/queryutils.h b/gfx/angle/checkout/src/libANGLE/queryutils.h index 142f006ada67..90d0e32a7ac5 100644 --- a/gfx/angle/checkout/src/libANGLE/queryutils.h +++ b/gfx/angle/checkout/src/libANGLE/queryutils.h @@ -11,6 +11,7 @@ #include "angle_gl.h" #include "common/angleutils.h" +#include "libANGLE/PackedGLEnums.h" #include @@ -47,12 +48,12 @@ void QueryRenderbufferiv(const Context *context, GLint *params); void QueryShaderiv(const Context *context, Shader *shader, GLenum pname, GLint *params); void QueryTexLevelParameterfv(const Texture *texture, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLfloat *params); void QueryTexLevelParameteriv(const Texture *texture, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLint *params); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h index f76fcdc8d7ae..0ed8e2eacf93 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/BufferImpl.h @@ -12,6 +12,7 @@ #include "common/angleutils.h" #include "common/mathutil.h" #include "libANGLE/Error.h" +#include "libANGLE/Observer.h" #include "libANGLE/PackedGLEnums.h" #include @@ -24,7 +25,10 @@ class Context; namespace rx { -class BufferImpl : angle::NonCopyable +// We use two set of Subject messages. The CONTENTS_CHANGED message is signaled whenever data +// changes, to trigger re-translation or other events. Some buffers only need to be updated when the +// underlying driver object changes - this is notified via the STORAGE_CHANGED message. +class BufferImpl : public angle::Subject { public: BufferImpl(const gl::BufferState &state) : mState(state) {} diff --git a/gfx/angle/checkout/src/libANGLE/renderer/Format.h b/gfx/angle/checkout/src/libANGLE/renderer/Format.h index 66bdace3e94d..c62ef40098e0 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/Format.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/Format.h @@ -34,11 +34,15 @@ struct Format final : private angle::NonCopyable GLuint blueBits, GLuint alphaBits, GLuint depthBits, - GLuint stencilBits); + GLuint stencilBits, + GLuint pixelBytes, + bool isBlock); static const Format &Get(ID id); static ID InternalFormatToID(GLenum internalFormat); + constexpr bool hasDepthOrStencilBits() const; + ID id; // The closest matching GL internal format for the storage this format uses. Note that this @@ -65,6 +69,10 @@ struct Format final : private angle::NonCopyable GLuint alphaBits; GLuint depthBits; GLuint stencilBits; + + GLuint pixelBytes; + + bool isBlock; }; constexpr Format::Format(ID id, @@ -80,7 +88,9 @@ constexpr Format::Format(ID id, GLuint blueBits, GLuint alphaBits, GLuint depthBits, - GLuint stencilBits) + GLuint stencilBits, + GLuint pixelBytes, + bool isBlock) : id(id), glInternalFormat(glFormat), fboImplementationInternalFormat(fboFormat), @@ -94,10 +104,16 @@ constexpr Format::Format(ID id, blueBits(blueBits), alphaBits(alphaBits), depthBits(depthBits), - stencilBits(stencilBits) + stencilBits(stencilBits), + pixelBytes(pixelBytes), + isBlock(isBlock) { } +constexpr bool Format::hasDepthOrStencilBits() const +{ + return depthBits > 0 || stencilBits > 0; +} } // namespace angle #include "libANGLE/renderer/Format_ID_autogen.inl" diff --git a/gfx/angle/checkout/src/libANGLE/renderer/Format_ID_autogen.inl b/gfx/angle/checkout/src/libANGLE/renderer/Format_ID_autogen.inl index 1c8cff70113a..0f466e0bed6c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/Format_ID_autogen.inl +++ b/gfx/angle/checkout/src/libANGLE/renderer/Format_ID_autogen.inl @@ -14,6 +14,7 @@ enum class Format::ID { NONE, A16_FLOAT, + A1R5G5B5_UNORM, A32_FLOAT, A8_UNORM, ASTC_10x10_SRGB_BLOCK, @@ -146,6 +147,6 @@ enum class Format::ID S8_UINT }; -constexpr uint32_t kNumANGLEFormats = 132; +constexpr uint32_t kNumANGLEFormats = 133; } // namespace angle diff --git a/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp index 1eafcdfbec5d..af2d27389ef4 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/Format_table_autogen.cpp @@ -24,138 +24,139 @@ static constexpr rx::FastCopyFunctionMap NoCopyFunctions; constexpr Format g_formatInfoTable[] = { // clang-format off - { Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0 }, - { Format::ID::A16_FLOAT, GL_ALPHA16F_EXT, GL_ALPHA16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 16, 0, 0 }, - { Format::ID::A32_FLOAT, GL_ALPHA32F_EXT, GL_ALPHA32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 32, 0, 0 }, - { Format::ID::A8_UNORM, GL_ALPHA8_EXT, GL_ALPHA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0 }, - { Format::ID::ASTC_10x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_10x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x12_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_12x12_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_4x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_6x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::ASTC_8x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::B4G4R4A4_UNORM, GL_BGRA4_ANGLEX, GL_RGBA4, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0 }, - { Format::ID::B5G5R5A1_UNORM, GL_BGR5_A1_ANGLEX, GL_RGB5_A1, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0 }, - { Format::ID::B5G6R5_UNORM, GL_BGR565_ANGLEX, GL_RGB565, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 }, - { Format::ID::B8G8R8A8_TYPELESS, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::B8G8R8A8_TYPELESS_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::B8G8R8A8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, BGRACopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::B8G8R8A8_UNORM_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::B8G8R8X8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::BC1_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC1_RGB_UNORM_BLOCK, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC1_RGB_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC2_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC3_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 16, 0 }, - { Format::ID::D24_UNORM, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT24, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 0 }, - { Format::ID::D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 8 }, - { Format::ID::D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 0 }, - { Format::ID::D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 8 }, - { Format::ID::D32_UNORM, GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT32_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 32, 0 }, - { Format::ID::EAC_R11G11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 }, - { Format::ID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0 }, - { Format::ID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, - { Format::ID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0 }, - { Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::ETC1_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_OES, GL_ETC1_RGB8_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, - { Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0 }, - { Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::ETC2_R8G8B8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::ETC2_R8G8B8_UNORM_BLOCK, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::L16A16_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 16, 0, 0 }, - { Format::ID::L16_FLOAT, GL_LUMINANCE16F_EXT, GL_LUMINANCE16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 0, 0, 0 }, - { Format::ID::L32A32_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 32, 0, 0 }, - { Format::ID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 0, 0, 0 }, - { Format::ID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0 }, - { Format::ID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0 }, - { Format::ID::R10G10B10A2_UINT, GL_RGB10_A2UI, GL_RGB10_A2UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 10, 10, 10, 2, 0, 0 }, - { Format::ID::R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0 }, - { Format::ID::R11G11B10_FLOAT, GL_R11F_G11F_B10F, GL_R11F_G11F_B10F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 11, 11, 10, 0, 0, 0 }, - { Format::ID::R16G16B16A16_FLOAT, GL_RGBA16F, GL_RGBA16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_SINT, GL_RGBA16I, GL_RGBA16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_SNORM, GL_RGBA16_SNORM_EXT, GL_RGBA16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_UINT, GL_RGBA16UI, GL_RGBA16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16A16_UNORM, GL_RGBA16_EXT, GL_RGBA16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0 }, - { Format::ID::R16G16B16_FLOAT, GL_RGB16F, GL_RGB16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_SINT, GL_RGB16I, GL_RGB16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_SNORM, GL_RGB16_SNORM_EXT, GL_RGB16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_UINT, GL_RGB16UI, GL_RGB16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16B16_UNORM, GL_RGB16_EXT, GL_RGB16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0 }, - { Format::ID::R16G16_FLOAT, GL_RG16F, GL_RG16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_SINT, GL_RG16I, GL_RG16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_SNORM, GL_RG16_SNORM_EXT, GL_RG16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_UINT, GL_RG16UI, GL_RG16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16G16_UNORM, GL_RG16_EXT, GL_RG16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0 }, - { Format::ID::R16_FLOAT, GL_R16F, GL_R16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_SINT, GL_R16I, GL_R16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_SNORM, GL_R16_SNORM_EXT, GL_R16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_UINT, GL_R16UI, GL_R16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R16_UNORM, GL_R16_EXT, GL_R16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0 }, - { Format::ID::R32G32B32A32_FLOAT, GL_RGBA32F, GL_RGBA32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32A32_SINT, GL_RGBA32I, GL_RGBA32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0 }, - { Format::ID::R32G32B32_FLOAT, GL_RGB32F, GL_RGB32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32B32_SINT, GL_RGB32I, GL_RGB32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32B32_UINT, GL_RGB32UI, GL_RGB32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0 }, - { Format::ID::R32G32_FLOAT, GL_RG32F, GL_RG32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32G32_SINT, GL_RG32I, GL_RG32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32G32_UINT, GL_RG32UI, GL_RG32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0 }, - { Format::ID::R32_FLOAT, GL_R32F, GL_R32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R32_SINT, GL_R32I, GL_R32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R32_UINT, GL_R32UI, GL_R32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0 }, - { Format::ID::R4G4B4A4_UNORM, GL_RGBA4, GL_RGBA4, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0 }, - { Format::ID::R5G5B5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0 }, - { Format::ID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0 }, - { Format::ID::R8G8B8A8_SINT, GL_RGBA8I, GL_RGBA8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_SNORM, GL_RGBA8_SNORM, GL_RGBA8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_TYPELESS, GL_RGBA8, GL_RGBA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_TYPELESS_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0 }, - { Format::ID::R8G8B8_SINT, GL_RGB8I, GL_RGB8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_SNORM, GL_RGB8_SNORM, GL_RGB8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UINT, GL_RGB8UI, GL_RGB8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UNORM, GL_RGB8, GL_RGB8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8B8_UNORM_SRGB, GL_SRGB8, GL_SRGB8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0 }, - { Format::ID::R8G8_SINT, GL_RG8I, GL_RG8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_SNORM, GL_RG8_SNORM, GL_RG8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0 }, - { Format::ID::R8_SINT, GL_R8I, GL_R8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_SNORM, GL_R8_SNORM, GL_R8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_UINT, GL_R8UI, GL_R8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R8_UNORM, GL_R8, GL_R8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0 }, - { Format::ID::R9G9B9E5_SHAREDEXP, GL_RGB9_E5, GL_RGB9_E5, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 9, 9, 9, 0, 0, 0 }, - { Format::ID::S8_UINT, GL_STENCIL_INDEX8, GL_STENCIL_INDEX8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_INT, 0, 0, 0, 0, 0, 8 }, + { Format::ID::NONE, GL_NONE, GL_NONE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_NONE, 0, 0, 0, 0, 0, 0, 0, false }, + { Format::ID::A16_FLOAT, GL_ALPHA16F_EXT, GL_ALPHA16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 16, 0, 0, 2, false }, + { Format::ID::A1R5G5B5_UNORM, GL_A1RGB5_ANGLEX, GL_A1RGB5_ANGLEX, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 2, false }, + { Format::ID::A32_FLOAT, GL_ALPHA32F_EXT, GL_ALPHA32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 32, 0, 0, 4, false }, + { Format::ID::A8_UNORM, GL_ALPHA8_EXT, GL_ALPHA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0, 1, false }, + { Format::ID::ASTC_10x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_RGBA_ASTC_10x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_RGBA_ASTC_10x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_RGBA_ASTC_10x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_10x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_RGBA_ASTC_10x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_12x10_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_12x10_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_RGBA_ASTC_12x10_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_12x12_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_12x12_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_RGBA_ASTC_12x12_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_4x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_4x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_RGBA_ASTC_4x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_5x4_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_5x4_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_RGBA_ASTC_5x4_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_5x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_5x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_RGBA_ASTC_5x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_6x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_6x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_RGBA_ASTC_6x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_6x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_6x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_RGBA_ASTC_6x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x5_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x5_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_RGBA_ASTC_8x5_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x6_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x6_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_RGBA_ASTC_8x6_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::ASTC_8x8_UNORM_BLOCK, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_RGBA_ASTC_8x8_KHR, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::B4G4R4A4_UNORM, GL_BGRA4_ANGLEX, GL_RGBA4, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0, 2, false }, + { Format::ID::B5G5R5A1_UNORM, GL_BGR5_A1_ANGLEX, GL_RGB5_A1, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 2, false }, + { Format::ID::B5G6R5_UNORM, GL_BGR565_ANGLEX, GL_RGB565, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0, 2, false }, + { Format::ID::B8G8R8A8_TYPELESS, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::B8G8R8A8_TYPELESS_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::B8G8R8A8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, BGRACopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::B8G8R8A8_UNORM_SRGB, GL_BGRA8_SRGB_ANGLEX, GL_BGRA8_SRGB_ANGLEX, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::B8G8R8X8_UNORM, GL_BGRA8_EXT, GL_BGRA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::BC1_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, GL_COMPRESSED_RGBA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC1_RGB_UNORM_BLOCK, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, GL_COMPRESSED_RGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC1_RGB_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, GL_COMPRESSED_SRGB_S3TC_DXT1_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC2_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC3_RGBA_UNORM_BLOCK, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, true }, + { Format::ID::D16_UNORM, GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT16, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 16, 0, 2, false }, + { Format::ID::D24_UNORM, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT24, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 0, 3, false }, + { Format::ID::D24_UNORM_S8_UINT, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 24, 8, 4, false }, + { Format::ID::D32_FLOAT, GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT32F, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 0, 4, false }, + { Format::ID::D32_FLOAT_S8X24_UINT, GL_DEPTH32F_STENCIL8, GL_DEPTH32F_STENCIL8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_FLOAT, 0, 0, 0, 0, 32, 8, 5, false }, + { Format::ID::D32_UNORM, GL_DEPTH_COMPONENT32_OES, GL_DEPTH_COMPONENT32_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 32, 0, 4, false }, + { Format::ID::EAC_R11G11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_RG11_EAC, GL_COMPRESSED_SIGNED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0, 2, true }, + { Format::ID::EAC_R11G11_UNORM_BLOCK, GL_COMPRESSED_RG11_EAC, GL_COMPRESSED_RG11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 11, 0, 0, 0, 0, 2, true }, + { Format::ID::EAC_R11_SNORM_BLOCK, GL_COMPRESSED_SIGNED_R11_EAC, GL_COMPRESSED_SIGNED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_SIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0, 1, true }, + { Format::ID::EAC_R11_UNORM_BLOCK, GL_COMPRESSED_R11_EAC, GL_COMPRESSED_R11_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 11, 0, 0, 0, 0, 0, 1, true }, + { Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, GL_ETC1_RGB8_LOSSY_DECODE_ANGLE, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, true }, + { Format::ID::ETC1_R8G8B8_UNORM_BLOCK, GL_ETC1_RGB8_OES, GL_ETC1_RGB8_OES, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, true }, + { Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0, 3, true }, + { Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 1, 0, 0, 3, true }, + { Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, true }, + { Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK, GL_COMPRESSED_RGBA8_ETC2_EAC, GL_COMPRESSED_RGBA8_ETC2_EAC, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, true }, + { Format::ID::ETC2_R8G8B8_SRGB_BLOCK, GL_COMPRESSED_SRGB8_ETC2, GL_COMPRESSED_SRGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, true }, + { Format::ID::ETC2_R8G8B8_UNORM_BLOCK, GL_COMPRESSED_RGB8_ETC2, GL_COMPRESSED_RGB8_ETC2, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, true }, + { Format::ID::L16A16_FLOAT, GL_LUMINANCE_ALPHA16F_EXT, GL_LUMINANCE_ALPHA16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 16, 0, 0, 2, false }, + { Format::ID::L16_FLOAT, GL_LUMINANCE16F_EXT, GL_LUMINANCE16F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 0, 0, 0, 0, false }, + { Format::ID::L32A32_FLOAT, GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 32, 0, 0, 4, false }, + { Format::ID::L32_FLOAT, GL_LUMINANCE32F_EXT, GL_LUMINANCE32F_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 0, 0, 0, 0, 0, 0, 0, false }, + { Format::ID::L8A8_UNORM, GL_LUMINANCE8_ALPHA8_EXT, GL_LUMINANCE8_ALPHA8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 8, 0, 0, 1, false }, + { Format::ID::L8_UNORM, GL_LUMINANCE8_EXT, GL_LUMINANCE8_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 0, 0, 0, 0, 0, 0, 0, false }, + { Format::ID::R10G10B10A2_UINT, GL_RGB10_A2UI, GL_RGB10_A2UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 10, 10, 10, 2, 0, 0, 4, false }, + { Format::ID::R10G10B10A2_UNORM, GL_RGB10_A2, GL_RGB10_A2, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 10, 10, 10, 2, 0, 0, 4, false }, + { Format::ID::R11G11B10_FLOAT, GL_R11F_G11F_B10F, GL_R11F_G11F_B10F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 11, 11, 10, 0, 0, 0, 4, false }, + { Format::ID::R16G16B16A16_FLOAT, GL_RGBA16F, GL_RGBA16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 16, 16, 0, 0, 8, false }, + { Format::ID::R16G16B16A16_SINT, GL_RGBA16I, GL_RGBA16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 16, 16, 0, 0, 8, false }, + { Format::ID::R16G16B16A16_SNORM, GL_RGBA16_SNORM_EXT, GL_RGBA16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0, 8, false }, + { Format::ID::R16G16B16A16_UINT, GL_RGBA16UI, GL_RGBA16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 16, 16, 0, 0, 8, false }, + { Format::ID::R16G16B16A16_UNORM, GL_RGBA16_EXT, GL_RGBA16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 16, 0, 0, 8, false }, + { Format::ID::R16G16B16_FLOAT, GL_RGB16F, GL_RGB16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 16, 0, 0, 0, 6, false }, + { Format::ID::R16G16B16_SINT, GL_RGB16I, GL_RGB16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 16, 0, 0, 0, 6, false }, + { Format::ID::R16G16B16_SNORM, GL_RGB16_SNORM_EXT, GL_RGB16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0, 6, false }, + { Format::ID::R16G16B16_UINT, GL_RGB16UI, GL_RGB16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 16, 0, 0, 0, 6, false }, + { Format::ID::R16G16B16_UNORM, GL_RGB16_EXT, GL_RGB16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 16, 0, 0, 0, 6, false }, + { Format::ID::R16G16_FLOAT, GL_RG16F, GL_RG16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 16, 0, 0, 0, 0, 4, false }, + { Format::ID::R16G16_SINT, GL_RG16I, GL_RG16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 16, 0, 0, 0, 0, 4, false }, + { Format::ID::R16G16_SNORM, GL_RG16_SNORM_EXT, GL_RG16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0, 4, false }, + { Format::ID::R16G16_UINT, GL_RG16UI, GL_RG16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 16, 0, 0, 0, 0, 4, false }, + { Format::ID::R16G16_UNORM, GL_RG16_EXT, GL_RG16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 16, 0, 0, 0, 0, 4, false }, + { Format::ID::R16_FLOAT, GL_R16F, GL_R16F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 16, 0, 0, 0, 0, 0, 2, false }, + { Format::ID::R16_SINT, GL_R16I, GL_R16I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 16, 0, 0, 0, 0, 0, 2, false }, + { Format::ID::R16_SNORM, GL_R16_SNORM_EXT, GL_R16_SNORM_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0, 2, false }, + { Format::ID::R16_UINT, GL_R16UI, GL_R16UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 16, 0, 0, 0, 0, 0, 2, false }, + { Format::ID::R16_UNORM, GL_R16_EXT, GL_R16_EXT, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 16, 0, 0, 0, 0, 0, 2, false }, + { Format::ID::R32G32B32A32_FLOAT, GL_RGBA32F, GL_RGBA32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 32, 32, 0, 0, 16, false }, + { Format::ID::R32G32B32A32_SINT, GL_RGBA32I, GL_RGBA32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 32, 32, 0, 0, 16, false }, + { Format::ID::R32G32B32A32_UINT, GL_RGBA32UI, GL_RGBA32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 32, 32, 0, 0, 16, false }, + { Format::ID::R32G32B32_FLOAT, GL_RGB32F, GL_RGB32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 32, 0, 0, 0, 12, false }, + { Format::ID::R32G32B32_SINT, GL_RGB32I, GL_RGB32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 32, 0, 0, 0, 12, false }, + { Format::ID::R32G32B32_UINT, GL_RGB32UI, GL_RGB32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 32, 0, 0, 0, 12, false }, + { Format::ID::R32G32_FLOAT, GL_RG32F, GL_RG32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 32, 0, 0, 0, 0, 8, false }, + { Format::ID::R32G32_SINT, GL_RG32I, GL_RG32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 32, 0, 0, 0, 0, 8, false }, + { Format::ID::R32G32_UINT, GL_RG32UI, GL_RG32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 32, 0, 0, 0, 0, 8, false }, + { Format::ID::R32_FLOAT, GL_R32F, GL_R32F, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 32, 0, 0, 0, 0, 0, 4, false }, + { Format::ID::R32_SINT, GL_R32I, GL_R32I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 32, 0, 0, 0, 0, 0, 4, false }, + { Format::ID::R32_UINT, GL_R32UI, GL_R32UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 32, 0, 0, 0, 0, 0, 4, false }, + { Format::ID::R4G4B4A4_UNORM, GL_RGBA4, GL_RGBA4, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 4, 4, 4, 4, 0, 0, 2, false }, + { Format::ID::R5G5B5A1_UNORM, GL_RGB5_A1, GL_RGB5_A1, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 5, 5, 1, 0, 0, 2, false }, + { Format::ID::R5G6B5_UNORM, GL_RGB565, GL_RGB565, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 5, 6, 5, 0, 0, 0, 2, false }, + { Format::ID::R8G8B8A8_SINT, GL_RGBA8I, GL_RGBA8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_SNORM, GL_RGBA8_SNORM, GL_RGBA8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_TYPELESS, GL_RGBA8, GL_RGBA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_TYPELESS_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_UINT, GL_RGBA8UI, GL_RGBA8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_UNORM, GL_RGBA8, GL_RGBA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8A8_UNORM_SRGB, GL_SRGB8_ALPHA8, GL_SRGB8_ALPHA8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 8, 0, 0, 4, false }, + { Format::ID::R8G8B8_SINT, GL_RGB8I, GL_RGB8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::R8G8B8_SNORM, GL_RGB8_SNORM, GL_RGB8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::R8G8B8_UINT, GL_RGB8UI, GL_RGB8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::R8G8B8_UNORM, GL_RGB8, GL_RGB8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::R8G8B8_UNORM_SRGB, GL_SRGB8, GL_SRGB8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 8, 0, 0, 0, 3, false }, + { Format::ID::R8G8_SINT, GL_RG8I, GL_RG8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 8, 0, 0, 0, 0, 2, false }, + { Format::ID::R8G8_SNORM, GL_RG8_SNORM, GL_RG8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 2, false }, + { Format::ID::R8G8_UINT, GL_RG8UI, GL_RG8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 8, 0, 0, 0, 0, 2, false }, + { Format::ID::R8G8_UNORM, GL_RG8, GL_RG8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 8, 0, 0, 0, 0, 2, false }, + { Format::ID::R8_SINT, GL_R8I, GL_R8I, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_INT, 8, 0, 0, 0, 0, 0, 1, false }, + { Format::ID::R8_SNORM, GL_R8_SNORM, GL_R8_SNORM, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_SIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0, 1, false }, + { Format::ID::R8_UINT, GL_R8UI, GL_R8UI, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_INT, 8, 0, 0, 0, 0, 0, 1, false }, + { Format::ID::R8_UNORM, GL_R8, GL_R8, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_UNSIGNED_NORMALIZED, 8, 0, 0, 0, 0, 0, 1, false }, + { Format::ID::R9G9B9E5_SHAREDEXP, GL_RGB9_E5, GL_RGB9_E5, GenerateMip, NoCopyFunctions, ReadColor, WriteColor, GL_FLOAT, 9, 9, 9, 0, 0, 0, 3, false }, + { Format::ID::S8_UINT, GL_STENCIL_INDEX8, GL_STENCIL_INDEX8, nullptr, NoCopyFunctions, nullptr, nullptr, GL_UNSIGNED_INT, 0, 0, 0, 0, 0, 8, 1, false }, // clang-format on }; @@ -164,274 +165,276 @@ Format::ID Format::InternalFormatToID(GLenum internalFormat) { switch (internalFormat) { - case GL_RGBA16_EXT: - return Format::ID::R16G16B16A16_UNORM; - case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE: - return Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK; - case GL_RG8I: - return Format::ID::R8G8_SINT; - case GL_R16F: - return Format::ID::R16_FLOAT; - case GL_RGBA8I: - return Format::ID::R8G8B8A8_SINT; - case GL_RG8UI: - return Format::ID::R8G8_UINT; - case GL_RGBA8_SNORM: - return Format::ID::R8G8B8A8_SNORM; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: - return Format::ID::ASTC_12x10_SRGB_BLOCK; - case GL_RG8_SNORM: - return Format::ID::R8G8_SNORM; - case GL_BGR565_ANGLEX: - return Format::ID::B5G6R5_UNORM; - case GL_DEPTH_COMPONENT24: - return Format::ID::D24_UNORM; - case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: - return Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: - return Format::ID::ASTC_10x10_UNORM_BLOCK; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: - return Format::ID::ASTC_8x6_SRGB_BLOCK; - case GL_RGB32UI: - return Format::ID::R32G32B32_UINT; - case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: - return Format::ID::ASTC_6x5_UNORM_BLOCK; + case GL_A1RGB5_ANGLEX: + return Format::ID::A1R5G5B5_UNORM; + case GL_ALPHA16F_EXT: + return Format::ID::A16_FLOAT; case GL_ALPHA32F_EXT: return Format::ID::A32_FLOAT; - case GL_R16UI: - return Format::ID::R16_UINT; + case GL_ALPHA8_EXT: + return Format::ID::A8_UNORM; + case GL_BGR565_ANGLEX: + return Format::ID::B5G6R5_UNORM; + case GL_BGR5_A1_ANGLEX: + return Format::ID::B5G5R5A1_UNORM; + case GL_BGRA4_ANGLEX: + return Format::ID::B4G4R4A4_UNORM; + case GL_BGRA8_EXT: + return Format::ID::B8G8R8A8_UNORM; + case GL_BGRA8_SRGB_ANGLEX: + return Format::ID::B8G8R8A8_UNORM_SRGB; + case GL_BGRA8_TYPELESS_ANGLEX: + return Format::ID::B8G8R8A8_TYPELESS; + case GL_BGRA8_TYPELESS_SRGB_ANGLEX: + return Format::ID::B8G8R8A8_TYPELESS_SRGB; + case GL_BGRX8_ANGLEX: + return Format::ID::B8G8R8X8_UNORM; + case GL_COMPRESSED_R11_EAC: + return Format::ID::EAC_R11_UNORM_BLOCK; + case GL_COMPRESSED_RG11_EAC: + return Format::ID::EAC_R11G11_UNORM_BLOCK; + case GL_COMPRESSED_RGB8_ETC2: + return Format::ID::ETC2_R8G8B8_UNORM_BLOCK; + case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: + return Format::ID::ETC2_R8G8B8A1_UNORM_BLOCK; + case GL_COMPRESSED_RGBA8_ETC2_EAC: + return Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_10x10_KHR: + return Format::ID::ASTC_10x10_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: + return Format::ID::ASTC_10x5_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: + return Format::ID::ASTC_10x6_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: + return Format::ID::ASTC_10x8_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: + return Format::ID::ASTC_12x10_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: + return Format::ID::ASTC_12x12_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: + return Format::ID::ASTC_4x4_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: + return Format::ID::ASTC_5x4_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: + return Format::ID::ASTC_5x5_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_6x5_KHR: + return Format::ID::ASTC_6x5_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: + return Format::ID::ASTC_6x6_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: + return Format::ID::ASTC_8x5_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: + return Format::ID::ASTC_8x6_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: + return Format::ID::ASTC_8x8_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: + return Format::ID::BC1_RGBA_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: + return Format::ID::BC2_RGBA_UNORM_BLOCK; + case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: + return Format::ID::BC3_RGBA_UNORM_BLOCK; + case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: + return Format::ID::BC1_RGB_UNORM_BLOCK; + case GL_COMPRESSED_SIGNED_R11_EAC: + return Format::ID::EAC_R11_SNORM_BLOCK; + case GL_COMPRESSED_SIGNED_RG11_EAC: + return Format::ID::EAC_R11G11_SNORM_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: + return Format::ID::ASTC_10x10_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: + return Format::ID::ASTC_10x5_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: + return Format::ID::ASTC_10x6_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: + return Format::ID::ASTC_10x8_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: + return Format::ID::ASTC_12x10_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: + return Format::ID::ASTC_12x12_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: + return Format::ID::ASTC_4x4_SRGB_BLOCK; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: return Format::ID::ASTC_5x4_SRGB_BLOCK; case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: return Format::ID::ASTC_5x5_SRGB_BLOCK; - case GL_COMPRESSED_R11_EAC: - return Format::ID::EAC_R11_UNORM_BLOCK; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: - return Format::ID::ASTC_10x10_SRGB_BLOCK; - case GL_RGBA32UI: - return Format::ID::R32G32B32A32_UINT; - case GL_R8_SNORM: - return Format::ID::R8_SNORM; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: - return Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK; - case GL_LUMINANCE32F_EXT: - return Format::ID::L32_FLOAT; - case GL_RG16_EXT: - return Format::ID::R16G16_UNORM; - case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: - return Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK; - case GL_SRGB8: - return Format::ID::R8G8B8_UNORM_SRGB; - case GL_LUMINANCE8_ALPHA8_EXT: - return Format::ID::L8A8_UNORM; - case GL_BGRX8_ANGLEX: - return Format::ID::B8G8R8X8_UNORM; - case GL_RGB16_SNORM_EXT: - return Format::ID::R16G16B16_SNORM; - case GL_BGRA8_TYPELESS_SRGB_ANGLEX: - return Format::ID::B8G8R8A8_TYPELESS_SRGB; - case GL_RGBA8UI: - return Format::ID::R8G8B8A8_UINT; - case GL_BGRA4_ANGLEX: - return Format::ID::B4G4R4A4_UNORM; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: + return Format::ID::ASTC_6x5_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: + return Format::ID::ASTC_6x6_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: + return Format::ID::ASTC_8x5_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: + return Format::ID::ASTC_8x6_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: + return Format::ID::ASTC_8x8_SRGB_BLOCK; case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return Format::ID::ETC2_R8G8B8A8_SRGB_BLOCK; - case GL_LUMINANCE8_EXT: - return Format::ID::L8_UNORM; - case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: - return Format::ID::BC3_RGBA_UNORM_BLOCK; - case GL_R16I: - return Format::ID::R16_SINT; - case GL_BGRA8_TYPELESS_ANGLEX: - return Format::ID::B8G8R8A8_TYPELESS; - case GL_RGB5_A1: - return Format::ID::R5G5B5A1_UNORM; - case GL_RGB16UI: - return Format::ID::R16G16B16_UINT; - case GL_COMPRESSED_RGBA_ASTC_4x4_KHR: - return Format::ID::ASTC_4x4_UNORM_BLOCK; + case GL_COMPRESSED_SRGB8_ETC2: + return Format::ID::ETC2_R8G8B8_SRGB_BLOCK; + case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: + return Format::ID::ETC2_R8G8B8A1_SRGB_BLOCK; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: + return Format::ID::BC1_RGBA_UNORM_SRGB_BLOCK; case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: return Format::ID::BC2_RGBA_UNORM_SRGB_BLOCK; - case GL_R16_SNORM_EXT: - return Format::ID::R16_SNORM; - case GL_COMPRESSED_RGB8_ETC2: - return Format::ID::ETC2_R8G8B8_UNORM_BLOCK; + case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: + return Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK; case GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: return Format::ID::BC1_RGB_UNORM_SRGB_BLOCK; + case GL_DEPTH24_STENCIL8: + return Format::ID::D24_UNORM_S8_UINT; + case GL_DEPTH32F_STENCIL8: + return Format::ID::D32_FLOAT_S8X24_UINT; + case GL_DEPTH_COMPONENT16: + return Format::ID::D16_UNORM; + case GL_DEPTH_COMPONENT24: + return Format::ID::D24_UNORM; + case GL_DEPTH_COMPONENT32F: + return Format::ID::D32_FLOAT; + case GL_DEPTH_COMPONENT32_OES: + return Format::ID::D32_UNORM; + case GL_ETC1_RGB8_LOSSY_DECODE_ANGLE: + return Format::ID::ETC1_LOSSY_DECODE_R8G8B8_UNORM_BLOCK; + case GL_ETC1_RGB8_OES: + return Format::ID::ETC1_R8G8B8_UNORM_BLOCK; + case GL_LUMINANCE16F_EXT: + return Format::ID::L16_FLOAT; + case GL_LUMINANCE32F_EXT: + return Format::ID::L32_FLOAT; + case GL_LUMINANCE8_ALPHA8_EXT: + return Format::ID::L8A8_UNORM; + case GL_LUMINANCE8_EXT: + return Format::ID::L8_UNORM; + case GL_LUMINANCE_ALPHA16F_EXT: + return Format::ID::L16A16_FLOAT; + case GL_LUMINANCE_ALPHA32F_EXT: + return Format::ID::L32A32_FLOAT; + case GL_NONE: + return Format::ID::NONE; + case GL_R11F_G11F_B10F: + return Format::ID::R11G11B10_FLOAT; + case GL_R16F: + return Format::ID::R16_FLOAT; + case GL_R16I: + return Format::ID::R16_SINT; + case GL_R16UI: + return Format::ID::R16_UINT; + case GL_R16_EXT: + return Format::ID::R16_UNORM; + case GL_R16_SNORM_EXT: + return Format::ID::R16_SNORM; + case GL_R32F: + return Format::ID::R32_FLOAT; + case GL_R32I: + return Format::ID::R32_SINT; + case GL_R32UI: + return Format::ID::R32_UINT; + case GL_R8: + return Format::ID::R8_UNORM; + case GL_R8I: + return Format::ID::R8_SINT; + case GL_R8UI: + return Format::ID::R8_UINT; + case GL_R8_SNORM: + return Format::ID::R8_SNORM; + case GL_RG16F: + return Format::ID::R16G16_FLOAT; + case GL_RG16I: + return Format::ID::R16G16_SINT; + case GL_RG16UI: + return Format::ID::R16G16_UINT; + case GL_RG16_EXT: + return Format::ID::R16G16_UNORM; + case GL_RG16_SNORM_EXT: + return Format::ID::R16G16_SNORM; + case GL_RG32F: + return Format::ID::R32G32_FLOAT; + case GL_RG32I: + return Format::ID::R32G32_SINT; + case GL_RG32UI: + return Format::ID::R32G32_UINT; + case GL_RG8: + return Format::ID::R8G8_UNORM; + case GL_RG8I: + return Format::ID::R8G8_SINT; + case GL_RG8UI: + return Format::ID::R8G8_UINT; + case GL_RG8_SNORM: + return Format::ID::R8G8_SNORM; + case GL_RGB: + return Format::ID::R8G8B8_UNORM; + case GL_RGB10_A2: + return Format::ID::R10G10B10A2_UNORM; + case GL_RGB10_A2UI: + return Format::ID::R10G10B10A2_UINT; + case GL_RGB16F: + return Format::ID::R16G16B16_FLOAT; + case GL_RGB16I: + return Format::ID::R16G16B16_SINT; + case GL_RGB16UI: + return Format::ID::R16G16B16_UINT; + case GL_RGB16_EXT: + return Format::ID::R16G16B16_UNORM; + case GL_RGB16_SNORM_EXT: + return Format::ID::R16G16B16_SNORM; + case GL_RGB32F: + return Format::ID::R32G32B32_FLOAT; + case GL_RGB32I: + return Format::ID::R32G32B32_SINT; + case GL_RGB32UI: + return Format::ID::R32G32B32_UINT; + case GL_RGB565: + return Format::ID::R5G6B5_UNORM; + case GL_RGB5_A1: + return Format::ID::R5G5B5A1_UNORM; + case GL_RGB8: + return Format::ID::R8G8B8_UNORM; + case GL_RGB8I: + return Format::ID::R8G8B8_SINT; + case GL_RGB8UI: + return Format::ID::R8G8B8_UINT; + case GL_RGB8_SNORM: + return Format::ID::R8G8B8_SNORM; + case GL_RGB9_E5: + return Format::ID::R9G9B9E5_SHAREDEXP; + case GL_RGBA: + return Format::ID::R8G8B8A8_UNORM; + case GL_RGBA16F: + return Format::ID::R16G16B16A16_FLOAT; + case GL_RGBA16I: + return Format::ID::R16G16B16A16_SINT; + case GL_RGBA16UI: + return Format::ID::R16G16B16A16_UINT; + case GL_RGBA16_EXT: + return Format::ID::R16G16B16A16_UNORM; + case GL_RGBA16_SNORM_EXT: + return Format::ID::R16G16B16A16_SNORM; case GL_RGBA32F: return Format::ID::R32G32B32A32_FLOAT; case GL_RGBA32I: return Format::ID::R32G32B32A32_SINT; - case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: - return Format::ID::BC3_RGBA_UNORM_SRGB_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_8x5_KHR: - return Format::ID::ASTC_8x5_UNORM_BLOCK; - case GL_RG8: - return Format::ID::R8G8_UNORM; - case GL_COMPRESSED_RGBA_ASTC_8x8_KHR: - return Format::ID::ASTC_8x8_UNORM_BLOCK; - case GL_RGB10_A2: - return Format::ID::R10G10B10A2_UNORM; - case GL_COMPRESSED_SIGNED_RG11_EAC: - return Format::ID::EAC_R11G11_SNORM_BLOCK; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: - return Format::ID::ASTC_6x6_SRGB_BLOCK; - case GL_DEPTH_COMPONENT16: - return Format::ID::D16_UNORM; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: - return Format::ID::ASTC_10x5_SRGB_BLOCK; - case GL_RGB32I: - return Format::ID::R32G32B32_SINT; - case GL_R8: - return Format::ID::R8_UNORM; - case GL_RGB32F: - return Format::ID::R32G32B32_FLOAT; - case GL_RGBA8_TYPELESS_SRGB_ANGLEX: - return Format::ID::R8G8B8A8_TYPELESS_SRGB; - case GL_R16_EXT: - return Format::ID::R16_UNORM; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: - return Format::ID::ASTC_8x8_SRGB_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_10x5_KHR: - return Format::ID::ASTC_10x5_UNORM_BLOCK; - case GL_R11F_G11F_B10F: - return Format::ID::R11G11B10_FLOAT; - case GL_RGB8: - return Format::ID::R8G8B8_UNORM; - case GL_COMPRESSED_RGBA_ASTC_5x5_KHR: - return Format::ID::ASTC_5x5_UNORM_BLOCK; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: - return Format::ID::ASTC_8x5_SRGB_BLOCK; - case GL_RGBA16I: - return Format::ID::R16G16B16A16_SINT; - case GL_R8I: - return Format::ID::R8_SINT; - case GL_RGB8_SNORM: - return Format::ID::R8G8B8_SNORM; - case GL_RG32F: - return Format::ID::R32G32_FLOAT; - case GL_DEPTH_COMPONENT32F: - return Format::ID::D32_FLOAT; - case GL_RG32I: - return Format::ID::R32G32_SINT; - case GL_ALPHA8_EXT: - return Format::ID::A8_UNORM; - case GL_RGB16_EXT: - return Format::ID::R16G16B16_UNORM; - case GL_BGRA8_EXT: - return Format::ID::B8G8R8A8_UNORM; - case GL_RG32UI: - return Format::ID::R32G32_UINT; - case GL_RGBA16UI: - return Format::ID::R16G16B16A16_UINT; - case GL_COMPRESSED_RGBA8_ETC2_EAC: - return Format::ID::ETC2_R8G8B8A8_UNORM_BLOCK; - case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: - return Format::ID::BC1_RGBA_UNORM_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_10x6_KHR: - return Format::ID::ASTC_10x6_UNORM_BLOCK; - case GL_COMPRESSED_SRGB8_ETC2: - return Format::ID::ETC2_R8G8B8_SRGB_BLOCK; - case GL_BGRA8_SRGB_ANGLEX: - return Format::ID::B8G8R8A8_UNORM_SRGB; - case GL_DEPTH32F_STENCIL8: - return Format::ID::D32_FLOAT_S8X24_UINT; - case GL_COMPRESSED_RGBA_ASTC_6x6_KHR: - return Format::ID::ASTC_6x6_UNORM_BLOCK; - case GL_R32UI: - return Format::ID::R32_UINT; - case GL_BGR5_A1_ANGLEX: - return Format::ID::B5G5R5A1_UNORM; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: - return Format::ID::ASTC_12x12_SRGB_BLOCK; - case GL_COMPRESSED_RG11_EAC: - return Format::ID::EAC_R11G11_UNORM_BLOCK; - case GL_SRGB8_ALPHA8: - return Format::ID::R8G8B8A8_UNORM_SRGB; - case GL_LUMINANCE_ALPHA16F_EXT: - return Format::ID::L16A16_FLOAT; - case GL_RGBA: - return Format::ID::R8G8B8A8_UNORM; - case GL_ETC1_RGB8_OES: - return Format::ID::ETC1_R8G8B8_UNORM_BLOCK; - case GL_DEPTH24_STENCIL8: - return Format::ID::D24_UNORM_S8_UINT; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: - return Format::ID::ASTC_4x4_SRGB_BLOCK; - case GL_RGB16I: - return Format::ID::R16G16B16_SINT; - case GL_R8UI: - return Format::ID::R8_UINT; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: - return Format::ID::ASTC_10x6_SRGB_BLOCK; - case GL_RGBA16F: - return Format::ID::R16G16B16A16_FLOAT; - case GL_COMPRESSED_SIGNED_R11_EAC: - return Format::ID::EAC_R11_SNORM_BLOCK; - case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: - return Format::ID::BC1_RGB_UNORM_BLOCK; - case GL_RGB8I: - return Format::ID::R8G8B8_SINT; - case GL_COMPRESSED_RGBA_ASTC_8x6_KHR: - return Format::ID::ASTC_8x6_UNORM_BLOCK; - case GL_STENCIL_INDEX8: - return Format::ID::S8_UINT; - case GL_LUMINANCE_ALPHA32F_EXT: - return Format::ID::L32A32_FLOAT; - case GL_ALPHA16F_EXT: - return Format::ID::A16_FLOAT; - case GL_RGB8UI: - return Format::ID::R8G8B8_UINT; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: - return Format::ID::ASTC_10x8_SRGB_BLOCK; - case GL_RGBA8_TYPELESS_ANGLEX: - return Format::ID::R8G8B8A8_TYPELESS; - case GL_COMPRESSED_RGBA_ASTC_12x10_KHR: - return Format::ID::ASTC_12x10_UNORM_BLOCK; - case GL_RGB9_E5: - return Format::ID::R9G9B9E5_SHAREDEXP; - case GL_RGBA16_SNORM_EXT: - return Format::ID::R16G16B16A16_SNORM; - case GL_R32I: - return Format::ID::R32_SINT; - case GL_DEPTH_COMPONENT32_OES: - return Format::ID::D32_UNORM; - case GL_R32F: - return Format::ID::R32_FLOAT; - case GL_NONE: - return Format::ID::NONE; - case GL_RG16F: - return Format::ID::R16G16_FLOAT; - case GL_RGB: - return Format::ID::R8G8B8_UNORM; - case GL_RGB565: - return Format::ID::R5G6B5_UNORM; - case GL_LUMINANCE16F_EXT: - return Format::ID::L16_FLOAT; - case GL_RG16UI: - return Format::ID::R16G16_UINT; - case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: - return Format::ID::BC2_RGBA_UNORM_BLOCK; - case GL_RG16I: - return Format::ID::R16G16_SINT; - case GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: - return Format::ID::ASTC_6x5_SRGB_BLOCK; - case GL_RG16_SNORM_EXT: - return Format::ID::R16G16_SNORM; - case GL_COMPRESSED_RGBA_ASTC_12x12_KHR: - return Format::ID::ASTC_12x12_UNORM_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_5x4_KHR: - return Format::ID::ASTC_5x4_UNORM_BLOCK; - case GL_COMPRESSED_RGBA_ASTC_10x8_KHR: - return Format::ID::ASTC_10x8_UNORM_BLOCK; + case GL_RGBA32UI: + return Format::ID::R32G32B32A32_UINT; case GL_RGBA4: return Format::ID::R4G4B4A4_UNORM; case GL_RGBA8: return Format::ID::R8G8B8A8_UNORM; - case GL_RGB16F: - return Format::ID::R16G16B16_FLOAT; - case GL_RGB10_A2UI: - return Format::ID::R10G10B10A2_UINT; + case GL_RGBA8I: + return Format::ID::R8G8B8A8_SINT; + case GL_RGBA8UI: + return Format::ID::R8G8B8A8_UINT; + case GL_RGBA8_SNORM: + return Format::ID::R8G8B8A8_SNORM; + case GL_RGBA8_TYPELESS_ANGLEX: + return Format::ID::R8G8B8A8_TYPELESS; + case GL_RGBA8_TYPELESS_SRGB_ANGLEX: + return Format::ID::R8G8B8A8_TYPELESS_SRGB; + case GL_SRGB8: + return Format::ID::R8G8B8_UNORM_SRGB; + case GL_SRGB8_ALPHA8: + return Format::ID::R8G8B8A8_UNORM_SRGB; + case GL_STENCIL_INDEX8: + return Format::ID::S8_UINT; default: return Format::ID::NONE; } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h index 056ddc833a7d..334e2f267b2e 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferAttachmentObjectImpl.h @@ -12,11 +12,12 @@ #define LIBANGLE_RENDERER_FRAMEBUFFER_ATTACHMENT_OBJECT_IMPL_H_ #include "libANGLE/FramebufferAttachment.h" +#include "libANGLE/Observer.h" namespace rx { -class FramebufferAttachmentObjectImpl : angle::NonCopyable +class FramebufferAttachmentObjectImpl : public angle::Subject { public: FramebufferAttachmentObjectImpl() {} diff --git a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h index ebb166ca8088..dbe9a85358ee 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/FramebufferImpl.h @@ -80,8 +80,8 @@ class FramebufferImpl : angle::NonCopyable virtual bool checkStatus(const gl::Context *context) const = 0; - virtual void syncState(const gl::Context *context, - const gl::Framebuffer::DirtyBits &dirtyBits) = 0; + virtual gl::Error syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) = 0; virtual gl::Error getSamplePosition(size_t index, GLfloat *xy) const = 0; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h index 2371b2759cdc..15803114da63 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/ProgramImpl.h @@ -35,7 +35,7 @@ class ProgramImpl : angle::NonCopyable public: ProgramImpl(const gl::ProgramState &state) : mState(state) {} virtual ~ProgramImpl() {} - virtual void destroy(const gl::Context *context) {} + virtual gl::Error destroy(const gl::Context *context) { return gl::NoError(); } virtual gl::LinkResult load(const gl::Context *context, gl::InfoLog &infoLog, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h b/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h new file mode 100644 index 000000000000..7c2aef2eebfe --- /dev/null +++ b/gfx/angle/checkout/src/libANGLE/renderer/RenderTargetCache.h @@ -0,0 +1,160 @@ +// +// Copyright 2018 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// RenderTargetCache: +// The RenderTargetCache pattern is used in the D3D9, D3D11 and Vulkan back-ends. It is a +// cache of the various back-end objects (RenderTargets) associated with each Framebuffer +// attachment, be they Textures, Renderbuffers, or Surfaces. The cache is updated in Framebuffer's +// syncState method. +// + +#ifndef LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_ +#define LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_ + +#include "libANGLE/Framebuffer.h" +#include "libANGLE/FramebufferAttachment.h" + +namespace rx +{ + +template +class RenderTargetCache final : angle::NonCopyable +{ + public: + RenderTargetCache(); + ~RenderTargetCache(); + + gl::Error update(const gl::Context *context, + const gl::FramebufferState &state, + const gl::Framebuffer::DirtyBits &dirtyBits); + + using RenderTargetArray = gl::AttachmentArray; + + const RenderTargetArray &getColors() const; + RenderTargetT *getDepthStencil() const; + + RenderTargetT *getColorRead(const gl::FramebufferState &state) const; + + private: + gl::Error updateCachedRenderTarget(const gl::Context *context, + const gl::FramebufferAttachment *attachment, + RenderTargetT **cachedRenderTarget); + + gl::Error updateColorRenderTarget(const gl::Context *context, + const gl::FramebufferState &state, + size_t colorIndex); + gl::Error updateDepthStencilRenderTarget(const gl::Context *context, + const gl::FramebufferState &state); + + gl::AttachmentArray mColorRenderTargets; + // We only support a single Depth/Stencil RenderTarget currently. + RenderTargetT *mDepthStencilRenderTarget; +}; + +template +RenderTargetCache::RenderTargetCache() + : mColorRenderTargets{{nullptr}}, mDepthStencilRenderTarget(nullptr) +{ +} + +template +RenderTargetCache::~RenderTargetCache() +{ +} + +template +gl::Error RenderTargetCache::update(const gl::Context *context, + const gl::FramebufferState &state, + const gl::Framebuffer::DirtyBits &dirtyBits) +{ + for (auto dirtyBit : dirtyBits) + { + switch (dirtyBit) + { + case gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT: + case gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT: + ANGLE_TRY(updateDepthStencilRenderTarget(context, state)); + break; + case gl::Framebuffer::DIRTY_BIT_DRAW_BUFFERS: + case gl::Framebuffer::DIRTY_BIT_READ_BUFFER: + case gl::Framebuffer::DIRTY_BIT_DEFAULT_WIDTH: + case gl::Framebuffer::DIRTY_BIT_DEFAULT_HEIGHT: + case gl::Framebuffer::DIRTY_BIT_DEFAULT_SAMPLES: + case gl::Framebuffer::DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS: + break; + default: + { + ASSERT(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 == 0 && + dirtyBit < gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX); + size_t colorIndex = + static_cast(dirtyBit - gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0); + ANGLE_TRY(updateColorRenderTarget(context, state, colorIndex)); + break; + } + } + } + + return gl::NoError(); +} + +template +const gl::AttachmentArray &RenderTargetCache::getColors() const +{ + return mColorRenderTargets; +} + +template +RenderTargetT *RenderTargetCache::getDepthStencil() const +{ + return mDepthStencilRenderTarget; +} + +template +gl::Error RenderTargetCache::updateColorRenderTarget( + const gl::Context *context, + const gl::FramebufferState &state, + size_t colorIndex) +{ + return updateCachedRenderTarget(context, state.getColorAttachment(colorIndex), + &mColorRenderTargets[colorIndex]); +} + +template +gl::Error RenderTargetCache::updateDepthStencilRenderTarget( + const gl::Context *context, + const gl::FramebufferState &state) +{ + return updateCachedRenderTarget(context, state.getDepthOrStencilAttachment(), + &mDepthStencilRenderTarget); +} + +template +gl::Error RenderTargetCache::updateCachedRenderTarget( + const gl::Context *context, + const gl::FramebufferAttachment *attachment, + RenderTargetT **cachedRenderTarget) +{ + RenderTargetT *newRenderTarget = nullptr; + if (attachment) + { + ASSERT(attachment->isAttached()); + ANGLE_TRY(attachment->getRenderTarget(context, &newRenderTarget)); + } + *cachedRenderTarget = newRenderTarget; + return gl::NoError(); +} + +template +RenderTargetT *RenderTargetCache::getColorRead( + const gl::FramebufferState &state) const +{ + ASSERT(mColorRenderTargets[state.getReadIndex()] && + state.getReadIndex() < mColorRenderTargets.size()); + return mColorRenderTargets[state.getReadIndex()]; +} + +} // namespace rx + +#endif // LIBANGLE_RENDERER_RENDER_TARGET_CACHE_H_ diff --git a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp index 830d30e6d197..df1ead5e20c4 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.cpp @@ -25,8 +25,7 @@ gl::Error TextureImpl::onDestroy(const gl::Context *context) } gl::Error TextureImpl::copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -40,8 +39,7 @@ gl::Error TextureImpl::copyTexture(const gl::Context *context, } gl::Error TextureImpl::copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h index 3b4f28f5f70c..655e9aa9199c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/TextureImpl.h @@ -49,17 +49,15 @@ class TextureImpl : public FramebufferAttachmentObjectImpl virtual gl::Error onDestroy(const gl::Context *context); virtual gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, - const uint8_t *pixels) = 0; + const uint8_t *pixels) = 0; virtual gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -67,16 +65,14 @@ class TextureImpl : public FramebufferAttachmentObjectImpl const uint8_t *pixels) = 0; virtual gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, - const uint8_t *pixels) = 0; + const uint8_t *pixels) = 0; virtual gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -84,21 +80,18 @@ class TextureImpl : public FramebufferAttachmentObjectImpl const uint8_t *pixels) = 0; virtual gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) = 0; + gl::Framebuffer *source) = 0; virtual gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) = 0; + gl::Framebuffer *source) = 0; virtual gl::Error copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -107,8 +100,7 @@ class TextureImpl : public FramebufferAttachmentObjectImpl bool unpackUnmultiplyAlpha, const gl::Texture *source); virtual gl::Error copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, @@ -120,24 +112,24 @@ class TextureImpl : public FramebufferAttachmentObjectImpl virtual gl::Error copyCompressedTexture(const gl::Context *context, const gl::Texture *source); virtual gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) = 0; virtual gl::Error setStorageMultisample(const gl::Context *context, - GLenum target, + gl::TextureType type, GLsizei samples, GLint internalformat, const gl::Extents &size, bool fixedSampleLocations) = 0; virtual gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) = 0; virtual gl::Error setImageExternal(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Stream *stream, const egl::Stream::GLTextureDescription &desc) = 0; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h b/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h index e48cc53d6c69..778dd69ecdbb 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/VertexArrayImpl.h @@ -21,8 +21,12 @@ class VertexArrayImpl : angle::NonCopyable { public: VertexArrayImpl(const gl::VertexArrayState &state) : mState(state) {} - virtual void syncState(const gl::Context *context, const gl::VertexArray::DirtyBits &dirtyBits) + virtual gl::Error syncState(const gl::Context *context, + const gl::VertexArray::DirtyBits &dirtyBits, + const gl::VertexArray::DirtyAttribBitsArray &attribBits, + const gl::VertexArray::DirtyBindingBitsArray &bindingBits) { + return gl::NoError(); } virtual void destroy(const gl::Context *context) {} @@ -32,6 +36,6 @@ class VertexArrayImpl : angle::NonCopyable const gl::VertexArrayState &mState; }; -} +} // namespace rx #endif // LIBANGLE_RENDERER_VERTEXARRAYIMPL_H_ diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp index 7769ab2b75ee..3df7e4fcf867 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.cpp @@ -160,10 +160,11 @@ void BufferD3D::invalidateStaticData(const gl::Context *context) } // Creates static buffers if sufficient used data has been left unmodified -void BufferD3D::promoteStaticUsage(const gl::Context *context, int dataSize) +void BufferD3D::promoteStaticUsage(const gl::Context *context, size_t dataSize) { if (mUsage == D3DBufferUsage::DYNAMIC) { + // Note: This is not a safe math operation. 'dataSize' can come from the app. mUnmodifiedDataUse += dataSize; if (mUnmodifiedDataUse > 3 * getSize()) diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h index 60153748e689..2f0ff48e06c8 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/BufferD3D.h @@ -55,7 +55,7 @@ class BufferD3D : public BufferImpl virtual void initializeStaticData(const gl::Context *context); virtual void invalidateStaticData(const gl::Context *context); - void promoteStaticUsage(const gl::Context *context, int dataSize); + void promoteStaticUsage(const gl::Context *context, size_t dataSize); gl::Error getIndexRange(const gl::Context *context, GLenum type, @@ -80,7 +80,7 @@ class BufferD3D : public BufferImpl StaticIndexBufferInterface *mStaticIndexBuffer; unsigned int mStaticBufferCacheTotalSize; unsigned int mStaticVertexBufferOutOfDate; - unsigned int mUnmodifiedDataUse; + size_t mUnmodifiedDataUse; D3DBufferUsage mUsage; }; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp index b4143a3f5f90..879fe7663193 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.cpp @@ -460,8 +460,8 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context, ASSERT(pixelHLSL->empty() && vertexHLSL->empty()); const auto &data = context->getContextState(); - gl::Shader *vertexShaderGL = programData.getAttachedVertexShader(); - gl::Shader *fragmentShaderGL = programData.getAttachedFragmentShader(); + gl::Shader *vertexShaderGL = programData.getAttachedShader(ShaderType::Vertex); + gl::Shader *fragmentShaderGL = programData.getAttachedShader(ShaderType::Fragment); const ShaderD3D *fragmentShader = GetImplAs(fragmentShaderGL); const int shaderModel = mRenderer->getMajorShaderModel(); @@ -491,7 +491,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context, // Add stub string to be replaced when shader is dynamically defined by its layout vertexStream << "\n" << std::string(VERTEX_ATTRIBUTE_STUB_STRING) << "\n"; - const auto &vertexBuiltins = builtinsD3D[gl::SHADER_VERTEX]; + const auto &vertexBuiltins = builtinsD3D[gl::ShaderType::Vertex]; // Write the HLSL input/output declarations vertexStream << "struct VS_OUTPUT\n"; @@ -657,7 +657,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context, << " return output;\n" << "}\n"; - const auto &pixelBuiltins = builtinsD3D[gl::SHADER_FRAGMENT]; + const auto &pixelBuiltins = builtinsD3D[gl::ShaderType::Fragment]; std::ostringstream pixelStream; pixelStream << fragmentShaderGL->getTranslatedSource(context); @@ -793,8 +793,8 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context, ASSERT(!varying.isBuiltIn() && !varying.isStruct()); // Don't reference VS-only transform feedback varyings in the PS. Note that we're relying on - // that the staticUse flag is set according to usage in the fragment shader. - if (packedVarying.vertexOnly || !varying.staticUse) + // that the active flag is set according to usage in the fragment shader. + if (packedVarying.vertexOnly || !varying.active) continue; pixelStream << " "; @@ -851,7 +851,7 @@ void DynamicHLSL::generateShaderLinkHLSL(const gl::Context *context, std::string DynamicHLSL::generateComputeShaderLinkHLSL(const gl::Context *context, const gl::ProgramState &programData) const { - gl::Shader *computeShaderGL = programData.getAttachedComputeShader(); + gl::Shader *computeShaderGL = programData.getAttachedShader(ShaderType::Compute); std::stringstream computeStream; std::string translatedSource = computeShaderGL->getTranslatedSource(context); computeStream << translatedSource; @@ -931,14 +931,14 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va std::ostringstream preambleStream; - const auto &vertexBuiltins = builtinsD3D[gl::SHADER_VERTEX]; + const auto &vertexBuiltins = builtinsD3D[gl::ShaderType::Vertex]; preambleStream << "struct GS_INPUT\n"; generateVaryingLinkHLSL(varyingPacking, vertexBuiltins, builtinsD3D.usesPointSize(), preambleStream); preambleStream << "\n" << "struct GS_OUTPUT\n"; - generateVaryingLinkHLSL(varyingPacking, builtinsD3D[gl::SHADER_GEOMETRY], + generateVaryingLinkHLSL(varyingPacking, builtinsD3D[gl::ShaderType::Geometry], builtinsD3D.usesPointSize(), preambleStream); preambleStream << "\n" @@ -956,8 +956,8 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va preambleStream << " output.gl_ViewID_OVR = input.gl_ViewID_OVR;\n"; if (selectViewInVS) { - ASSERT(builtinsD3D[gl::SHADER_GEOMETRY].glViewportIndex.enabled && - builtinsD3D[gl::SHADER_GEOMETRY].glLayer.enabled); + ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled && + builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled); // If the view is already selected in the VS, then we just pass the gl_ViewportIndex and // gl_Layer to the output. @@ -989,8 +989,8 @@ std::string DynamicHLSL::generateGeometryShaderPreamble(const VaryingPacking &va if (hasANGLEMultiviewEnabled && !selectViewInVS) { - ASSERT(builtinsD3D[gl::SHADER_GEOMETRY].glViewportIndex.enabled && - builtinsD3D[gl::SHADER_GEOMETRY].glLayer.enabled); + ASSERT(builtinsD3D[gl::ShaderType::Geometry].glViewportIndex.enabled && + builtinsD3D[gl::ShaderType::Geometry].glLayer.enabled); // According to the HLSL reference, using SV_RenderTargetArrayIndex is only valid if the // render target is an array resource. Because of this we do not write to gl_Layer if we are @@ -1286,7 +1286,7 @@ void DynamicHLSL::getPixelShaderOutputKey(const gl::ContextState &data, const std::string &elementString = (outputVariable.isArray() ? Str(outputLocation.arrayIndex) : ""); - ASSERT(outputVariable.staticUse); + ASSERT(outputVariable.active); PixelShaderOutputVariable outputKeyVariable; outputKeyVariable.type = outputVariable.type; @@ -1329,11 +1329,11 @@ void BuiltinVarying::enable(const std::string &semanticVal, unsigned int indexVa BuiltinVaryingsD3D::BuiltinVaryingsD3D(const ProgramD3DMetadata &metadata, const VaryingPacking &packing) { - updateBuiltins(gl::SHADER_VERTEX, metadata, packing); - updateBuiltins(gl::SHADER_FRAGMENT, metadata, packing); + updateBuiltins(gl::ShaderType::Vertex, metadata, packing); + updateBuiltins(gl::ShaderType::Fragment, metadata, packing); if (metadata.getRendererMajorShaderModel() >= 4) { - updateBuiltins(gl::SHADER_GEOMETRY, metadata, packing); + updateBuiltins(gl::ShaderType::Geometry, metadata, packing); } } @@ -1348,13 +1348,13 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType, unsigned int reservedSemanticIndex = packing.getMaxSemanticIndex(); - BuiltinInfo *builtins = &mBuiltinInfo[shaderType]; + BuiltinInfo *builtins = &mBuiltinInfo[static_cast(shaderType)]; if (metadata.getRendererMajorShaderModel() >= 4) { builtins->dxPosition.enableSystem("SV_Position"); } - else if (shaderType == gl::SHADER_FRAGMENT) + else if (shaderType == gl::ShaderType::Fragment) { builtins->dxPosition.enableSystem("VPOS"); } @@ -1373,8 +1373,8 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType, builtins->glFragCoord.enable(userSemantic, reservedSemanticIndex++); } - if (shaderType == gl::SHADER_VERTEX ? metadata.addsPointCoordToVertexShader() - : metadata.usesPointCoord()) + if (shaderType == gl::ShaderType::Vertex ? metadata.addsPointCoordToVertexShader() + : metadata.usesPointCoord()) { // SM3 reserves the TEXCOORD semantic for point sprite texcoords (gl_PointCoord) // In D3D11 we manually compute gl_PointCoord in the GS. @@ -1388,7 +1388,7 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType, } } - if (shaderType == gl::SHADER_VERTEX && metadata.hasANGLEMultiviewEnabled()) + if (shaderType == gl::ShaderType::Vertex && metadata.hasANGLEMultiviewEnabled()) { builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++); if (metadata.canSelectViewInVertexShader()) @@ -1398,12 +1398,12 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType, } } - if (shaderType == gl::SHADER_FRAGMENT && metadata.hasANGLEMultiviewEnabled()) + if (shaderType == gl::ShaderType::Fragment && metadata.hasANGLEMultiviewEnabled()) { builtins->glViewIDOVR.enable(userSemantic, reservedSemanticIndex++); } - if (shaderType == gl::SHADER_GEOMETRY && metadata.hasANGLEMultiviewEnabled()) + if (shaderType == gl::ShaderType::Geometry && metadata.hasANGLEMultiviewEnabled()) { // Although it is possible to retrieve gl_ViewID_OVR from the value of // SV_ViewportArrayIndex or SV_RenderTargetArrayIndex based on the multi-view state in the @@ -1418,7 +1418,7 @@ void BuiltinVaryingsD3D::updateBuiltins(gl::ShaderType shaderType, // Special case: do not include PSIZE semantic in HLSL 3 pixel shaders if (metadata.usesSystemValuePointSize() && - (shaderType != gl::SHADER_FRAGMENT || metadata.getRendererMajorShaderModel() >= 4)) + (shaderType != gl::ShaderType::Fragment || metadata.getRendererMajorShaderModel() >= 4)) { builtins->glPointSize.enableSystem("PSIZE"); } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h index fe8d9cb0a30f..fa47c05017d1 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/DynamicHLSL.h @@ -98,20 +98,26 @@ class BuiltinVaryingsD3D BuiltinVaryingsD3D(const ProgramD3DMetadata &metadata, const gl::VaryingPacking &packing); ~BuiltinVaryingsD3D(); - bool usesPointSize() const { return mBuiltinInfo[gl::SHADER_VERTEX].glPointSize.enabled; } + bool usesPointSize() const + { + return mBuiltinInfo[static_cast(gl::ShaderType::Vertex)].glPointSize.enabled; + } const BuiltinInfo &operator[](gl::ShaderType shaderType) const { - return mBuiltinInfo[shaderType]; + return mBuiltinInfo[static_cast(shaderType)]; + } + BuiltinInfo &operator[](gl::ShaderType shaderType) + { + return mBuiltinInfo[static_cast(shaderType)]; } - BuiltinInfo &operator[](gl::ShaderType shaderType) { return mBuiltinInfo[shaderType]; } private: void updateBuiltins(gl::ShaderType shaderType, const ProgramD3DMetadata &metadata, const gl::VaryingPacking &packing); - std::array mBuiltinInfo; + std::array(gl::ShaderType::EnumCount)> mBuiltinInfo; }; class DynamicHLSL : angle::NonCopyable diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp index fcc2456bd679..cf51b348a317 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/EGLImageD3D.cpp @@ -80,7 +80,10 @@ gl::Error EGLImageD3D::copyToLocalRendertarget(const gl::Context *context) ANGLE_TRY(getRenderTarget(context, &curRenderTarget)); // This only currently applies do D3D11, where it invalidates FBOs with this Image attached. - curRenderTarget->signalDirty(context); + for (egl::ImageSibling *target : mState.targets) + { + target->getSubject()->onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS); + } return mRenderer->createRenderTargetCopy(curRenderTarget, &mRenderTarget); } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp index fbfd2a216469..1aca71b32e53 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.cpp @@ -257,17 +257,17 @@ gl::Error FramebufferD3D::readPixels(const gl::Context *context, const gl::PixelPackState &packState = context->getGLState().getPackState(); - const gl::InternalFormat &packFormat = gl::GetPackFormatInfo(format, type); + const gl::InternalFormat &sizedFormatInfo = gl::GetInternalFormatInfo(format, type); GLuint outputPitch = 0; - ANGLE_TRY_RESULT(packFormat.computeRowPitch(origArea.width, packState.alignment, - packState.rowLength), + ANGLE_TRY_RESULT(sizedFormatInfo.computeRowPitch(type, origArea.width, packState.alignment, + packState.rowLength), outputPitch); GLuint outputSkipBytes = 0; - ANGLE_TRY_RESULT(packFormat.computeSkipBytes(outputPitch, 0, packState, false), + ANGLE_TRY_RESULT(sizedFormatInfo.computeSkipBytes(type, outputPitch, 0, packState, false), outputSkipBytes); outputSkipBytes += - (area.x - origArea.x) * packFormat.pixelBytes + (area.y - origArea.y) * outputPitch; + (area.x - origArea.x) * sizedFormatInfo.pixelBytes + (area.y - origArea.y) * outputPitch; return readPixelsImpl(context, area, format, type, outputPitch, packState, reinterpret_cast(pixels) + outputSkipBytes); @@ -319,12 +319,12 @@ bool FramebufferD3D::checkStatus(const gl::Context *context) const return true; } -void FramebufferD3D::syncState(const gl::Context *context, - const gl::Framebuffer::DirtyBits &dirtyBits) +gl::Error FramebufferD3D::syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) { if (!mColorAttachmentsForRender.valid()) { - return; + return gl::NoError(); } for (auto dirtyBit : dirtyBits) @@ -336,6 +336,8 @@ void FramebufferD3D::syncState(const gl::Context *context, mColorAttachmentsForRender.reset(); } } + + return gl::NoError(); } const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl::Context *context) @@ -400,7 +402,8 @@ const gl::AttachmentList &FramebufferD3D::getColorAttachmentsForRender(const gl: gl::Texture *dummyTex = nullptr; // TODO(Jamie): Handle error if dummy texture can't be created. - ANGLE_SWALLOW_ERR(mRenderer->getIncompleteTexture(context, GL_TEXTURE_2D, &dummyTex)); + ANGLE_SWALLOW_ERR( + mRenderer->getIncompleteTexture(context, gl::TextureType::_2D, &dummyTex)); if (dummyTex) { diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h index 58b0ee66ff50..9e54e552151e 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/FramebufferD3D.h @@ -97,8 +97,8 @@ class FramebufferD3D : public FramebufferImpl bool checkStatus(const gl::Context *context) const override; - void syncState(const gl::Context *context, - const gl::Framebuffer::DirtyBits &dirtyBits) override; + gl::Error syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) override; const gl::AttachmentList &getColorAttachmentsForRender(const gl::Context *context); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp index dbbcbbed2aad..68887eeadaae 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.cpp @@ -24,7 +24,7 @@ ImageD3D::ImageD3D() mDepth(0), mInternalFormat(GL_NONE), mRenderable(false), - mTarget(GL_NONE), + mType(gl::TextureType::InvalidEnum), mDirty(false) { } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h index 1b7235fbaaa3..aca10f1ac30d 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ImageD3D.h @@ -14,6 +14,7 @@ #include "common/debug.h" #include "libANGLE/Error.h" +#include "libANGLE/PackedGLEnums.h" namespace gl { @@ -43,14 +44,17 @@ class ImageD3D : angle::NonCopyable GLsizei getHeight() const { return mHeight; } GLsizei getDepth() const { return mDepth; } GLenum getInternalFormat() const { return mInternalFormat; } - GLenum getTarget() const { return mTarget; } + gl::TextureType getType() const { return mType; } bool isRenderableFormat() const { return mRenderable; } void markDirty() { mDirty = true; } void markClean() { mDirty = false; } virtual bool isDirty() const = 0; - virtual bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) = 0; + virtual bool redefine(gl::TextureType type, + GLenum internalformat, + const gl::Extents &size, + bool forceRelease) = 0; virtual gl::Error loadData(const gl::Context *context, const gl::Box &area, @@ -95,7 +99,7 @@ class ImageD3D : angle::NonCopyable GLsizei mDepth; GLenum mInternalFormat; bool mRenderable; - GLenum mTarget; + gl::TextureType mType; bool mDirty; }; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp index e974097b4508..6e3ead489831 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.cpp @@ -299,22 +299,33 @@ gl::Error IndexDataManager::getStreamingIndexBuffer(GLenum destinationIndexType, return gl::NoError(); } -GLenum GetIndexTranslationDestType(GLenum srcType, - const gl::HasIndexRange &lazyIndexRange, - bool usePrimitiveRestartWorkaround) +gl::Error GetIndexTranslationDestType(const gl::Context *context, + const gl::DrawCallParams &drawCallParams, + bool usePrimitiveRestartWorkaround, + GLenum *destTypeOut) { // Avoid D3D11's primitive restart index value // see http://msdn.microsoft.com/en-us/library/windows/desktop/bb205124(v=vs.85).aspx if (usePrimitiveRestartWorkaround) { - const gl::IndexRange &indexRange = lazyIndexRange.getIndexRange().value(); - if (indexRange.end == gl::GetPrimitiveRestartIndex(srcType)) + // Conservatively assume we need to translate the indices for draw indirect. + if (drawCallParams.isDrawIndirect()) { - return GL_UNSIGNED_INT; + *destTypeOut = GL_UNSIGNED_INT; + return gl::NoError(); + } + + ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); + const gl::IndexRange &indexRange = drawCallParams.getIndexRange(); + if (indexRange.end == gl::GetPrimitiveRestartIndex(drawCallParams.type())) + { + *destTypeOut = GL_UNSIGNED_INT; + return gl::NoError(); } } - return (srcType == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT; + *destTypeOut = (drawCallParams.type() == GL_UNSIGNED_INT) ? GL_UNSIGNED_INT : GL_UNSIGNED_SHORT; + return gl::NoError(); } } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h index 77f05df92dfa..b837531fbc2f 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/IndexDataManager.h @@ -94,9 +94,10 @@ class IndexDataManager : angle::NonCopyable std::unique_ptr mStreamingBufferInt; }; -GLenum GetIndexTranslationDestType(GLenum srcType, - const gl::HasIndexRange &lazyIndexRange, - bool usePrimitiveRestartWorkaround); +gl::Error GetIndexTranslationDestType(const gl::Context *context, + const gl::DrawCallParams &drawCallParams, + bool usePrimitiveRestartWorkaround, + GLenum *destTypeOut); bool IsOffsetAligned(GLenum elementType, unsigned int offset); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp index be1660f773a9..afa61deecdbc 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.cpp @@ -221,7 +221,7 @@ void UniformBlockInfo::getShaderBlockInfo(const gl::Context *context, gl::Shader { for (const sh::InterfaceBlock &interfaceBlock : shader->getUniformBlocks(context)) { - if (!interfaceBlock.staticUse && interfaceBlock.layout == sh::BLOCKLAYOUT_PACKED) + if (!interfaceBlock.active && interfaceBlock.layout == sh::BLOCKLAYOUT_PACKED) continue; if (mBlockSizes.count(interfaceBlock.name) > 0) @@ -234,7 +234,7 @@ void UniformBlockInfo::getShaderBlockInfo(const gl::Context *context, gl::Shader size_t UniformBlockInfo::getBlockInfo(const sh::InterfaceBlock &interfaceBlock) { - ASSERT(interfaceBlock.staticUse || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED); + ASSERT(interfaceBlock.active || interfaceBlock.layout != sh::BLOCKLAYOUT_PACKED); // define member uniforms sh::Std140BlockEncoder std140Encoder; @@ -594,7 +594,8 @@ ProgramD3D::PixelExecutable::~PixelExecutable() SafeDelete(mShaderExecutable); } -ProgramD3D::Sampler::Sampler() : active(false), logicalTextureUnit(0), textureType(GL_TEXTURE_2D) +ProgramD3D::Sampler::Sampler() + : active(false), logicalTextureUnit(0), textureType(gl::TextureType::_2D) { } @@ -621,10 +622,7 @@ ProgramD3D::ProgramD3D(const gl::ProgramState &state, RendererD3D *renderer) mDirtySamplerMapping(true), mUsedComputeImageRange(0), mUsedComputeReadonlyImageRange(0), - mSerial(issueSerial()), - mVertexUniformsDirty(true), - mFragmentUniformsDirty(true), - mComputeUniformsDirty(true) + mSerial(issueSerial()) { mDynamicHLSL = new DynamicHLSL(renderer); } @@ -671,21 +669,21 @@ GLint ProgramD3D::getSamplerMapping(gl::ShaderType type, switch (type) { - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: ASSERT(samplerIndex < caps.maxTextureImageUnits); if (samplerIndex < mSamplersPS.size() && mSamplersPS[samplerIndex].active) { logicalTextureUnit = mSamplersPS[samplerIndex].logicalTextureUnit; } break; - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: ASSERT(samplerIndex < caps.maxVertexTextureImageUnits); if (samplerIndex < mSamplersVS.size() && mSamplersVS[samplerIndex].active) { logicalTextureUnit = mSamplersVS[samplerIndex].logicalTextureUnit; } break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: ASSERT(samplerIndex < caps.maxComputeTextureImageUnits); if (samplerIndex < mSamplersCS.size() && mSamplersCS[samplerIndex].active) { @@ -707,38 +705,39 @@ GLint ProgramD3D::getSamplerMapping(gl::ShaderType type, // Returns the texture type for a given Direct3D 9 sampler type and // index (0-15 for the pixel shader and 0-3 for the vertex shader). -GLenum ProgramD3D::getSamplerTextureType(gl::ShaderType type, unsigned int samplerIndex) const +gl::TextureType ProgramD3D::getSamplerTextureType(gl::ShaderType type, + unsigned int samplerIndex) const { switch (type) { - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: ASSERT(samplerIndex < mSamplersPS.size()); ASSERT(mSamplersPS[samplerIndex].active); return mSamplersPS[samplerIndex].textureType; - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: ASSERT(samplerIndex < mSamplersVS.size()); ASSERT(mSamplersVS[samplerIndex].active); return mSamplersVS[samplerIndex].textureType; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: ASSERT(samplerIndex < mSamplersCS.size()); ASSERT(mSamplersCS[samplerIndex].active); return mSamplersCS[samplerIndex].textureType; default: UNREACHABLE(); + return gl::TextureType::InvalidEnum; } - return GL_TEXTURE_2D; } GLuint ProgramD3D::getUsedSamplerRange(gl::ShaderType type) const { switch (type) { - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: return mUsedPixelSamplerRange; - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: return mUsedVertexSamplerRange; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: return mUsedComputeSamplerRange; default: UNREACHABLE(); @@ -824,7 +823,7 @@ GLint ProgramD3D::getImageMapping(gl::ShaderType type, ASSERT(imageIndex < caps.maxImageUnits); switch (type) { - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: if (readonly && imageIndex < mReadonlyImagesCS.size() && mReadonlyImagesCS[imageIndex].active) { @@ -852,7 +851,7 @@ GLuint ProgramD3D::getUsedImageRange(gl::ShaderType type, bool readonly) const { switch (type) { - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: return readonly ? mUsedComputeReadonlyImageRange : mUsedComputeImageRange; // TODO(xinghua.cao@intel.com): add image range of vertex shader and pixel shader. default: @@ -898,7 +897,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, Sampler sampler; stream->readBool(&sampler.active); stream->readInt(&sampler.logicalTextureUnit); - stream->readInt(&sampler.textureType); + stream->readEnum(&sampler.textureType); mSamplersPS.push_back(sampler); } const unsigned int vsSamplerCount = stream->readInt(); @@ -907,7 +906,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, Sampler sampler; stream->readBool(&sampler.active); stream->readInt(&sampler.logicalTextureUnit); - stream->readInt(&sampler.textureType); + stream->readEnum(&sampler.textureType); mSamplersVS.push_back(sampler); } @@ -917,7 +916,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, Sampler sampler; stream->readBool(&sampler.active); stream->readInt(&sampler.logicalTextureUnit); - stream->readInt(&sampler.textureType); + stream->readEnum(&sampler.textureType); mSamplersCS.push_back(sampler); } @@ -1047,8 +1046,8 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, ShaderExecutableD3D *shaderExecutable = nullptr; ANGLE_TRY(mRenderer->loadExecutable(vertexShaderFunction, vertexShaderSize, - gl::SHADER_VERTEX, mStreamOutVaryings, separateAttribs, - &shaderExecutable)); + gl::ShaderType::Vertex, mStreamOutVaryings, + separateAttribs, &shaderExecutable)); if (!shaderExecutable) { @@ -1082,7 +1081,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, ShaderExecutableD3D *shaderExecutable = nullptr; ANGLE_TRY(mRenderer->loadExecutable(pixelShaderFunction, pixelShaderSize, - gl::SHADER_FRAGMENT, mStreamOutVaryings, + gl::ShaderType::Fragment, mStreamOutVaryings, separateAttribs, &shaderExecutable)); if (!shaderExecutable) @@ -1111,7 +1110,7 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, ShaderExecutableD3D *geometryExecutable = nullptr; ANGLE_TRY(mRenderer->loadExecutable(geometryShaderFunction, geometryShaderSize, - gl::SHADER_GEOMETRY, mStreamOutVaryings, + gl::ShaderType::Geometry, mStreamOutVaryings, separateAttribs, &geometryExecutable)); if (!geometryExecutable) @@ -1132,8 +1131,8 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, ShaderExecutableD3D *computeExecutable = nullptr; ANGLE_TRY(mRenderer->loadExecutable(computeShaderFunction, computeShaderSize, - gl::SHADER_COMPUTE, std::vector(), false, - &computeExecutable)); + gl::ShaderType::Compute, std::vector(), + false, &computeExecutable)); if (!computeExecutable) { @@ -1146,6 +1145,8 @@ gl::LinkResult ProgramD3D::load(const gl::Context *context, initializeUniformStorage(); + dirtyAllUniforms(); + return true; } @@ -1170,7 +1171,7 @@ void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream { stream->writeInt(mSamplersPS[i].active); stream->writeInt(mSamplersPS[i].logicalTextureUnit); - stream->writeInt(mSamplersPS[i].textureType); + stream->writeEnum(mSamplersPS[i].textureType); } stream->writeInt(mSamplersVS.size()); @@ -1178,7 +1179,7 @@ void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream { stream->writeInt(mSamplersVS[i].active); stream->writeInt(mSamplersVS[i].logicalTextureUnit); - stream->writeInt(mSamplersVS[i].textureType); + stream->writeEnum(mSamplersVS[i].textureType); } stream->writeInt(mSamplersCS.size()); @@ -1186,7 +1187,7 @@ void ProgramD3D::save(const gl::Context *context, gl::BinaryOutputStream *stream { stream->writeInt(mSamplersCS[i].active); stream->writeInt(mSamplersCS[i].logicalTextureUnit); - stream->writeInt(mSamplersCS[i].textureType); + stream->writeEnum(mSamplersCS[i].textureType); } stream->writeInt(mImagesCS.size()); @@ -1357,7 +1358,7 @@ gl::Error ProgramD3D::getPixelExecutableForCachedOutputLayout(ShaderExecutableD3 gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog; ANGLE_TRY(mRenderer->compileToExecutable( - *currentInfoLog, finalPixelHLSL, gl::SHADER_FRAGMENT, mStreamOutVaryings, + *currentInfoLog, finalPixelHLSL, gl::ShaderType::Fragment, mStreamOutVaryings, (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), mPixelWorkarounds, &pixelExecutable)); @@ -1398,7 +1399,7 @@ gl::Error ProgramD3D::getVertexExecutableForCachedInputLayout(ShaderExecutableD3 gl::InfoLog *currentInfoLog = infoLog ? infoLog : &tempInfoLog; ANGLE_TRY(mRenderer->compileToExecutable( - *currentInfoLog, finalVertexHLSL, gl::SHADER_VERTEX, mStreamOutVaryings, + *currentInfoLog, finalVertexHLSL, gl::ShaderType::Vertex, mStreamOutVaryings, (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), mVertexWorkarounds, &vertexExecutable)); @@ -1455,7 +1456,7 @@ gl::Error ProgramD3D::getGeometryExecutableForPrimitiveType(const gl::Context *c ShaderExecutableD3D *geometryExecutable = nullptr; gl::Error error = mRenderer->compileToExecutable( - *currentInfoLog, geometryHLSL, gl::SHADER_GEOMETRY, mStreamOutVaryings, + *currentInfoLog, geometryHLSL, gl::ShaderType::Geometry, mStreamOutVaryings, (mState.getTransformFeedbackBufferMode() == GL_SEPARATE_ATTRIBS), angle::CompilerWorkaroundsD3D(), &geometryExecutable); @@ -1522,7 +1523,8 @@ class ProgramD3D::GetVertexExecutableTask : public ProgramD3D::GetExecutableTask void ProgramD3D::updateCachedInputLayoutFromShader(const gl::Context *context) { - GetDefaultInputLayoutFromShader(context, mState.getAttachedVertexShader(), &mCachedInputLayout); + GetDefaultInputLayoutFromShader(context, mState.getAttachedShader(gl::ShaderType::Vertex), + &mCachedInputLayout); VertexExecutable::getSignature(mRenderer, mCachedInputLayout, &mCachedVertexSignature); updateCachedVertexExecutableIndex(); } @@ -1621,7 +1623,8 @@ gl::LinkResult ProgramD3D::compileProgramExecutables(const gl::Context *context, ShaderExecutableD3D *defaultPixelExecutable = pixelTask.getResult(); ShaderExecutableD3D *pointGS = geometryTask.getResult(); - const ShaderD3D *vertexShaderD3D = GetImplAs(mState.getAttachedVertexShader()); + const ShaderD3D *vertexShaderD3D = + GetImplAs(mState.getAttachedShader(gl::ShaderType::Vertex)); if (usesGeometryShader(GL_POINTS) && pointGS) { @@ -1641,7 +1644,7 @@ gl::LinkResult ProgramD3D::compileProgramExecutables(const gl::Context *context, if (defaultPixelExecutable) { const ShaderD3D *fragmentShaderD3D = - GetImplAs(mState.getAttachedFragmentShader()); + GetImplAs(mState.getAttachedShader(gl::ShaderType::Fragment)); fragmentShaderD3D->appendDebugInfo(defaultPixelExecutable->getDebugInfo()); } @@ -1658,7 +1661,7 @@ gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context, std::string computeShader = mDynamicHLSL->generateComputeShaderLinkHLSL(context, mState); ShaderExecutableD3D *computeExecutable = nullptr; - ANGLE_TRY(mRenderer->compileToExecutable(infoLog, computeShader, gl::SHADER_COMPUTE, + ANGLE_TRY(mRenderer->compileToExecutable(infoLog, computeShader, gl::ShaderType::Compute, std::vector(), false, angle::CompilerWorkaroundsD3D(), &computeExecutable)); @@ -1669,7 +1672,8 @@ gl::LinkResult ProgramD3D::compileComputeExecutable(const gl::Context *context, } else { - const ShaderD3D *computeShaderD3D = GetImplAs(mState.getAttachedComputeShader()); + const ShaderD3D *computeShaderD3D = + GetImplAs(mState.getAttachedShader(gl::ShaderType::Compute)); computeShaderD3D->appendDebugInfo(computeExecutable->getDebugInfo()); mComputeExecutable.reset(computeExecutable); } @@ -1685,13 +1689,14 @@ gl::LinkResult ProgramD3D::link(const gl::Context *context, reset(); - gl::Shader *computeShader = mState.getAttachedComputeShader(); + gl::Shader *computeShader = mState.getAttachedShader(gl::ShaderType::Compute); if (computeShader) { mSamplersCS.resize(data.getCaps().maxComputeTextureImageUnits); mImagesCS.resize(data.getCaps().maxImageUnits); mReadonlyImagesCS.resize(data.getCaps().maxImageUnits); + mShaderUniformsDirty.set(gl::ShaderType::Compute); defineUniformsAndAssignRegisters(context); gl::LinkResult result = compileComputeExecutable(context, infoLog); @@ -1708,8 +1713,8 @@ gl::LinkResult ProgramD3D::link(const gl::Context *context, } else { - gl::Shader *vertexShader = mState.getAttachedVertexShader(); - gl::Shader *fragmentShader = mState.getAttachedFragmentShader(); + gl::Shader *vertexShader = mState.getAttachedShader(gl::ShaderType::Vertex); + gl::Shader *fragmentShader = mState.getAttachedShader(gl::ShaderType::Fragment); const ShaderD3D *vertexShaderD3D = GetImplAs(vertexShader); const ShaderD3D *fragmentShaderD3D = GetImplAs(fragmentShader); @@ -1755,9 +1760,13 @@ gl::LinkResult ProgramD3D::link(const gl::Context *context, initAttribLocationsToD3DSemantic(context); + // TODO(jiawei.shao@intel.com): set geometry uniforms dirty if user-defined geometry shader + // exists. Tracking bug: http://anglebug.com/1941 + mShaderUniformsDirty.set(gl::ShaderType::Vertex); + mShaderUniformsDirty.set(gl::ShaderType::Fragment); defineUniformsAndAssignRegisters(context); - gatherTransformFeedbackVaryings(resources.varyingPacking, builtins[gl::SHADER_VERTEX]); + gatherTransformFeedbackVaryings(resources.varyingPacking, builtins[gl::ShaderType::Vertex]); gl::LinkResult result = compileProgramExecutables(context, infoLog); if (result.isError()) @@ -1793,10 +1802,12 @@ void ProgramD3D::initializeUniformBlocks() ASSERT(mD3DUniformBlocks.empty()); // Assign registers and update sizes. - const ShaderD3D *vertexShaderD3D = SafeGetImplAs(mState.getAttachedVertexShader()); + const ShaderD3D *vertexShaderD3D = + SafeGetImplAs(mState.getAttachedShader(gl::ShaderType::Vertex)); const ShaderD3D *fragmentShaderD3D = - SafeGetImplAs(mState.getAttachedFragmentShader()); - const ShaderD3D *computeShaderD3D = SafeGetImplAs(mState.getAttachedComputeShader()); + SafeGetImplAs(mState.getAttachedShader(gl::ShaderType::Fragment)); + const ShaderD3D *computeShaderD3D = + SafeGetImplAs(mState.getAttachedShader(gl::ShaderType::Compute)); for (const gl::InterfaceBlock &uniformBlock : mState.getUniformBlocks()) { @@ -1804,14 +1815,14 @@ void ProgramD3D::initializeUniformBlocks() D3DUniformBlock d3dUniformBlock; - if (uniformBlock.vertexStaticUse) + if (uniformBlock.isActive(gl::ShaderType::Vertex)) { ASSERT(vertexShaderD3D != nullptr); unsigned int baseRegister = vertexShaderD3D->getUniformBlockRegister(uniformBlock.name); d3dUniformBlock.vsRegisterIndex = baseRegister + uniformBlockElement; } - if (uniformBlock.fragmentStaticUse) + if (uniformBlock.isActive(gl::ShaderType::Fragment)) { ASSERT(fragmentShaderD3D != nullptr); unsigned int baseRegister = @@ -1819,7 +1830,7 @@ void ProgramD3D::initializeUniformBlocks() d3dUniformBlock.psRegisterIndex = baseRegister + uniformBlockElement; } - if (uniformBlock.computeStaticUse) + if (uniformBlock.isActive(gl::ShaderType::Compute)) { ASSERT(computeShaderD3D != nullptr); unsigned int baseRegister = @@ -1914,12 +1925,12 @@ void ProgramD3D::updateUniformBufferCache(const gl::Caps &caps, GLuint blockBinding = mState.getUniformBlockBinding(uniformBlockIndex); // Unnecessary to apply an unreferenced standard or shared UBO - if (!uniformBlock.vertexStaticUse() && !uniformBlock.fragmentStaticUse()) + if (!uniformBlock.vertexActive() && !uniformBlock.fragmentActive()) { continue; } - if (uniformBlock.vertexStaticUse()) + if (uniformBlock.vertexActive()) { unsigned int registerIndex = uniformBlock.vsRegisterIndex - reservedVertex; ASSERT(registerIndex < caps.maxVertexUniformBlocks); @@ -1933,7 +1944,7 @@ void ProgramD3D::updateUniformBufferCache(const gl::Caps &caps, mVertexUBOCache[registerIndex] = blockBinding; } - if (uniformBlock.fragmentStaticUse()) + if (uniformBlock.fragmentActive()) { unsigned int registerIndex = uniformBlock.psRegisterIndex - reservedFragment; ASSERT(registerIndex < caps.maxFragmentUniformBlocks); @@ -1961,16 +1972,12 @@ const std::vector &ProgramD3D::getFragmentUniformBufferCache() const void ProgramD3D::dirtyAllUniforms() { - mVertexUniformsDirty = true; - mFragmentUniformsDirty = true; - mComputeUniformsDirty = true; + mShaderUniformsDirty = mState.getLinkedShaderStages(); } void ProgramD3D::markUniformsClean() { - mVertexUniformsDirty = false; - mFragmentUniformsDirty = false; - mComputeUniformsDirty = false; + mShaderUniformsDirty.reset(); } void ProgramD3D::setUniform1fv(GLint location, GLsizei count, const GLfloat *v) @@ -2113,34 +2120,17 @@ void ProgramD3D::setUniformBlockBinding(GLuint uniformBlockIndex, GLuint /*unifo void ProgramD3D::defineUniformsAndAssignRegisters(const gl::Context *context) { D3DUniformMap uniformMap; - gl::Shader *computeShader = mState.getAttachedComputeShader(); - if (computeShader) + for (gl::ShaderType shaderType : gl::AllShaderTypes()) { - for (const sh::Uniform &computeUniform : computeShader->getUniforms(context)) + gl::Shader *shader = mState.getAttachedShader(shaderType); + if (shader) { - if (computeUniform.staticUse) + for (const sh::Uniform &uniform : shader->getUniforms(context)) { - defineUniformBase(computeShader, computeUniform, &uniformMap); - } - } - } - else - { - gl::Shader *vertexShader = mState.getAttachedVertexShader(); - for (const sh::Uniform &vertexUniform : vertexShader->getUniforms(context)) - { - if (vertexUniform.staticUse) - { - defineUniformBase(vertexShader, vertexUniform, &uniformMap); - } - } - - gl::Shader *fragmentShader = mState.getAttachedFragmentShader(); - for (const sh::Uniform &fragmentUniform : fragmentShader->getUniforms(context)) - { - if (fragmentUniform.staticUse) - { - defineUniformBase(fragmentShader, fragmentUniform, &uniformMap); + if (uniform.active) + { + defineUniformBase(shader, uniform, &uniformMap); + } } } } @@ -2228,7 +2218,7 @@ D3DUniform *ProgramD3D::getD3DUniformByName(const std::string &name) return nullptr; } -void ProgramD3D::defineStructUniformFields(GLenum shaderType, +void ProgramD3D::defineStructUniformFields(gl::ShaderType shaderType, const std::vector &fields, const std::string &namePrefix, const HLSLRegisterType regType, @@ -2260,7 +2250,7 @@ void ProgramD3D::defineStructUniformFields(GLenum shaderType, encoder->exitAggregateType(); } -void ProgramD3D::defineArrayOfStructsUniformFields(GLenum shaderType, +void ProgramD3D::defineArrayOfStructsUniformFields(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, unsigned int arrayNestingIndex, const std::string &prefix, @@ -2287,7 +2277,7 @@ void ProgramD3D::defineArrayOfStructsUniformFields(GLenum shaderType, } } -void ProgramD3D::defineArrayUniformElements(GLenum shaderType, +void ProgramD3D::defineArrayUniformElements(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, const std::string &fullName, const HLSLRegisterType regType, @@ -2309,7 +2299,7 @@ void ProgramD3D::defineArrayUniformElements(GLenum shaderType, encoder->exitAggregateType(); } -void ProgramD3D::defineUniform(GLenum shaderType, +void ProgramD3D::defineUniform(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, const std::string &fullName, const HLSLRegisterType regType, @@ -2366,18 +2356,20 @@ void ProgramD3D::defineUniform(GLenum shaderType, static_cast(sh::HLSLBlockEncoder::getBlockRegisterElement(blockInfo)); unsigned int reg = static_cast(sh::HLSLBlockEncoder::getBlockRegister(blockInfo)); - if (shaderType == GL_FRAGMENT_SHADER) + + switch (shaderType) { - d3dUniform->psRegisterIndex = reg; - } - else if (shaderType == GL_VERTEX_SHADER) - { - d3dUniform->vsRegisterIndex = reg; - } - else - { - ASSERT(shaderType == GL_COMPUTE_SHADER); - d3dUniform->csRegisterIndex = reg; + case gl::ShaderType::Fragment: + d3dUniform->psRegisterIndex = reg; + break; + case gl::ShaderType::Vertex: + d3dUniform->vsRegisterIndex = reg; + break; + case gl::ShaderType::Compute: + d3dUniform->csRegisterIndex = reg; + break; + default: + UNREACHABLE(); } // Arrays are treated as aggregate types @@ -2450,19 +2442,19 @@ void ProgramD3D::setUniformInternal(GLint location, GLsizei count, const T *v, G if (targetUniform->vsData) { setUniformImpl(locationInfo, count, v, targetUniform->vsData, uniformType); - mVertexUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Vertex); } if (targetUniform->psData) { setUniformImpl(locationInfo, count, v, targetUniform->psData, uniformType); - mFragmentUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Fragment); } if (targetUniform->csData) { setUniformImpl(locationInfo, count, v, targetUniform->csData, uniformType); - mComputeUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Compute); } } @@ -2519,7 +2511,7 @@ void ProgramD3D::setUniformMatrixfvInternal(GLint location, if (setUniformMatrixfvImpl(location, countIn, transpose, value, targetUniform->vsData, targetUniformType)) { - mVertexUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Vertex); } } @@ -2528,7 +2520,7 @@ void ProgramD3D::setUniformMatrixfvInternal(GLint location, if (setUniformMatrixfvImpl(location, countIn, transpose, value, targetUniform->psData, targetUniformType)) { - mFragmentUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Fragment); } } @@ -2537,7 +2529,7 @@ void ProgramD3D::setUniformMatrixfvInternal(GLint location, if (setUniformMatrixfvImpl(location, countIn, transpose, value, targetUniform->csData, targetUniformType)) { - mComputeUniformsDirty = true; + mShaderUniformsDirty.set(gl::ShaderType::Compute); } } } @@ -2565,10 +2557,11 @@ void ProgramD3D::assignSamplerRegisters(size_t uniformIndex) unsigned int registerOffset = mState.getUniforms()[uniformIndex].flattenedOffsetInParentArrays * d3dUniform->getArraySizeProduct(); - const gl::Shader *computeShader = mState.getAttachedComputeShader(); + const gl::Shader *computeShader = mState.getAttachedShader(gl::ShaderType::Compute); if (computeShader) { - const ShaderD3D *computeShaderD3D = GetImplAs(mState.getAttachedComputeShader()); + const ShaderD3D *computeShaderD3D = + GetImplAs(mState.getAttachedShader(gl::ShaderType::Compute)); ASSERT(computeShaderD3D->hasUniform(baseName)); d3dUniform->csRegisterIndex = computeShaderD3D->getUniformRegister(baseName) + registerOffset; @@ -2578,9 +2571,10 @@ void ProgramD3D::assignSamplerRegisters(size_t uniformIndex) } else { - const ShaderD3D *vertexShaderD3D = GetImplAs(mState.getAttachedVertexShader()); + const ShaderD3D *vertexShaderD3D = + GetImplAs(mState.getAttachedShader(gl::ShaderType::Vertex)); const ShaderD3D *fragmentShaderD3D = - GetImplAs(mState.getAttachedFragmentShader()); + GetImplAs(mState.getAttachedShader(gl::ShaderType::Fragment)); ASSERT(vertexShaderD3D->hasUniform(baseName) || fragmentShaderD3D->hasUniform(baseName)); if (vertexShaderD3D->hasUniform(baseName)) { @@ -2616,7 +2610,7 @@ void ProgramD3D::AssignSamplers(unsigned int startSamplerIndex, ASSERT(samplerIndex < outSamplers.size()); Sampler *sampler = &outSamplers[samplerIndex]; sampler->active = true; - sampler->textureType = typeInfo.textureType; + sampler->textureType = gl::FromGLenum(typeInfo.textureType); sampler->logicalTextureUnit = 0; *outUsedRange = std::max(samplerIndex + 1, *outUsedRange); samplerIndex++; @@ -2646,10 +2640,11 @@ void ProgramD3D::assignImageRegisters(size_t uniformIndex) unsigned int registerOffset = mState.getUniforms()[uniformIndex].flattenedOffsetInParentArrays * d3dUniform->getArraySizeProduct(); - const gl::Shader *computeShader = mState.getAttachedComputeShader(); + const gl::Shader *computeShader = mState.getAttachedShader(gl::ShaderType::Compute); if (computeShader) { - const ShaderD3D *computeShaderD3D = GetImplAs(mState.getAttachedComputeShader()); + const ShaderD3D *computeShaderD3D = + GetImplAs(mState.getAttachedShader(gl::ShaderType::Compute)); ASSERT(computeShaderD3D->hasUniform(baseName)); d3dUniform->csRegisterIndex = computeShaderD3D->getUniformRegister(baseName) + registerOffset; @@ -2762,7 +2757,7 @@ void ProgramD3D::reset() mGeometryShaderPreamble.clear(); - dirtyAllUniforms(); + markUniformsClean(); mCachedPixelExecutableIndex.reset(); mCachedVertexExecutableIndex.reset(); @@ -2780,7 +2775,7 @@ unsigned int ProgramD3D::issueSerial() void ProgramD3D::initAttribLocationsToD3DSemantic(const gl::Context *context) { - gl::Shader *vertexShader = mState.getAttachedVertexShader(); + gl::Shader *vertexShader = mState.getAttachedShader(gl::ShaderType::Vertex); ASSERT(vertexShader != nullptr); // Init semantic index @@ -2956,6 +2951,11 @@ bool ProgramD3D::hasPixelExecutableForCachedOutputLayout() return mCachedPixelExecutableIndex.valid(); } +bool ProgramD3D::anyShaderUniformsDirty() const +{ + return mShaderUniformsDirty.any(); +} + template void ProgramD3D::getUniformInternal(GLint location, DestT *dataOut) const { @@ -3021,20 +3021,13 @@ void ProgramD3D::linkResources(const gl::Context *context, const gl::ProgramLinkedResources &resources) { UniformBlockInfo uniformBlockInfo; - - if (mState.getAttachedVertexShader()) + for (gl::ShaderType shaderType : gl::AllShaderTypes()) { - uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedVertexShader()); - } - - if (mState.getAttachedFragmentShader()) - { - uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedFragmentShader()); - } - - if (mState.getAttachedComputeShader()) - { - uniformBlockInfo.getShaderBlockInfo(context, mState.getAttachedComputeShader()); + gl::Shader *shader = mState.getAttachedShader(shaderType); + if (shader) + { + uniformBlockInfo.getShaderBlockInfo(context, shader); + } } // Gather interface block info. diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h index f795fcdec8ae..4082a670b411 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ProgramD3D.h @@ -97,11 +97,11 @@ struct D3DUniformBlock { } - bool vertexStaticUse() const { return vsRegisterIndex != GL_INVALID_INDEX; } + bool vertexActive() const { return vsRegisterIndex != GL_INVALID_INDEX; } - bool fragmentStaticUse() const { return psRegisterIndex != GL_INVALID_INDEX; } + bool fragmentActive() const { return psRegisterIndex != GL_INVALID_INDEX; } - bool computeStaticUse() const { return csRegisterIndex != GL_INVALID_INDEX; } + bool computeActive() const { return csRegisterIndex != GL_INVALID_INDEX; } unsigned int vsRegisterIndex; unsigned int psRegisterIndex; @@ -173,7 +173,7 @@ class ProgramD3D : public ProgramImpl GLint getSamplerMapping(gl::ShaderType type, unsigned int samplerIndex, const gl::Caps &caps) const; - GLenum getSamplerTextureType(gl::ShaderType type, unsigned int samplerIndex) const; + gl::TextureType getSamplerTextureType(gl::ShaderType type, unsigned int samplerIndex) const; GLuint getUsedSamplerRange(gl::ShaderType type) const; enum SamplerMapping @@ -308,9 +308,11 @@ class ProgramD3D : public ProgramImpl bool hasGeometryExecutableForPrimitiveType(GLenum drawMode); bool hasPixelExecutableForCachedOutputLayout(); - bool areVertexUniformsDirty() const { return mVertexUniformsDirty; } - bool areFragmentUniformsDirty() const { return mFragmentUniformsDirty; } - bool areComputeUniformsDirty() const { return mComputeUniformsDirty; } + bool anyShaderUniformsDirty() const; + bool areShaderUniformsDirty(gl::ShaderType shaderType) const + { + return mShaderUniformsDirty[shaderType]; + } const std::vector &getD3DUniforms() const { return mD3DUniforms; } void markUniformsClean(); @@ -381,7 +383,7 @@ class ProgramD3D : public ProgramImpl bool active; GLint logicalTextureUnit; - GLenum textureType; + gl::TextureType textureType; }; struct Image @@ -397,26 +399,26 @@ class ProgramD3D : public ProgramImpl void defineUniformBase(const gl::Shader *shader, const sh::Uniform &uniform, D3DUniformMap *uniformMap); - void defineStructUniformFields(GLenum shaderType, + void defineStructUniformFields(gl::ShaderType shaderType, const std::vector &fields, const std::string &namePrefix, const HLSLRegisterType regType, sh::HLSLBlockEncoder *encoder, D3DUniformMap *uniformMap); - void defineArrayOfStructsUniformFields(GLenum shaderType, + void defineArrayOfStructsUniformFields(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, unsigned int arrayNestingIndex, const std::string &prefix, const HLSLRegisterType regType, sh::HLSLBlockEncoder *encoder, D3DUniformMap *uniformMap); - void defineArrayUniformElements(GLenum shaderType, + void defineArrayUniformElements(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, const std::string &fullName, const HLSLRegisterType regType, sh::HLSLBlockEncoder *encoder, D3DUniformMap *uniformMap); - void defineUniform(GLenum shaderType, + void defineUniform(gl::ShaderType shaderType, const sh::ShaderVariable &uniform, const std::string &fullName, const HLSLRegisterType regType, @@ -550,9 +552,7 @@ class ProgramD3D : public ProgramImpl std::map mImageBindingMap; std::vector mD3DUniformBlocks; - bool mVertexUniformsDirty; - bool mFragmentUniformsDirty; - bool mComputeUniformsDirty; + gl::ShaderBitSet mShaderUniformsDirty; static unsigned int issueSerial(); static unsigned int mCurrentSerial; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h index fde96133b034..58491ab30ed5 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderTargetD3D.h @@ -34,9 +34,6 @@ class RenderTargetD3D : public FramebufferAttachmentRenderTarget virtual unsigned int getSerial() const; static unsigned int issueSerials(unsigned int count); - // Only currently applies to D3D11. - virtual void signalDirty(const gl::Context *context) {} - private: const unsigned int mSerial; static unsigned int mCurrentSerial; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp index b91af12cf8ab..f4fe567b73f5 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RenderbufferD3D.cpp @@ -112,9 +112,9 @@ gl::Error RenderbufferD3D::getAttachmentRenderTarget(const gl::Context *context, void RenderbufferD3D::deleteRenderTarget(const gl::Context *context) { + onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS); if (mRenderTarget) { - mRenderTarget->signalDirty(context); SafeDelete(mRenderTarget); } } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp index 43b34c62f092..666ed6708b7c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.cpp @@ -83,7 +83,7 @@ bool RendererD3D::skipDraw(const gl::State &glState, GLenum drawMode) } gl::Error RendererD3D::getIncompleteTexture(const gl::Context *context, - GLenum type, + gl::TextureType type, gl::Texture **textureOut) { return mIncompleteTextures.getIncompleteTexture(context, type, this, textureOut); @@ -208,7 +208,7 @@ gl::Error RendererD3D::initRenderTarget(RenderTargetD3D *renderTarget) gl::Error RendererD3D::initializeMultisampleTextureToBlack(const gl::Context *context, gl::Texture *glTexture) { - ASSERT(glTexture->getTarget() == GL_TEXTURE_2D_MULTISAMPLE); + ASSERT(glTexture->getType() == gl::TextureType::_2DMultisample); TextureD3D *textureD3D = GetImplAs(glTexture); gl::ImageIndex index = gl::ImageIndex::Make2DMultisample(); RenderTargetD3D *renderTarget = nullptr; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h index c30e0046d0cc..9cf3a8ed6db7 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/RendererD3D.h @@ -92,7 +92,7 @@ class BufferFactoryD3D : angle::NonCopyable virtual gl::ErrorOrResult getVertexSpaceRequired( const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const = 0; }; @@ -158,8 +158,8 @@ class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitialize GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, - GLint level) = 0; + gl::TextureTarget target, + GLint level) = 0; virtual gl::Error copyImage3D(const gl::Context *context, const gl::Framebuffer *framebuffer, const gl::Rectangle &sourceRect, @@ -183,7 +183,7 @@ class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitialize GLenum destType, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -303,7 +303,7 @@ class RendererD3D : public BufferFactoryD3D, public MultisampleTextureInitialize angle::WorkerThreadPool *getWorkerThreadPool(); gl::Error getIncompleteTexture(const gl::Context *context, - GLenum type, + gl::TextureType type, gl::Texture **textureOut); Serial generateSerial(); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp index 3b2b58ce0fb4..350a355be319 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/ShaderD3D.cpp @@ -48,7 +48,7 @@ ShaderD3D::ShaderD3D(const gl::ShaderState &data, { mAdditionalOptions |= SH_EMULATE_ISNAN_FLOAT_FUNCTION; } - if (workarounds.skipVSConstantRegisterZero && mData.getShaderType() == GL_VERTEX_SHADER) + if (workarounds.skipVSConstantRegisterZero && mData.getShaderType() == gl::ShaderType::Vertex) { mAdditionalOptions |= SH_SKIP_D3D_CONSTANT_REGISTER_ZERO; } @@ -204,7 +204,7 @@ bool ShaderD3D::postTranslateCompile(gl::Compiler *compiler, std::string *infoLo for (const sh::InterfaceBlock &interfaceBlock : mData.getUniformBlocks()) { - if (interfaceBlock.staticUse) + if (interfaceBlock.active) { unsigned int index = static_cast(-1); bool blockRegisterResult = diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp index 69600e98ab71..a41cf53938af 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.cpp @@ -164,7 +164,7 @@ GLenum TextureD3D::getBaseLevelInternalFormat() const } gl::Error TextureD3D::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) @@ -174,7 +174,7 @@ gl::Error TextureD3D::setStorage(const gl::Context *context, } gl::Error TextureD3D::setStorageMultisample(const gl::Context *context, - GLenum target, + gl::TextureType type, GLsizei samples, GLint internalFormat, const gl::Extents &size, @@ -415,7 +415,7 @@ ImageD3D *TextureD3D::getBaseLevelImage() const } gl::Error TextureD3D::setImageExternal(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Stream *stream, const egl::Stream::GLTextureDescription &desc) { @@ -528,22 +528,17 @@ bool TextureD3D::isBaseImageZeroSize() const { ImageD3D *baseImage = getBaseLevelImage(); - if (!baseImage || baseImage->getWidth() <= 0) + if (!baseImage || baseImage->getWidth() <= 0 || baseImage->getHeight() <= 0) { return true; } - if (!gl::IsCubeMapTextureTarget(baseImage->getTarget()) && baseImage->getHeight() <= 0) + if (baseImage->getType() == gl::TextureType::_3D && baseImage->getDepth() <= 0) { return true; } - if (baseImage->getTarget() == GL_TEXTURE_3D && baseImage->getDepth() <= 0) - { - return true; - } - - if (baseImage->getTarget() == GL_TEXTURE_2D_ARRAY && getLayerCount(getBaseLevel()) <= 0) + if (baseImage->getType() == gl::TextureType::_2DArray && getLayerCount(getBaseLevel()) <= 0) { return true; } @@ -582,7 +577,7 @@ gl::Error TextureD3D::ensureRenderTarget(const gl::Context *context) bool TextureD3D::canCreateRenderTargetForImage(const gl::ImageIndex &index) const { - if (index.type == GL_TEXTURE_2D_MULTISAMPLE) + if (index.type == gl::TextureType::_2DMultisample) return true; ImageD3D *image = getImage(index); @@ -653,6 +648,9 @@ gl::Error TextureD3D::releaseTexStorage(const gl::Context *context) { return gl::NoError(); } + + onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS); + auto err = mTexStorage->onDestroy(context); SafeDelete(mTexStorage); return err; @@ -671,11 +669,11 @@ gl::Error TextureD3D::initializeContents(const gl::Context *context, // Special case for D3D11 3D textures. We can't create render targets for individual layers of a // 3D texture, so force the clear to the entire mip. There shouldn't ever be a case where we // would lose existing data. - if (imageIndex.type == GL_TEXTURE_3D) + if (imageIndex.type == gl::TextureType::_3D) { imageIndex.layerIndex = gl::ImageIndex::ENTIRE_LEVEL; } - else if (imageIndex.type == GL_TEXTURE_2D_ARRAY && + else if (imageIndex.type == gl::TextureType::_2DArray && imageIndex.layerIndex == gl::ImageIndex::ENTIRE_LEVEL) { GLsizei layerCount = getLayerCount(imageIndex.mipIndex); @@ -694,7 +692,10 @@ gl::Error TextureD3D::initializeContents(const gl::Context *context, } // Fast path: can use a render target clear. - if (canCreateRenderTargetForImage(imageIndex)) + // We don't use the fast path with the zero max lod workaround because it would introduce a race + // between the rendertarget and the staging images. + if (canCreateRenderTargetForImage(imageIndex) && + !mRenderer->getWorkarounds().zeroMaxLodWorkaround) { ANGLE_TRY(ensureRenderTarget(context)); ASSERT(mTexStorage); @@ -708,23 +709,24 @@ gl::Error TextureD3D::initializeContents(const gl::Context *context, const auto &formatInfo = gl::GetSizedInternalFormatInfo(image->getInternalFormat()); size_t imageBytes = 0; - ANGLE_TRY_RESULT(formatInfo.computeRowPitch(image->getWidth(), 1, 0), + ANGLE_TRY_RESULT(formatInfo.computeRowPitch(formatInfo.type, image->getWidth(), 1, 0), imageBytes); imageBytes *= image->getHeight() * image->getDepth(); - gl::PixelUnpackState defaultUnpackState; + gl::PixelUnpackState zeroDataUnpackState; + zeroDataUnpackState.alignment = 1; angle::MemoryBuffer *zeroBuffer = nullptr; ANGLE_TRY(context->getZeroFilledBuffer(imageBytes, &zeroBuffer)); if (shouldUseSetData(image)) { ANGLE_TRY(mTexStorage->setData(context, imageIndex, image, nullptr, formatInfo.type, - defaultUnpackState, zeroBuffer->data())); + zeroDataUnpackState, zeroBuffer->data())); } else { gl::Box fullImageArea(0, 0, 0, image->getWidth(), image->getHeight(), image->getDepth()); - ANGLE_TRY(image->loadData(context, fullImageArea, defaultUnpackState, formatInfo.type, + ANGLE_TRY(image->loadData(context, fullImageArea, zeroDataUnpackState, formatInfo.type, zeroBuffer->data(), false)); // Force an update to the tex storage so we avoid problems with subImage and dirty regions. @@ -778,7 +780,7 @@ ImageD3D *TextureD3D_2D::getImage(const gl::ImageIndex &index) const { ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(!index.hasLayer()); - ASSERT(index.type == GL_TEXTURE_2D); + ASSERT(index.type == gl::TextureType::_2D); return mImageArray[index.mipIndex].get(); } @@ -823,8 +825,7 @@ bool TextureD3D_2D::isSRGB(GLint level) const } gl::Error TextureD3D_2D::setImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -832,34 +833,32 @@ gl::Error TextureD3D_2D::setImage(const gl::Context *context, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D && size.depth == 1); + ASSERT(index.target == gl::TextureTarget::_2D && size.depth == 1); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type); bool fastUnpacked = false; - GLint level = static_cast(imageLevel); - ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, size, false)); - - gl::ImageIndex index = gl::ImageIndex::Make2D(level); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormatInfo.sizedInternalFormat, size, + false)); // Attempt a fast gpu copy of the pixel data to the surface gl::Buffer *unpackBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack); if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) && - isLevelComplete(level)) + isLevelComplete(index.mipIndex)) { // Will try to create RT storage if it does not exist RenderTargetD3D *destRenderTarget = nullptr; ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget)); - gl::Box destArea(0, 0, 0, getWidth(level), getHeight(level), 1); + gl::Box destArea(0, 0, 0, getWidth(index.mipIndex), getHeight(index.mipIndex), 1); ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea, internalFormatInfo.sizedInternalFormat, type, destRenderTarget)); // Ensure we don't overwrite our newly initialized data - mImageArray[level]->markClean(); + mImageArray[index.mipIndex]->markClean(); fastUnpacked = true; } @@ -873,29 +872,25 @@ gl::Error TextureD3D_2D::setImage(const gl::Context *context, } gl::Error TextureD3D_2D::setSubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0); - - GLint level = static_cast(imageLevel); - gl::ImageIndex index = gl::ImageIndex::Make2D(level); + ASSERT(index.target == gl::TextureTarget::_2D && area.depth == 1 && area.z == 0); gl::Buffer *unpackBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack); - if (isFastUnpackable(unpackBuffer, getInternalFormat(level)) && isLevelComplete(level)) + GLenum mipFormat = getInternalFormat(index.mipIndex); + if (isFastUnpackable(unpackBuffer, mipFormat) && isLevelComplete(index.mipIndex)) { RenderTargetD3D *renderTarget = nullptr; ANGLE_TRY(getRenderTarget(context, index, &renderTarget)); - ASSERT(!mImageArray[level]->isDirty()); + ASSERT(!mImageArray[index.mipIndex]->isDirty()); - return fastUnpackPixels(context, unpack, pixels, area, getInternalFormat(level), type, - renderTarget); + return fastUnpackPixels(context, unpack, pixels, area, mipFormat, type, renderTarget); } else { @@ -904,55 +899,48 @@ gl::Error TextureD3D_2D::setSubImage(const gl::Context *context, } gl::Error TextureD3D_2D::setCompressedImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D && size.depth == 1); - GLint level = static_cast(imageLevel); + ASSERT(index.target == gl::TextureTarget::_2D && size.depth == 1); // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly - ANGLE_TRY(redefineImage(context, level, internalFormat, size, false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormat, size, false)); - return setCompressedImageImpl(context, gl::ImageIndex::Make2D(level), unpack, pixels, 0); + return setCompressedImageImpl(context, index, unpack, pixels, 0); } gl::Error TextureD3D_2D::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D && area.depth == 1 && area.z == 0); - - gl::ImageIndex index = gl::ImageIndex::Make2D(static_cast(level)); + ASSERT(index.target == gl::TextureTarget::_2D && area.depth == 1 && area.z == 0); ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0)); return commitRegion(context, index, area); } gl::Error TextureD3D_2D::copyImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Rectangle &origSourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { - ASSERT(target == GL_TEXTURE_2D); + ASSERT(index.target == gl::TextureTarget::_2D); - GLint level = static_cast(imageLevel); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE); gl::Extents sourceExtents(origSourceArea.width, origSourceArea.height, 1); - ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, sourceExtents, - false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormatInfo.sizedInternalFormat, + sourceExtents, false)); gl::Extents fbSize = source->getReadColorbuffer()->getSize(); @@ -961,22 +949,13 @@ gl::Error TextureD3D_2D::copyImage(const gl::Context *context, origSourceArea.x + origSourceArea.width > fbSize.width || origSourceArea.y + origSourceArea.height > fbSize.height; - // In WebGL mode we need to zero the texture outside the framebuffer. - // If we have robust resource init, it was already zeroed by redefineImage() above, otherwise - // zero it explicitly. - // TODO(fjhenigman): When robust resource is fully implemented look into making it a - // prerequisite for WebGL and deleting this code. + // WebGL requires that pixels that would be outside the framebuffer are treated as zero values, + // so clear the mip level to 0 prior to making the copy if any pixel would be sampled outside. + // Same thing for robust resource init. if (outside && (context->getExtensions().webglCompatibility || context->isRobustResourceInitEnabled())) { - angle::MemoryBuffer *zero; - ANGLE_TRY(context->getZeroFilledBuffer( - origSourceArea.width * origSourceArea.height * internalFormatInfo.pixelBytes, &zero)); - gl::PixelUnpackState unpack; - unpack.alignment = 1; - ANGLE_TRY(setImage(context, target, imageLevel, internalFormat, sourceExtents, - internalFormatInfo.format, internalFormatInfo.type, unpack, - zero->data())); + ANGLE_TRY(initializeContents(context, index)); } gl::Rectangle sourceArea; @@ -987,25 +966,25 @@ gl::Error TextureD3D_2D::copyImage(const gl::Context *context, return gl::NoError(); } - gl::ImageIndex index = gl::ImageIndex::Make2D(level); gl::Offset destOffset(sourceArea.x - origSourceArea.x, sourceArea.y - origSourceArea.y, 0); // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders, // so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround) { - ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, destOffset, sourceArea, source)); + ANGLE_TRY(mImageArray[index.mipIndex]->copyFromFramebuffer(context, destOffset, sourceArea, + source)); mDirtyImages = true; } else { ANGLE_TRY(ensureRenderTarget(context)); - if (sourceArea.width != 0 && sourceArea.height != 0 && isValidLevel(level)) + if (sourceArea.width != 0 && sourceArea.height != 0 && isValidLevel(index.mipIndex)) { - ANGLE_TRY(updateStorageLevel(context, level)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); ANGLE_TRY(mRenderer->copyImage2D(context, source, sourceArea, internalFormat, - destOffset, mTexStorage, level)); + destOffset, mTexStorage, index.mipIndex)); } } @@ -1013,13 +992,12 @@ gl::Error TextureD3D_2D::copyImage(const gl::Context *context, } gl::Error TextureD3D_2D::copySubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Offset &origDestOffset, const gl::Rectangle &origSourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { - ASSERT(target == GL_TEXTURE_2D && origDestOffset.z == 0); + ASSERT(index.target == gl::TextureTarget::_2D && origDestOffset.z == 0); gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Rectangle sourceArea; @@ -1034,26 +1012,24 @@ gl::Error TextureD3D_2D::copySubImage(const gl::Context *context, // can only make our texture storage to a render target if level 0 is defined (with a width & height) and // the current level we're copying to is defined (with appropriate format, width & height) - GLint level = static_cast(imageLevel); - gl::ImageIndex index = gl::ImageIndex::Make2D(level); - // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders, // so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround) { - ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, destOffset, sourceArea, source)); + ANGLE_TRY(mImageArray[index.mipIndex]->copyFromFramebuffer(context, destOffset, sourceArea, + source)); mDirtyImages = true; } else { ANGLE_TRY(ensureRenderTarget(context)); - if (isValidLevel(level)) + if (isValidLevel(index.mipIndex)) { - ANGLE_TRY(updateStorageLevel(context, level)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); ANGLE_TRY(mRenderer->copyImage2D(context, source, sourceArea, gl::GetUnsizedFormat(getBaseLevelInternalFormat()), - destOffset, mTexStorage, level)); + destOffset, mTexStorage, index.mipIndex)); } } @@ -1061,8 +1037,7 @@ gl::Error TextureD3D_2D::copySubImage(const gl::Context *context, } gl::Error TextureD3D_2D::copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -1071,31 +1046,31 @@ gl::Error TextureD3D_2D::copyTexture(const gl::Context *context, bool unpackUnmultiplyAlpha, const gl::Texture *source) { - ASSERT(target == GL_TEXTURE_2D); + ASSERT(index.target == gl::TextureTarget::_2D); - GLenum sourceTarget = source->getTarget(); - - GLint destLevel = static_cast(level); + gl::TextureType sourceType = source->getType(); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type); - gl::Extents size(static_cast(source->getWidth(sourceTarget, sourceLevel)), - static_cast(source->getHeight(sourceTarget, sourceLevel)), 1); - ANGLE_TRY( - redefineImage(context, destLevel, internalFormatInfo.sizedInternalFormat, size, false)); + gl::Extents size( + static_cast(source->getWidth(NonCubeTextureTypeToTarget(sourceType), sourceLevel)), + static_cast(source->getHeight(NonCubeTextureTypeToTarget(sourceType), sourceLevel)), + 1); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormatInfo.sizedInternalFormat, size, + false)); gl::Rectangle sourceRect(0, 0, size.width, size.height); gl::Offset destOffset(0, 0, 0); - if (!isSRGB(destLevel) && canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel))) + if (!isSRGB(index.mipIndex) && canCreateRenderTargetForImage(index)) { ANGLE_TRY(ensureRenderTarget(context)); - ASSERT(isValidLevel(destLevel)); - ANGLE_TRY(updateStorageLevel(context, destLevel)); + ASSERT(isValidLevel(index.mipIndex)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); ANGLE_TRY(mRenderer->copyTexture( context, source, static_cast(sourceLevel), sourceRect, internalFormatInfo.format, - internalFormatInfo.type, destOffset, mTexStorage, target, destLevel, unpackFlipY, - unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); + internalFormatInfo.type, destOffset, mTexStorage, index.target, index.mipIndex, + unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); } else { @@ -1104,9 +1079,8 @@ gl::Error TextureD3D_2D::copyTexture(const gl::Context *context, ImageD3D *sourceImage = nullptr; ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage)); - gl::ImageIndex destImageIndex = gl::ImageIndex::Make2D(static_cast(destLevel)); ImageD3D *destImage = nullptr; - ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage)); + ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage)); ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceRect, destOffset, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); @@ -1114,15 +1088,14 @@ gl::Error TextureD3D_2D::copyTexture(const gl::Context *context, mDirtyImages = true; gl::Box destRegion(destOffset, size); - ANGLE_TRY(commitRegion(context, destImageIndex, destRegion)); + ANGLE_TRY(commitRegion(context, index, destRegion)); } return gl::NoError(); } gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, @@ -1131,22 +1104,20 @@ gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context, bool unpackUnmultiplyAlpha, const gl::Texture *source) { - ASSERT(target == GL_TEXTURE_2D); + ASSERT(index.target == gl::TextureTarget::_2D); - GLint destLevel = static_cast(level); - - if (!isSRGB(destLevel) && canCreateRenderTargetForImage(gl::ImageIndex::Make2D(destLevel))) + if (!isSRGB(index.mipIndex) && canCreateRenderTargetForImage(index)) { ANGLE_TRY(ensureRenderTarget(context)); - ASSERT(isValidLevel(destLevel)); - ANGLE_TRY(updateStorageLevel(context, destLevel)); + ASSERT(isValidLevel(index.mipIndex)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); const gl::InternalFormat &internalFormatInfo = - gl::GetSizedInternalFormatInfo(getInternalFormat(destLevel)); + gl::GetSizedInternalFormatInfo(getInternalFormat(index.mipIndex)); ANGLE_TRY(mRenderer->copyTexture( context, source, static_cast(sourceLevel), sourceArea, internalFormatInfo.format, - internalFormatInfo.type, destOffset, mTexStorage, target, destLevel, unpackFlipY, - unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); + internalFormatInfo.type, destOffset, mTexStorage, index.target, index.mipIndex, + unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); } else { @@ -1155,9 +1126,8 @@ gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context, ImageD3D *sourceImage = nullptr; ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage)); - gl::ImageIndex destImageIndex = gl::ImageIndex::Make2D(static_cast(destLevel)); ImageD3D *destImage = nullptr; - ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage)); + ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage)); ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceArea, destOffset, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); @@ -1165,7 +1135,7 @@ gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context, mDirtyImages = true; gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceArea.width, sourceArea.height, 1); - ANGLE_TRY(commitRegion(context, destImageIndex, destRegion)); + ANGLE_TRY(commitRegion(context, index, destRegion)); } return gl::NoError(); @@ -1174,7 +1144,7 @@ gl::Error TextureD3D_2D::copySubTexture(const gl::Context *context, gl::Error TextureD3D_2D::copyCompressedTexture(const gl::Context *context, const gl::Texture *source) { - GLenum sourceTarget = source->getTarget(); + gl::TextureTarget sourceTarget = NonCubeTextureTypeToTarget(source->getType()); GLint sourceLevel = 0; GLint destLevel = 0; @@ -1195,12 +1165,12 @@ gl::Error TextureD3D_2D::copyCompressedTexture(const gl::Context *context, } gl::Error TextureD3D_2D::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) { - ASSERT(GL_TEXTURE_2D && size.depth == 1); + ASSERT(type == gl::TextureType::_2D && size.depth == 1); for (size_t level = 0; level < levels; level++) { @@ -1249,6 +1219,8 @@ gl::Error TextureD3D_2D::bindTexImage(const gl::Context *context, egl::Surface * mDirtyImages = false; mImageArray[0]->markClean(); + mTexStorage->setSubject(this); + return gl::NoError(); } @@ -1268,7 +1240,7 @@ gl::Error TextureD3D_2D::releaseTexImage(const gl::Context *context) } gl::Error TextureD3D_2D::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { EGLImageD3D *eglImaged3d = GetImplAs(image); @@ -1437,6 +1409,7 @@ gl::Error TextureD3D_2D::createCompleteStorage(bool renderTarget, // TODO(geofflang): Determine if the texture creation succeeded outStorage->reset(mRenderer->createTextureStorage2D(internalFormat, renderTarget, width, height, levels, hintLevelZeroOnly)); + (*outStorage)->setSubject(this); return gl::NoError(); } @@ -1456,6 +1429,8 @@ gl::Error TextureD3D_2D::setCompleteTexStorage(const gl::Context *context, ANGLE_TRY(releaseTexStorage(context)); mTexStorage = newCompleteTexStorage; + mTexStorage->setSubject(this); + mDirtyImages = true; return gl::NoError(); @@ -1510,7 +1485,7 @@ gl::Error TextureD3D_2D::redefineImage(const gl::Context *context, const int storageHeight = std::max(1, getLevelZeroHeight() >> level); const GLenum storageFormat = getBaseLevelInternalFormat(); - mImageArray[level]->redefine(GL_TEXTURE_2D, internalformat, size, forceRelease); + mImageArray[level]->redefine(gl::TextureType::_2D, internalformat, size, forceRelease); mDirtyImages = mDirtyImages || mImageArray[level]->isDirty(); if (mTexStorage) @@ -1553,7 +1528,7 @@ gl::ImageIndex TextureD3D_2D::getImageIndex(GLint mip, GLint /*layer*/) const bool TextureD3D_2D::isValidIndex(const gl::ImageIndex &index) const { - return (mTexStorage && index.type == GL_TEXTURE_2D && index.mipIndex >= 0 && + return (mTexStorage && index.type == gl::TextureType::_2D && index.mipIndex >= 0 && index.mipIndex < mTexStorage->getLevelCount()); } @@ -1607,7 +1582,7 @@ ImageD3D *TextureD3D_Cube::getImage(int level, int layer) const ImageD3D *TextureD3D_Cube::getImage(const gl::ImageIndex &index) const { ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS); - ASSERT(gl::IsCubeMapTextureTarget(index.target)); + ASSERT(gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap); return mImageArray[index.cubeMapFaceIndex()][index.mipIndex].get(); } @@ -1636,7 +1611,7 @@ bool TextureD3D_Cube::isSRGB(GLint level, GLint layer) const } gl::Error TextureD3D_Cube::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { UNREACHABLE(); @@ -1644,8 +1619,7 @@ gl::Error TextureD3D_Cube::setEGLImageTarget(const gl::Context *context, } gl::Error TextureD3D_Cube::setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -1656,17 +1630,14 @@ gl::Error TextureD3D_Cube::setImage(const gl::Context *context, ASSERT(size.depth == 1); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type); - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast(level)); - - ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), static_cast(level), + ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), index.mipIndex, internalFormatInfo.sizedInternalFormat, size, false)); return setImageImpl(context, index, type, unpack, pixels, 0); } gl::Error TextureD3D_Cube::setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -1674,14 +1645,11 @@ gl::Error TextureD3D_Cube::setSubImage(const gl::Context *context, const uint8_t *pixels) { ASSERT(area.depth == 1 && area.z == 0); - - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast(level)); return TextureD3D::subImage(context, index, area, format, type, unpack, pixels, 0); } gl::Error TextureD3D_Cube::setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, @@ -1691,18 +1659,14 @@ gl::Error TextureD3D_Cube::setCompressedImage(const gl::Context *context, ASSERT(size.depth == 1); // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly - size_t faceIndex = gl::CubeMapTextureTargetToLayerIndex(target); + ANGLE_TRY(redefineImage(context, index.cubeMapFaceIndex(), index.mipIndex, internalFormat, size, + false)); - ANGLE_TRY(redefineImage(context, static_cast(faceIndex), static_cast(level), - internalFormat, size, false)); - - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast(level)); return setCompressedImageImpl(context, index, unpack, pixels, 0); } gl::Error TextureD3D_Cube::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -1711,27 +1675,22 @@ gl::Error TextureD3D_Cube::setCompressedSubImage(const gl::Context *context, { ASSERT(area.depth == 1 && area.z == 0); - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, static_cast(level)); - ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0)); return commitRegion(context, index, area); } gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Rectangle &origSourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { - int faceIndex = static_cast(gl::CubeMapTextureTargetToLayerIndex(target)); + GLint faceIndex = index.cubeMapFaceIndex(); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, GL_UNSIGNED_BYTE); - GLint level = static_cast(imageLevel); - gl::Extents size(origSourceArea.width, origSourceArea.height, 1); - ANGLE_TRY(redefineImage(context, static_cast(faceIndex), level, + ANGLE_TRY(redefineImage(context, faceIndex, index.mipIndex, internalFormatInfo.sizedInternalFormat, size, false)); gl::Extents fbSize = source->getReadColorbuffer()->getSize(); @@ -1741,22 +1700,13 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, origSourceArea.x + origSourceArea.width > fbSize.width || origSourceArea.y + origSourceArea.height > fbSize.height; - // In WebGL mode we need to zero the texture outside the framebuffer. - // If we have robust resource init, it was already zeroed by redefineImage() above, otherwise - // zero it explicitly. - // TODO(fjhenigman): When robust resource is fully implemented look into making it a - // prerequisite for WebGL and deleting this code. - if (outside && context->getExtensions().webglCompatibility && - !context->isRobustResourceInitEnabled()) + // WebGL requires that pixels that would be outside the framebuffer are treated as zero values, + // so clear the mip level to 0 prior to making the copy if any pixel would be sampled outside. + // Same thing for robust resource init. + if (outside && + (context->getExtensions().webglCompatibility || context->isRobustResourceInitEnabled())) { - angle::MemoryBuffer *zero; - ANGLE_TRY(context->getZeroFilledBuffer( - origSourceArea.width * origSourceArea.height * internalFormatInfo.pixelBytes, &zero)); - gl::PixelUnpackState unpack; - unpack.alignment = 1; - ANGLE_TRY(setImage(context, target, imageLevel, internalFormat, size, - internalFormatInfo.format, internalFormatInfo.type, unpack, - zero->data())); + ANGLE_TRY(initializeContents(context, index)); } gl::Rectangle sourceArea; @@ -1767,15 +1717,14 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, return gl::NoError(); } - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level); gl::Offset destOffset(sourceArea.x - origSourceArea.x, sourceArea.y - origSourceArea.y, 0); // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders, // so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround) { - ANGLE_TRY(mImageArray[faceIndex][level]->copyFromFramebuffer(context, destOffset, - sourceArea, source)); + ANGLE_TRY(mImageArray[faceIndex][index.mipIndex]->copyFromFramebuffer(context, destOffset, + sourceArea, source)); mDirtyImages = true; } else @@ -1784,11 +1733,12 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, ASSERT(size.width == size.height); - if (size.width > 0 && isValidFaceLevel(faceIndex, level)) + if (size.width > 0 && isValidFaceLevel(faceIndex, index.mipIndex)) { - ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, level)); + ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.mipIndex)); ANGLE_TRY(mRenderer->copyImageCube(context, source, sourceArea, internalFormat, - destOffset, mTexStorage, target, level)); + destOffset, mTexStorage, index.target, + index.mipIndex)); } } @@ -1796,11 +1746,10 @@ gl::Error TextureD3D_Cube::copyImage(const gl::Context *context, } gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Offset &origDestOffset, const gl::Rectangle &origSourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Rectangle sourceArea; @@ -1812,28 +1761,25 @@ gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context, const gl::Offset destOffset(origDestOffset.x + sourceArea.x - origSourceArea.x, origDestOffset.y + sourceArea.y - origSourceArea.y, 0); - int faceIndex = static_cast(gl::CubeMapTextureTargetToLayerIndex(target)); - - GLint level = static_cast(imageLevel); - gl::ImageIndex index = gl::ImageIndex::MakeCube(target, level); + GLint faceIndex = index.cubeMapFaceIndex(); // If the zero max LOD workaround is active, then we can't sample from individual layers of the framebuffer in shaders, // so we should use the non-rendering copy path. if (!canCreateRenderTargetForImage(index) || mRenderer->getWorkarounds().zeroMaxLodWorkaround) { - ANGLE_TRY(mImageArray[faceIndex][level]->copyFromFramebuffer(context, destOffset, - sourceArea, source)); + ANGLE_TRY(mImageArray[faceIndex][index.mipIndex]->copyFromFramebuffer(context, destOffset, + sourceArea, source)); mDirtyImages = true; } else { ANGLE_TRY(ensureRenderTarget(context)); - if (isValidFaceLevel(faceIndex, level)) + if (isValidFaceLevel(faceIndex, index.mipIndex)) { - ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, level)); - ANGLE_TRY(mRenderer->copyImageCube(context, source, sourceArea, - gl::GetUnsizedFormat(getBaseLevelInternalFormat()), - destOffset, mTexStorage, target, level)); + ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.mipIndex)); + ANGLE_TRY(mRenderer->copyImageCube( + context, source, sourceArea, gl::GetUnsizedFormat(getBaseLevelInternalFormat()), + destOffset, mTexStorage, index.target, index.mipIndex)); } } @@ -1841,8 +1787,7 @@ gl::Error TextureD3D_Cube::copySubImage(const gl::Context *context, } gl::Error TextureD3D_Cube::copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -1851,33 +1796,31 @@ gl::Error TextureD3D_Cube::copyTexture(const gl::Context *context, bool unpackUnmultiplyAlpha, const gl::Texture *source) { - ASSERT(gl::IsCubeMapTextureTarget(target)); + ASSERT(gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap); - GLenum sourceTarget = source->getTarget(); + gl::TextureTarget sourceTarget = NonCubeTextureTypeToTarget(source->getType()); - GLint destLevel = static_cast(level); - int faceIndex = static_cast(gl::CubeMapTextureTargetToLayerIndex(target)); + GLint faceIndex = index.cubeMapFaceIndex(); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type); gl::Extents size(static_cast(source->getWidth(sourceTarget, sourceLevel)), static_cast(source->getHeight(sourceTarget, sourceLevel)), 1); - ANGLE_TRY(redefineImage(context, faceIndex, destLevel, internalFormatInfo.sizedInternalFormat, - size, false)); + ANGLE_TRY(redefineImage(context, faceIndex, index.mipIndex, + internalFormatInfo.sizedInternalFormat, size, false)); gl::Rectangle sourceRect(0, 0, size.width, size.height); gl::Offset destOffset(0, 0, 0); - if (!isSRGB(destLevel, faceIndex) && - canCreateRenderTargetForImage(gl::ImageIndex::MakeCube(target, destLevel))) + if (!isSRGB(index.mipIndex, faceIndex) && canCreateRenderTargetForImage(index)) { ANGLE_TRY(ensureRenderTarget(context)); - ASSERT(isValidFaceLevel(faceIndex, destLevel)); - ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, destLevel)); + ASSERT(isValidFaceLevel(faceIndex, index.mipIndex)); + ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.mipIndex)); ANGLE_TRY(mRenderer->copyTexture( context, source, static_cast(sourceLevel), sourceRect, internalFormatInfo.format, - internalFormatInfo.type, destOffset, mTexStorage, target, destLevel, unpackFlipY, - unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); + internalFormatInfo.type, destOffset, mTexStorage, index.target, index.mipIndex, + unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); } else { @@ -1886,10 +1829,8 @@ gl::Error TextureD3D_Cube::copyTexture(const gl::Context *context, ImageD3D *sourceImage = nullptr; ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage)); - gl::ImageIndex destImageIndex = - gl::ImageIndex::MakeCube(target, static_cast(destLevel)); ImageD3D *destImage = nullptr; - ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage)); + ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage)); ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceRect, destOffset, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); @@ -1897,15 +1838,14 @@ gl::Error TextureD3D_Cube::copyTexture(const gl::Context *context, mDirtyImages = true; gl::Box destRegion(destOffset, size); - ANGLE_TRY(commitRegion(context, destImageIndex, destRegion)); + ANGLE_TRY(commitRegion(context, index, destRegion)); } return gl::NoError(); } gl::Error TextureD3D_Cube::copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, @@ -1914,24 +1854,22 @@ gl::Error TextureD3D_Cube::copySubTexture(const gl::Context *context, bool unpackUnmultiplyAlpha, const gl::Texture *source) { - ASSERT(gl::IsCubeMapTextureTarget(target)); + ASSERT(gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap); - GLint destLevel = static_cast(level); - int faceIndex = static_cast(gl::CubeMapTextureTargetToLayerIndex(target)); + GLint faceIndex = index.cubeMapFaceIndex(); - if (!isSRGB(destLevel, faceIndex) && - canCreateRenderTargetForImage(gl::ImageIndex::MakeCube(target, destLevel))) + if (!isSRGB(index.mipIndex, faceIndex) && canCreateRenderTargetForImage(index)) { ANGLE_TRY(ensureRenderTarget(context)); - ASSERT(isValidFaceLevel(faceIndex, destLevel)); - ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, destLevel)); + ASSERT(isValidFaceLevel(faceIndex, index.mipIndex)); + ANGLE_TRY(updateStorageFaceLevel(context, faceIndex, index.mipIndex)); const gl::InternalFormat &internalFormatInfo = - gl::GetSizedInternalFormatInfo(getInternalFormat(destLevel, faceIndex)); + gl::GetSizedInternalFormatInfo(getInternalFormat(index.mipIndex, faceIndex)); ANGLE_TRY(mRenderer->copyTexture( context, source, static_cast(sourceLevel), sourceArea, internalFormatInfo.format, - internalFormatInfo.type, destOffset, mTexStorage, target, destLevel, unpackFlipY, - unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); + internalFormatInfo.type, destOffset, mTexStorage, index.target, index.mipIndex, + unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); } else { @@ -1940,10 +1878,8 @@ gl::Error TextureD3D_Cube::copySubTexture(const gl::Context *context, ImageD3D *sourceImage = nullptr; ANGLE_TRY(sourceD3D->getImageAndSyncFromStorage(context, sourceImageIndex, &sourceImage)); - gl::ImageIndex destImageIndex = - gl::ImageIndex::MakeCube(target, static_cast(destLevel)); ImageD3D *destImage = nullptr; - ANGLE_TRY(getImageAndSyncFromStorage(context, destImageIndex, &destImage)); + ANGLE_TRY(getImageAndSyncFromStorage(context, index, &destImage)); ANGLE_TRY(mRenderer->copyImage(context, destImage, sourceImage, sourceArea, destOffset, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)); @@ -1951,14 +1887,14 @@ gl::Error TextureD3D_Cube::copySubTexture(const gl::Context *context, mDirtyImages = true; gl::Box destRegion(destOffset.x, destOffset.y, 0, sourceArea.width, sourceArea.height, 1); - ANGLE_TRY(commitRegion(context, destImageIndex, destRegion)); + ANGLE_TRY(commitRegion(context, index, destRegion)); } return gl::NoError(); } gl::Error TextureD3D_Cube::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) @@ -1971,7 +1907,8 @@ gl::Error TextureD3D_Cube::setStorage(const gl::Context *context, GLsizei mipSize = std::max(1, size.width >> level); for (int faceIndex = 0; faceIndex < 6; faceIndex++) { - mImageArray[faceIndex][level]->redefine(GL_TEXTURE_CUBE_MAP, internalFormat, gl::Extents(mipSize, mipSize, 1), true); + mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, internalFormat, + gl::Extents(mipSize, mipSize, 1), true); } } @@ -1979,7 +1916,8 @@ gl::Error TextureD3D_Cube::setStorage(const gl::Context *context, { for (int faceIndex = 0; faceIndex < 6; faceIndex++) { - mImageArray[faceIndex][level]->redefine(GL_TEXTURE_CUBE_MAP, GL_NONE, gl::Extents(0, 0, 0), true); + mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, GL_NONE, + gl::Extents(0, 0, 0), true); } } @@ -2063,7 +2001,7 @@ gl::Error TextureD3D_Cube::getRenderTarget(const gl::Context *context, const gl::ImageIndex &index, RenderTargetD3D **outRT) { - ASSERT(gl::IsCubeMapTextureTarget(index.target)); + ASSERT(gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap); // ensure the underlying texture is created ANGLE_TRY(ensureRenderTarget(context)); @@ -2245,7 +2183,7 @@ gl::Error TextureD3D_Cube::updateStorageFaceLevel(const gl::Context *context, if (image->isDirty()) { - GLenum faceTarget = gl::LayerIndexToCubeMapTextureTarget(faceIndex); + gl::TextureTarget faceTarget = gl::CubeFaceIndexToTextureTarget(faceIndex); gl::ImageIndex index = gl::ImageIndex::MakeCube(faceTarget, level); gl::Box region(0, 0, 0, image->getWidth(), image->getHeight(), 1); ANGLE_TRY(commitRegion(context, index, region)); @@ -2266,7 +2204,7 @@ gl::Error TextureD3D_Cube::redefineImage(const gl::Context *context, const int storageHeight = std::max(1, getLevelZeroHeight() >> level); const GLenum storageFormat = getBaseLevelInternalFormat(); - mImageArray[faceIndex][level]->redefine(GL_TEXTURE_CUBE_MAP, internalformat, size, + mImageArray[faceIndex][level]->redefine(gl::TextureType::CubeMap, internalformat, size, forceRelease); mDirtyImages = mDirtyImages || mImageArray[faceIndex][level]->isDirty(); @@ -2294,14 +2232,14 @@ gl::ImageIndexIterator TextureD3D_Cube::imageIterator() const gl::ImageIndex TextureD3D_Cube::getImageIndex(GLint mip, GLint layer) const { // The "layer" of the image index corresponds to the cube face - return gl::ImageIndex::MakeCube(gl::LayerIndexToCubeMapTextureTarget(layer), mip); + return gl::ImageIndex::MakeCube(gl::CubeFaceIndexToTextureTarget(layer), mip); } bool TextureD3D_Cube::isValidIndex(const gl::ImageIndex &index) const { - return (mTexStorage && index.type == GL_TEXTURE_CUBE_MAP && - gl::IsCubeMapTextureTarget(index.target) && index.mipIndex >= 0 && - index.mipIndex < mTexStorage->getLevelCount()); + return (mTexStorage && index.type == gl::TextureType::CubeMap && + gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap && + index.mipIndex >= 0 && index.mipIndex < mTexStorage->getLevelCount()); } void TextureD3D_Cube::markAllImagesDirty() @@ -2352,7 +2290,7 @@ ImageD3D *TextureD3D_3D::getImage(const gl::ImageIndex &index) const { ASSERT(index.mipIndex < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS); ASSERT(!index.hasLayer()); - ASSERT(index.type == GL_TEXTURE_3D); + ASSERT(index.type == gl::TextureType::_3D); return mImageArray[index.mipIndex].get(); } @@ -2400,7 +2338,7 @@ bool TextureD3D_3D::isDepth(GLint level) const } gl::Error TextureD3D_3D::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { UNREACHABLE(); @@ -2408,8 +2346,7 @@ gl::Error TextureD3D_3D::setEGLImageTarget(const gl::Context *context, } gl::Error TextureD3D_3D::setImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -2417,33 +2354,32 @@ gl::Error TextureD3D_3D::setImage(const gl::Context *context, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_3D); + ASSERT(index.target == gl::TextureTarget::_3D); const gl::InternalFormat &internalFormatInfo = gl::GetInternalFormatInfo(internalFormat, type); - GLint level = static_cast(imageLevel); - ANGLE_TRY(redefineImage(context, level, internalFormatInfo.sizedInternalFormat, size, false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormatInfo.sizedInternalFormat, size, + false)); bool fastUnpacked = false; - gl::ImageIndex index = gl::ImageIndex::Make3D(level); - // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer gl::Buffer *unpackBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack); if (isFastUnpackable(unpackBuffer, internalFormatInfo.sizedInternalFormat) && !size.empty() && - isLevelComplete(level)) + isLevelComplete(index.mipIndex)) { // Will try to create RT storage if it does not exist RenderTargetD3D *destRenderTarget = nullptr; ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget)); - gl::Box destArea(0, 0, 0, getWidth(level), getHeight(level), getDepth(level)); + gl::Box destArea(0, 0, 0, getWidth(index.mipIndex), getHeight(index.mipIndex), + getDepth(index.mipIndex)); ANGLE_TRY(fastUnpackPixels(context, unpack, pixels, destArea, internalFormatInfo.sizedInternalFormat, type, destRenderTarget)); // Ensure we don't overwrite our newly initialized data - mImageArray[level]->markClean(); + mImageArray[index.mipIndex]->markClean(); fastUnpacked = true; } @@ -2457,30 +2393,26 @@ gl::Error TextureD3D_3D::setImage(const gl::Context *context, } gl::Error TextureD3D_3D::setSubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_3D); - - GLint level = static_cast(imageLevel); - gl::ImageIndex index = gl::ImageIndex::Make3D(level); + ASSERT(index.target == gl::TextureTarget::_3D); // Attempt a fast gpu copy of the pixel data to the surface if the app bound an unpack buffer gl::Buffer *unpackBuffer = context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack); - if (isFastUnpackable(unpackBuffer, getInternalFormat(level)) && isLevelComplete(level)) + GLenum mipFormat = getInternalFormat(index.mipIndex); + if (isFastUnpackable(unpackBuffer, mipFormat) && isLevelComplete(index.mipIndex)) { RenderTargetD3D *destRenderTarget = nullptr; ANGLE_TRY(getRenderTarget(context, index, &destRenderTarget)); - ASSERT(!mImageArray[level]->isDirty()); + ASSERT(!mImageArray[index.mipIndex]->isDirty()); - return fastUnpackPixels(context, unpack, pixels, area, getInternalFormat(level), type, - destRenderTarget); + return fastUnpackPixels(context, unpack, pixels, area, mipFormat, type, destRenderTarget); } else { @@ -2489,61 +2421,52 @@ gl::Error TextureD3D_3D::setSubImage(const gl::Context *context, } gl::Error TextureD3D_3D::setCompressedImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_3D); + ASSERT(index.target == gl::TextureTarget::_3D); - GLint level = static_cast(imageLevel); // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly - ANGLE_TRY(redefineImage(context, level, internalFormat, size, false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormat, size, false)); - gl::ImageIndex index = gl::ImageIndex::Make3D(level); return setCompressedImageImpl(context, index, unpack, pixels, 0); } gl::Error TextureD3D_3D::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_3D); + ASSERT(index.target == gl::TextureTarget::_3D); - gl::ImageIndex index = gl::ImageIndex::Make3D(static_cast(level)); ANGLE_TRY(TextureD3D::subImageCompressed(context, index, area, format, unpack, pixels, 0)); return commitRegion(context, index, area); } gl::Error TextureD3D_3D::copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNIMPLEMENTED(); return gl::InternalError() << "Copying 3D textures is unimplemented."; } gl::Error TextureD3D_3D::copySubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { - ASSERT(target == GL_TEXTURE_3D); - - GLint level = static_cast(imageLevel); + ASSERT(index.target == gl::TextureTarget::_3D); gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Rectangle clippedSourceArea; @@ -2561,43 +2484,42 @@ gl::Error TextureD3D_3D::copySubImage(const gl::Context *context, // date before the copy and then copy back to the storage afterwards if needed. // TODO: Investigate 3D blits in D3D11. - bool syncTexStorage = mTexStorage && isLevelComplete(level); + bool syncTexStorage = mTexStorage && isLevelComplete(index.mipIndex); if (syncTexStorage) { - gl::ImageIndex index = gl::ImageIndex::Make3D(level); - ANGLE_TRY(mImageArray[level]->copyFromTexStorage(context, index, mTexStorage)); + ANGLE_TRY(mImageArray[index.mipIndex]->copyFromTexStorage(context, index, mTexStorage)); } - ANGLE_TRY(mImageArray[level]->copyFromFramebuffer(context, clippedDestOffset, clippedSourceArea, - source)); + ANGLE_TRY(mImageArray[index.mipIndex]->copyFromFramebuffer(context, clippedDestOffset, + clippedSourceArea, source)); mDirtyImages = true; if (syncTexStorage) { - ANGLE_TRY(updateStorageLevel(context, level)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); } return gl::NoError(); } gl::Error TextureD3D_3D::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) { - ASSERT(target == GL_TEXTURE_3D); + ASSERT(type == gl::TextureType::_3D); for (size_t level = 0; level < levels; level++) { gl::Extents levelSize(std::max(1, size.width >> level), std::max(1, size.height >> level), std::max(1, size.depth >> level)); - mImageArray[level]->redefine(GL_TEXTURE_3D, internalFormat, levelSize, true); + mImageArray[level]->redefine(gl::TextureType::_3D, internalFormat, levelSize, true); } for (size_t level = levels; level < gl::IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++) { - mImageArray[level]->redefine(GL_TEXTURE_3D, GL_NONE, gl::Extents(0, 0, 0), true); + mImageArray[level]->redefine(gl::TextureType::_3D, GL_NONE, gl::Extents(0, 0, 0), true); } // TODO(geofflang): Verify storage creation had no errors @@ -2836,7 +2758,7 @@ gl::Error TextureD3D_3D::redefineImage(const gl::Context *context, const int storageDepth = std::max(1, getLevelZeroDepth() >> level); const GLenum storageFormat = getBaseLevelInternalFormat(); - mImageArray[level]->redefine(GL_TEXTURE_3D, internalformat, size, forceRelease); + mImageArray[level]->redefine(gl::TextureType::_3D, internalformat, size, forceRelease); mDirtyImages = mDirtyImages || mImageArray[level]->isDirty(); if (mTexStorage) @@ -2869,7 +2791,7 @@ gl::ImageIndex TextureD3D_3D::getImageIndex(GLint mip, GLint /*layer*/) const bool TextureD3D_3D::isValidIndex(const gl::ImageIndex &index) const { - return (mTexStorage && index.type == GL_TEXTURE_3D && index.mipIndex >= 0 && + return (mTexStorage && index.type == gl::TextureType::_3D && index.mipIndex >= 0 && index.mipIndex < mTexStorage->getLevelCount()); } @@ -2925,7 +2847,7 @@ ImageD3D *TextureD3D_2DArray::getImage(const gl::ImageIndex &index) const ASSERT(index.layerIndex != gl::ImageIndex::ENTIRE_LEVEL); ASSERT((index.layerIndex == 0 && mLayerCounts[index.mipIndex] == 0) || index.layerIndex < mLayerCounts[index.mipIndex]); - ASSERT(index.type == GL_TEXTURE_2D_ARRAY); + ASSERT(index.type == gl::TextureType::_2DArray); return (mImageArray[index.mipIndex] ? mImageArray[index.mipIndex][index.layerIndex] : nullptr); } @@ -2956,7 +2878,7 @@ bool TextureD3D_2DArray::isDepth(GLint level) const } gl::Error TextureD3D_2DArray::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { UNREACHABLE(); @@ -2964,8 +2886,7 @@ gl::Error TextureD3D_2DArray::setEGLImageTarget(const gl::Context *context, } gl::Error TextureD3D_2DArray::setImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -2973,45 +2894,40 @@ gl::Error TextureD3D_2DArray::setImage(const gl::Context *context, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); + ASSERT(index.target == gl::TextureTarget::_2DArray); const gl::InternalFormat &formatInfo = gl::GetInternalFormatInfo(internalFormat, type); - const gl::InternalFormat &packFormat = gl::GetPackFormatInfo(format, type); - GLint level = static_cast(imageLevel); - ANGLE_TRY(redefineImage(context, level, formatInfo.sizedInternalFormat, size, false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, formatInfo.sizedInternalFormat, size, false)); GLsizei inputDepthPitch = 0; - ANGLE_TRY_RESULT(packFormat.computeDepthPitch(size.width, size.height, unpack.alignment, + ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, size.width, size.height, unpack.alignment, unpack.rowLength, unpack.imageHeight), inputDepthPitch); for (int i = 0; i < size.depth; i++) { const ptrdiff_t layerOffset = (inputDepthPitch * i); - gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i); - ANGLE_TRY(setImageImpl(context, index, type, unpack, pixels, layerOffset)); + gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.mipIndex, i); + ANGLE_TRY(setImageImpl(context, layerIndex, type, unpack, pixels, layerOffset)); } return gl::NoError(); } gl::Error TextureD3D_2DArray::setSubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, const gl::PixelUnpackState &unpack, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); - GLint level = static_cast(imageLevel); - const gl::InternalFormat &packFormat = - gl::GetPackFormatInfo(getInternalFormat(level), type); - + ASSERT(index.target == gl::TextureTarget::_2DArray); + const gl::InternalFormat &formatInfo = + gl::GetInternalFormatInfo(getInternalFormat(index.mipIndex), type); GLsizei inputDepthPitch = 0; - ANGLE_TRY_RESULT(packFormat.computeDepthPitch(area.width, area.height, unpack.alignment, + ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(type, area.width, area.height, unpack.alignment, unpack.rowLength, unpack.imageHeight), inputDepthPitch); @@ -3022,8 +2938,8 @@ gl::Error TextureD3D_2DArray::setSubImage(const gl::Context *context, gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1); - gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, layer); - ANGLE_TRY(TextureD3D::subImage(context, index, layerArea, format, type, unpack, pixels, + gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.mipIndex, layer); + ANGLE_TRY(TextureD3D::subImage(context, layerIndex, layerArea, format, type, unpack, pixels, layerOffset)); } @@ -3031,52 +2947,49 @@ gl::Error TextureD3D_2DArray::setSubImage(const gl::Context *context, } gl::Error TextureD3D_2DArray::setCompressedImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); + ASSERT(index.target == gl::TextureTarget::_2DArray); - GLint level = static_cast(imageLevel); // compressed formats don't have separate sized internal formats-- we can just use the compressed format directly - ANGLE_TRY(redefineImage(context, level, internalFormat, size, false)); + ANGLE_TRY(redefineImage(context, index.mipIndex, internalFormat, size, false)); const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(internalFormat); GLsizei inputDepthPitch = 0; ANGLE_TRY_RESULT( - formatInfo.computeDepthPitch(size.width, size.height, 1, 0, 0), + formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, size.width, size.height, 1, 0, 0), inputDepthPitch); for (int i = 0; i < size.depth; i++) { const ptrdiff_t layerOffset = (inputDepthPitch * i); - gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, i); - ANGLE_TRY(setCompressedImageImpl(context, index, unpack, pixels, layerOffset)); + gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.mipIndex, i); + ANGLE_TRY(setCompressedImageImpl(context, layerIndex, unpack, pixels, layerOffset)); } return gl::NoError(); } gl::Error TextureD3D_2DArray::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); + ASSERT(index.target == gl::TextureTarget::_2DArray); const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(format); GLsizei inputDepthPitch = 0; ANGLE_TRY_RESULT( - formatInfo.computeDepthPitch(area.width, area.height, 1, 0, 0), + formatInfo.computeDepthPitch(GL_UNSIGNED_BYTE, area.width, area.height, 1, 0, 0), inputDepthPitch); for (int i = 0; i < area.depth; i++) @@ -3086,37 +2999,32 @@ gl::Error TextureD3D_2DArray::setCompressedSubImage(const gl::Context *context, gl::Box layerArea(area.x, area.y, 0, area.width, area.height, 1); - gl::ImageIndex index = gl::ImageIndex::Make2DArray(static_cast(level), layer); - ANGLE_TRY(TextureD3D::subImageCompressed(context, index, layerArea, format, unpack, pixels, - layerOffset)); - ANGLE_TRY(commitRegion(context, index, layerArea)); + gl::ImageIndex layerIndex = gl::ImageIndex::Make2DArray(index.mipIndex, layer); + ANGLE_TRY(TextureD3D::subImageCompressed(context, layerIndex, layerArea, format, unpack, + pixels, layerOffset)); + ANGLE_TRY(commitRegion(context, layerIndex, layerArea)); } return gl::NoError(); } gl::Error TextureD3D_2DArray::copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNIMPLEMENTED(); return gl::InternalError() << "Copying 2D array textures is unimplemented."; } gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); - - GLint level = static_cast(imageLevel); - gl::ImageIndex index = gl::ImageIndex::Make2DArray(level, destOffset.z); + ASSERT(index.target == gl::TextureTarget::_2DArray); gl::Extents fbSize = source->getReadColorbuffer()->getSize(); gl::Rectangle clippedSourceArea; @@ -3132,7 +3040,7 @@ gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context, if (!canCreateRenderTargetForImage(index)) { gl::Offset destLayerOffset(clippedDestOffset.x, clippedDestOffset.y, 0); - ANGLE_TRY(mImageArray[level][clippedDestOffset.z]->copyFromFramebuffer( + ANGLE_TRY(mImageArray[index.mipIndex][clippedDestOffset.z]->copyFromFramebuffer( context, destLayerOffset, clippedSourceArea, source)); mDirtyImages = true; } @@ -3140,25 +3048,25 @@ gl::Error TextureD3D_2DArray::copySubImage(const gl::Context *context, { ANGLE_TRY(ensureRenderTarget(context)); - if (isValidLevel(level)) + if (isValidLevel(index.mipIndex)) { - ANGLE_TRY(updateStorageLevel(context, level)); + ANGLE_TRY(updateStorageLevel(context, index.mipIndex)); ANGLE_TRY( mRenderer->copyImage2DArray(context, source, clippedSourceArea, gl::GetUnsizedFormat(getInternalFormat(getBaseLevel())), - clippedDestOffset, mTexStorage, level)); + clippedDestOffset, mTexStorage, index.mipIndex)); } } return gl::NoError(); } gl::Error TextureD3D_2DArray::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) { - ASSERT(target == GL_TEXTURE_2D_ARRAY); + ASSERT(type == gl::TextureType::_2DArray); deleteImages(); @@ -3178,7 +3086,8 @@ gl::Error TextureD3D_2DArray::setStorage(const gl::Context *context, for (int layer = 0; layer < mLayerCounts[level]; layer++) { mImageArray[level][layer] = mRenderer->createImage(); - mImageArray[level][layer]->redefine(GL_TEXTURE_2D_ARRAY, internalFormat, levelLayerSize, true); + mImageArray[level][layer]->redefine(gl::TextureType::_2DArray, internalFormat, + levelLayerSize, true); } } } @@ -3468,7 +3377,7 @@ gl::Error TextureD3D_2DArray::redefineImage(const gl::Context *context, { for (int layer = 0; layer < mLayerCounts[level]; layer++) { - mImageArray[level][layer]->redefine(GL_TEXTURE_2D_ARRAY, internalformat, + mImageArray[level][layer]->redefine(gl::TextureType::_2DArray, internalformat, gl::Extents(size.width, size.height, 1), forceRelease); mDirtyImages = mDirtyImages || mImageArray[level][layer]->isDirty(); @@ -3504,7 +3413,7 @@ gl::ImageIndex TextureD3D_2DArray::getImageIndex(GLint mip, GLint layer) const bool TextureD3D_2DArray::isValidIndex(const gl::ImageIndex &index) const { // Check for having a storage and the right type of index - if (!mTexStorage || index.type != GL_TEXTURE_2D_ARRAY) + if (!mTexStorage || index.type != gl::TextureType::_2DArray) { return false; } @@ -3552,8 +3461,7 @@ GLsizei TextureD3D_External::getLayerCount(int level) const } gl::Error TextureD3D_External::setImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -3567,8 +3475,7 @@ gl::Error TextureD3D_External::setImage(const gl::Context *context, } gl::Error TextureD3D_External::setSubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -3580,8 +3487,7 @@ gl::Error TextureD3D_External::setSubImage(const gl::Context *context, } gl::Error TextureD3D_External::setCompressedImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, @@ -3593,8 +3499,7 @@ gl::Error TextureD3D_External::setCompressedImage(const gl::Context *context, } gl::Error TextureD3D_External::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -3606,29 +3511,27 @@ gl::Error TextureD3D_External::setCompressedSubImage(const gl::Context *context, } gl::Error TextureD3D_External::copyImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNREACHABLE(); return gl::InternalError(); } gl::Error TextureD3D_External::copySubImage(const gl::Context *context, - GLenum target, - size_t imageLevel, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNREACHABLE(); return gl::InternalError(); } gl::Error TextureD3D_External::setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) @@ -3638,11 +3541,11 @@ gl::Error TextureD3D_External::setStorage(const gl::Context *context, } gl::Error TextureD3D_External::setImageExternal(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Stream *stream, const egl::Stream::GLTextureDescription &desc) { - ASSERT(target == GL_TEXTURE_EXTERNAL_OES); + ASSERT(type == gl::TextureType::External); ANGLE_TRY(releaseTexStorage(context)); @@ -3668,7 +3571,7 @@ gl::Error TextureD3D_External::releaseTexImage(const gl::Context *context) } gl::Error TextureD3D_External::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { EGLImageD3D *eglImaged3d = GetImplAs(image); @@ -3744,7 +3647,7 @@ gl::ImageIndex TextureD3D_External::getImageIndex(GLint mip, GLint /*layer*/) co bool TextureD3D_External::isValidIndex(const gl::ImageIndex &index) const { - return (mTexStorage && index.type == GL_TEXTURE_EXTERNAL_OES && index.mipIndex == 0); + return (mTexStorage && index.type == gl::TextureType::External && index.mipIndex == 0); } void TextureD3D_External::markAllImagesDirty() @@ -3768,8 +3671,7 @@ ImageD3D *TextureD3D_2DMultisample::getImage(const gl::ImageIndex &index) const } gl::Error TextureD3D_2DMultisample::setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -3782,8 +3684,7 @@ gl::Error TextureD3D_2DMultisample::setImage(const gl::Context *context, } gl::Error TextureD3D_2DMultisample::setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -3795,8 +3696,7 @@ gl::Error TextureD3D_2DMultisample::setSubImage(const gl::Context *context, } gl::Error TextureD3D_2DMultisample::setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, @@ -3808,8 +3708,7 @@ gl::Error TextureD3D_2DMultisample::setCompressedImage(const gl::Context *contex } gl::Error TextureD3D_2DMultisample::setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -3821,35 +3720,33 @@ gl::Error TextureD3D_2DMultisample::setCompressedSubImage(const gl::Context *con } gl::Error TextureD3D_2DMultisample::copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNREACHABLE(); return gl::InternalError(); } gl::Error TextureD3D_2DMultisample::copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) + gl::Framebuffer *source) { UNREACHABLE(); return gl::InternalError(); } gl::Error TextureD3D_2DMultisample::setStorageMultisample(const gl::Context *context, - GLenum target, + gl::TextureType type, GLsizei samples, GLint internalFormat, const gl::Extents &size, bool fixedSampleLocations) { - ASSERT(target == GL_TEXTURE_2D_MULTISAMPLE && size.depth == 1); + ASSERT(type == gl::TextureType::_2DMultisample && size.depth == 1); TexStoragePointer storage(context); storage.reset(mRenderer->createTextureStorage2DMultisample(internalFormat, size.width, @@ -3879,7 +3776,7 @@ gl::Error TextureD3D_2DMultisample::releaseTexImage(const gl::Context *context) } gl::Error TextureD3D_2DMultisample::setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) { UNREACHABLE(); @@ -3910,7 +3807,7 @@ gl::ImageIndex TextureD3D_2DMultisample::getImageIndex(GLint mip, GLint layer) c bool TextureD3D_2DMultisample::isValidIndex(const gl::ImageIndex &index) const { - return (mTexStorage && index.type == GL_TEXTURE_2D_MULTISAMPLE && index.mipIndex == 0); + return (mTexStorage && index.type == gl::TextureType::_2DMultisample && index.mipIndex == 0); } GLsizei TextureD3D_2DMultisample::getLayerCount(int level) const diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h index eb206a6ccc1b..5c0ee51b14ff 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureD3D.h @@ -57,13 +57,13 @@ class TextureD3D : public TextureImpl GLenum getBaseLevelInternalFormat() const; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; gl::Error setStorageMultisample(const gl::Context *context, - GLenum target, + gl::TextureType type, GLsizei samples, GLint internalFormat, const gl::Extents &size, @@ -84,7 +84,7 @@ class TextureD3D : public TextureImpl virtual bool isValidIndex(const gl::ImageIndex &index) const = 0; gl::Error setImageExternal(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Stream *stream, const egl::Stream::GLTextureDescription &desc) override; gl::Error generateMipmap(const gl::Context *context) override; @@ -205,8 +205,7 @@ class TextureD3D_2D : public TextureD3D bool isSRGB(GLint level) const; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -214,8 +213,7 @@ class TextureD3D_2D : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -223,16 +221,14 @@ class TextureD3D_2D : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -240,21 +236,18 @@ class TextureD3D_2D : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -263,8 +256,7 @@ class TextureD3D_2D : public TextureD3D bool unpackUnmultiplyAlpha, const gl::Texture *source) override; gl::Error copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, @@ -275,7 +267,7 @@ class TextureD3D_2D : public TextureD3D gl::Error copyCompressedTexture(const gl::Context *context, const gl::Texture *source) override; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; @@ -284,7 +276,7 @@ class TextureD3D_2D : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, @@ -341,8 +333,7 @@ class TextureD3D_Cube : public TextureD3D bool isSRGB(GLint level, GLint layer) const; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -350,8 +341,7 @@ class TextureD3D_Cube : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -359,16 +349,14 @@ class TextureD3D_Cube : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -376,21 +364,18 @@ class TextureD3D_Cube : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copyTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, GLenum type, size_t sourceLevel, @@ -399,8 +384,7 @@ class TextureD3D_Cube : public TextureD3D bool unpackUnmultiplyAlpha, const gl::Texture *source) override; gl::Error copySubTexture(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, size_t sourceLevel, const gl::Rectangle &sourceArea, @@ -410,7 +394,7 @@ class TextureD3D_Cube : public TextureD3D const gl::Texture *source) override; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; @@ -419,7 +403,7 @@ class TextureD3D_Cube : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, @@ -478,8 +462,7 @@ class TextureD3D_3D : public TextureD3D bool isDepth(GLint level) const; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -487,8 +470,7 @@ class TextureD3D_3D : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -496,16 +478,14 @@ class TextureD3D_3D : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -513,20 +493,18 @@ class TextureD3D_3D : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; @@ -535,7 +513,7 @@ class TextureD3D_3D : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, @@ -592,8 +570,7 @@ class TextureD3D_2DArray : public TextureD3D bool isDepth(GLint level) const; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -601,8 +578,7 @@ class TextureD3D_2DArray : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -610,16 +586,14 @@ class TextureD3D_2DArray : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -627,20 +601,18 @@ class TextureD3D_2DArray : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; @@ -649,7 +621,7 @@ class TextureD3D_2DArray : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, @@ -703,8 +675,7 @@ class TextureD3D_External : public TextureD3D GLsizei getLayerCount(int level) const override; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -712,8 +683,7 @@ class TextureD3D_External : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -721,16 +691,14 @@ class TextureD3D_External : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -738,26 +706,24 @@ class TextureD3D_External : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error setStorage(const gl::Context *context, - GLenum target, + gl::TextureType type, size_t levels, GLenum internalFormat, const gl::Extents &size) override; gl::Error setImageExternal(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Stream *stream, const egl::Stream::GLTextureDescription &desc) override; @@ -765,7 +731,7 @@ class TextureD3D_External : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, @@ -800,8 +766,7 @@ class TextureD3D_2DMultisample : public TextureD3D ImageD3D *getImage(const gl::ImageIndex &index) const override; gl::Error setImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, GLenum format, @@ -809,8 +774,7 @@ class TextureD3D_2DMultisample : public TextureD3D const gl::PixelUnpackState &unpack, const uint8_t *pixels) override; gl::Error setSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, GLenum type, @@ -818,16 +782,14 @@ class TextureD3D_2DMultisample : public TextureD3D const uint8_t *pixels) override; gl::Error setCompressedImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, GLenum internalFormat, const gl::Extents &size, const gl::PixelUnpackState &unpack, size_t imageSize, const uint8_t *pixels) override; gl::Error setCompressedSubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Box &area, GLenum format, const gl::PixelUnpackState &unpack, @@ -835,20 +797,18 @@ class TextureD3D_2DMultisample : public TextureD3D const uint8_t *pixels) override; gl::Error copyImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Rectangle &sourceArea, GLenum internalFormat, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error copySubImage(const gl::Context *context, - GLenum target, - size_t level, + const gl::ImageIndex &index, const gl::Offset &destOffset, const gl::Rectangle &sourceArea, - const gl::Framebuffer *source) override; + gl::Framebuffer *source) override; gl::Error setStorageMultisample(const gl::Context *context, - GLenum target, + gl::TextureType type, GLsizei samples, GLint internalFormat, const gl::Extents &size, @@ -858,7 +818,7 @@ class TextureD3D_2DMultisample : public TextureD3D gl::Error releaseTexImage(const gl::Context *context) override; gl::Error setEGLImageTarget(const gl::Context *context, - GLenum target, + gl::TextureType type, egl::Image *image) override; gl::Error getRenderTarget(const gl::Context *context, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h index 383fbc21416e..1d743f7f2bb0 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/TextureStorage.h @@ -23,6 +23,11 @@ struct Box; struct PixelUnpackState; } // namespace gl +namespace angle +{ +class Subject; +} // namespace angle + namespace rx { class SwapChainD3D; @@ -32,7 +37,7 @@ class ImageD3D; class TextureStorage : angle::NonCopyable { public: - TextureStorage() {} + TextureStorage() : mSubject(nullptr) {} virtual ~TextureStorage() {} virtual gl::Error onDestroy(const gl::Context *context); @@ -62,6 +67,12 @@ class TextureStorage : angle::NonCopyable // This is a no-op for most implementations of TextureStorage. Some (e.g. TextureStorage11_2D) might override it. virtual gl::Error useLevelZeroWorkaroundTexture(const gl::Context *context, bool useLevelZeroTexture); + + // Only used for D3D11. + void setSubject(const angle::Subject *subject); + + protected: + const angle::Subject *mSubject; }; inline gl::Error TextureStorage::onDestroy(const gl::Context *context) @@ -75,6 +86,11 @@ inline gl::Error TextureStorage::useLevelZeroWorkaroundTexture(const gl::Context return gl::NoError(); } +inline void TextureStorage::setSubject(const angle::Subject *subject) +{ + mSubject = subject; +} + using TexStoragePointer = angle::UniqueObjectPointer; } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp index 7c2d5aec705e..ce1bbfcce786 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.cpp @@ -92,7 +92,7 @@ gl::Error VertexBufferInterface::setBufferSize(unsigned int size) gl::ErrorOrResult VertexBufferInterface::getSpaceRequired( const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const { unsigned int spaceRequired = 0; @@ -155,7 +155,7 @@ gl::Error StreamingVertexBufferInterface::storeDynamicAttribute(const gl::Vertex const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int *outStreamOffset, const uint8_t *sourceData) @@ -190,7 +190,7 @@ gl::Error StreamingVertexBufferInterface::storeDynamicAttribute(const gl::Vertex gl::Error StreamingVertexBufferInterface::reserveVertexSpace(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) { unsigned int requiredSpace = 0; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h index df8085d3cbda..63cdc2359f3a 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexBuffer.h @@ -45,7 +45,7 @@ class VertexBuffer : angle::NonCopyable const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int offset, const uint8_t *sourceData) = 0; @@ -93,7 +93,7 @@ class VertexBufferInterface : angle::NonCopyable gl::ErrorOrResult getSpaceRequired(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const; BufferFactoryD3D *const mFactory; VertexBuffer *mVertexBuffer; @@ -110,14 +110,14 @@ class StreamingVertexBufferInterface : public VertexBufferInterface const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int *outStreamOffset, const uint8_t *sourceData); gl::Error reserveVertexSpace(const gl::VertexAttribute &attribute, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances); private: diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp index 54ad5e54f5bb..183c895b623a 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.cpp @@ -153,7 +153,7 @@ VertexStorageType ClassifyAttributeStorage(const gl::VertexAttribute &attrib, } // If specified with immediate data, we must use dynamic storage. - auto *buffer = binding.getBuffer().get(); + gl::Buffer *buffer = binding.getBuffer().get(); if (!buffer) { return VertexStorageType::DYNAMIC; @@ -392,7 +392,7 @@ gl::Error VertexDataManager::storeDynamicAttribs( std::vector *translatedAttribs, const gl::AttributesMask &dynamicAttribsMask, GLint start, - GLsizei count, + size_t count, GLsizei instances) { // Instantiating this class will ensure the streaming buffer is never left mapped. @@ -434,7 +434,7 @@ void VertexDataManager::PromoteDynamicAttribs( const gl::Context *context, const std::vector &translatedAttribs, const gl::AttributesMask &dynamicAttribsMask, - GLsizei count) + size_t count) { for (auto attribIndex : dynamicAttribsMask) { @@ -445,16 +445,17 @@ void VertexDataManager::PromoteDynamicAttribs( gl::Buffer *buffer = binding.getBuffer().get(); if (buffer) { + // Note: this multiplication can overflow. It should not be a security problem. BufferD3D *bufferD3D = GetImplAs(buffer); size_t typeSize = ComputeVertexAttributeTypeSize(*dynamicAttrib.attribute); - bufferD3D->promoteStaticUsage(context, count * static_cast(typeSize)); + bufferD3D->promoteStaticUsage(context, count * typeSize); } } } gl::Error VertexDataManager::reserveSpaceForAttrib(const TranslatedAttribute &translatedAttrib, GLint start, - GLsizei count, + size_t count, GLsizei instances) const { ASSERT(translatedAttrib.attribute && translatedAttrib.binding); @@ -467,8 +468,8 @@ gl::Error VertexDataManager::reserveSpaceForAttrib(const TranslatedAttribute &tr BufferD3D *bufferD3D = buffer ? GetImplAs(buffer) : nullptr; ASSERT(!bufferD3D || bufferD3D->getStaticVertexBuffer(attrib, binding) == nullptr); - size_t totalCount = gl::ComputeVertexBindingElementCount( - binding.getDivisor(), static_cast(count), static_cast(instances)); + size_t totalCount = gl::ComputeVertexBindingElementCount(binding.getDivisor(), count, + static_cast(instances)); // TODO(jiajia.qin@intel.com): force the index buffer to clamp any out of range indices instead // of invalid operation here. if (bufferD3D) @@ -486,15 +487,14 @@ gl::Error VertexDataManager::reserveSpaceForAttrib(const TranslatedAttribute &tr return gl::InvalidOperation() << "Vertex buffer is not big enough for the draw call."; } } - return mStreamingBuffer->reserveVertexSpace(attrib, binding, static_cast(totalCount), - instances); + return mStreamingBuffer->reserveVertexSpace(attrib, binding, totalCount, instances); } gl::Error VertexDataManager::storeDynamicAttrib(const gl::Context *context, TranslatedAttribute *translated, GLint start, - GLsizei count, - GLsizei instances) + size_t count, + GLsizei instances) const { ASSERT(translated->attribute && translated->binding); const auto &attrib = *translated->attribute; @@ -529,8 +529,8 @@ gl::Error VertexDataManager::storeDynamicAttrib(const gl::Context *context, translated->storage = nullptr; ANGLE_TRY_RESULT(mFactory->getVertexSpaceRequired(attrib, binding, 1, 0), translated->stride); - size_t totalCount = gl::ComputeVertexBindingElementCount( - binding.getDivisor(), static_cast(count), static_cast(instances)); + size_t totalCount = gl::ComputeVertexBindingElementCount(binding.getDivisor(), count, + static_cast(instances)); ANGLE_TRY(mStreamingBuffer->storeDynamicAttribute( attrib, binding, translated->currentValueType, firstVertexIndex, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h index 694366deb701..2fb4fe6c468c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/VertexDataManager.h @@ -105,14 +105,14 @@ class VertexDataManager : angle::NonCopyable std::vector *translatedAttribs, const gl::AttributesMask &dynamicAttribsMask, GLint start, - GLsizei count, + size_t count, GLsizei instances); // Promote static usage of dynamic buffers. static void PromoteDynamicAttribs(const gl::Context *context, const std::vector &translatedAttribs, const gl::AttributesMask &dynamicAttribsMask, - GLsizei count); + size_t count); gl::Error storeCurrentValue(const gl::VertexAttribCurrentValueData ¤tValue, TranslatedAttribute *translated, @@ -130,15 +130,15 @@ class VertexDataManager : angle::NonCopyable }; gl::Error reserveSpaceForAttrib(const TranslatedAttribute &translatedAttrib, - GLsizei count, GLint start, + size_t count, GLsizei instances) const; gl::Error storeDynamicAttrib(const gl::Context *context, TranslatedAttribute *translated, GLint start, - GLsizei count, - GLsizei instances); + size_t count, + GLsizei instances) const; BufferFactoryD3D *const mFactory; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp index 1e9a9ba4927c..1bb263cdb168 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Blit11.cpp @@ -1551,7 +1551,7 @@ gl::Error Blit11::copyAndConvert(const TextureHelper11 &source, if (mRenderer->getWorkarounds().depthStencilBlitExtraCopy) { D3D11_MAPPED_SUBRESOURCE mapped; - deviceContext->Map(destStaging.get(), 0, D3D11_MAP_READ, 0, &mapped); + ANGLE_TRY(mRenderer->mapResource(destStaging.get(), 0, D3D11_MAP_READ, 0, &mapped)); deviceContext->UpdateSubresource(dest.get(), destSubresource, nullptr, mapped.pData, mapped.RowPitch, mapped.DepthPitch); deviceContext->Unmap(destStaging.get(), 0); @@ -2043,7 +2043,8 @@ gl::ErrorOrResult Blit11::resolveDepth(const gl::Context *conte stateManager->setSimpleViewport(extents); // Set the viewport - stateManager->setShaderResourceShared(gl::SHADER_FRAGMENT, 0, &depth->getShaderResourceView()); + stateManager->setShaderResourceShared(gl::ShaderType::Fragment, 0, + &depth->getShaderResourceView()); // Trigger the blit on the GPU. deviceContext->Draw(6, 0); @@ -2201,9 +2202,9 @@ gl::ErrorOrResult Blit11::resolveStencil(const gl::Context *con // Set the viewport stateManager->setSimpleViewport(extents); - stateManager->setShaderResourceShared(gl::SHADER_FRAGMENT, 0, + stateManager->setShaderResourceShared(gl::ShaderType::Fragment, 0, &depthStencil->getShaderResourceView()); - stateManager->setShaderResource(gl::SHADER_FRAGMENT, 1, &mStencilSRV); + stateManager->setShaderResource(gl::ShaderType::Fragment, 1, &mStencilSRV); // Trigger the blit on the GPU. deviceContext->Draw(6, 0); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp index d71018f77af7..833693217285 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.cpp @@ -398,10 +398,6 @@ gl::Error Buffer11::setSubData(const gl::Context *context, ANGLE_TRY(writeBuffer->setData(static_cast(data), offset, size)); onStorageUpdate(writeBuffer); - - // Notify any vertex arrays that we have dirty data. - // TODO(jmadill): Use a more fine grained notification for data updates. - mDirectSubject.onStateChange(context, angle::SubjectMessage::STATE_CHANGE); } mSize = std::max(mSize, requiredSize); @@ -471,9 +467,6 @@ gl::Error Buffer11::copySubData(const gl::Context *context, mSize = std::max(mSize, destOffset + size); invalidateStaticData(context); - // Also notify that direct buffers are dirty. - mDirectSubject.onStateChange(context, angle::SubjectMessage::STATE_CHANGE); - return gl::NoError(); } @@ -758,7 +751,7 @@ Buffer11::BufferStorage *Buffer11::allocateStorage(BufferUsage usage) return new EmulatedIndexedStorage(mRenderer); case BUFFER_USAGE_INDEX: case BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK: - return new NativeStorage(mRenderer, usage, &mDirectSubject); + return new NativeStorage(mRenderer, usage, this); default: return new NativeStorage(mRenderer, usage, nullptr); } @@ -919,27 +912,13 @@ bool Buffer11::supportsDirectBinding() const void Buffer11::initializeStaticData(const gl::Context *context) { BufferD3D::initializeStaticData(context); - - // Notify when static data changes. - mStaticSubject.onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED); } void Buffer11::invalidateStaticData(const gl::Context *context) { BufferD3D::invalidateStaticData(context); - - // Notify when static data changes. - mStaticSubject.onStateChange(context, angle::SubjectMessage::STATE_CHANGE); -} - -angle::Subject *Buffer11::getStaticSubject() -{ - return &mStaticSubject; -} - -angle::Subject *Buffer11::getDirectSubject() -{ - return &mDirectSubject; + onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED); } void Buffer11::onCopyStorage(BufferStorage *dest, BufferStorage *source) @@ -1109,7 +1088,7 @@ gl::Error Buffer11::NativeStorage::resize(const gl::Context *context, // Notify that the storage has changed. if (mOnStorageChanged) { - mOnStorageChanged->onStateChange(context, angle::SubjectMessage::STATE_CHANGE); + mOnStorageChanged->onStateChange(context, angle::SubjectMessage::STORAGE_CHANGED); } return gl::NoError(); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h index cbe0b62041ee..ec72dc5f03fc 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Buffer11.h @@ -104,12 +104,6 @@ class Buffer11 : public BufferD3D gl::Error unmap(const gl::Context *context, GLboolean *result) override; gl::Error markTransformFeedbackUsage(const gl::Context *context) override; - // We use two set of dirty events. Static buffers are marked dirty whenever - // data changes, because they must be re-translated. Direct buffers only need to be - // updated when the underlying ID3D11Buffer pointer changes - hopefully far less often. - angle::Subject *getStaticSubject(); - angle::Subject *getDirectSubject(); - private: class BufferStorage; class EmulatedIndexedStorage; @@ -179,9 +173,6 @@ class Buffer11 : public BufferD3D ConstantBufferCache mConstantBufferRangeStoragesCache; size_t mConstantBufferStorageAdditionalSize; unsigned int mMaxConstantBufferLruCount; - - angle::Subject mStaticSubject; - angle::Subject mDirectSubject; }; } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp index 73234c65e3d1..559836786eef 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.cpp @@ -21,15 +21,93 @@ #include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Fence11.h" #include "libANGLE/renderer/d3d/d3d11/Framebuffer11.h" +#include "libANGLE/renderer/d3d/d3d11/IndexBuffer11.h" #include "libANGLE/renderer/d3d/d3d11/ProgramPipeline11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/StateManager11.h" #include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h" #include "libANGLE/renderer/d3d/d3d11/VertexArray11.h" +#include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" namespace rx { +namespace +{ +bool DrawCallHasStreamingVertexArrays(const gl::Context *context, GLenum mode) +{ + const gl::State &glState = context->getGLState(); + const gl::VertexArray *vertexArray = glState.getVertexArray(); + VertexArray11 *vertexArray11 = GetImplAs(vertexArray); + // Direct drawing doesn't support dynamic attribute storage since it needs the first and count + // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported + // either since we need to simulate them in D3D. + if (vertexArray11->hasActiveDynamicAttrib(context) || mode == GL_LINE_LOOP || + mode == GL_TRIANGLE_FAN) + { + return true; + } + + ProgramD3D *programD3D = GetImplAs(glState.getProgram()); + if (InstancedPointSpritesActive(programD3D, mode)) + { + return true; + } + + return false; +} + +bool DrawCallHasStreamingElementArray(const gl::Context *context, GLenum srcType) +{ + const gl::State &glState = context->getGLState(); + gl::Buffer *elementArrayBuffer = glState.getVertexArray()->getElementArrayBuffer().get(); + + bool primitiveRestartWorkaround = + UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), srcType); + const GLenum dstType = (srcType == GL_UNSIGNED_INT || primitiveRestartWorkaround) + ? GL_UNSIGNED_INT + : GL_UNSIGNED_SHORT; + + // Not clear where the offset comes from here. + switch (ClassifyIndexStorage(glState, elementArrayBuffer, srcType, dstType, 0)) + { + case IndexStorageType::Dynamic: + return true; + case IndexStorageType::Direct: + return false; + case IndexStorageType::Static: + { + BufferD3D *bufferD3D = GetImplAs(elementArrayBuffer); + StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer(); + return (staticBuffer->getBufferSize() == 0 || staticBuffer->getIndexType() != dstType); + } + default: + UNREACHABLE(); + return true; + } +} + +template +gl::Error ReadbackIndirectBuffer(const gl::Context *context, + const void *indirect, + const IndirectBufferT **bufferPtrOut) +{ + const gl::State &glState = context->getGLState(); + gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect); + ASSERT(drawIndirectBuffer); + Buffer11 *storage = GetImplAs(drawIndirectBuffer); + uintptr_t offset = reinterpret_cast(indirect); + + const uint8_t *bufferData = nullptr; + ANGLE_TRY(storage->getData(context, &bufferData)); + ASSERT(bufferData); + + *bufferPtrOut = reinterpret_cast(bufferData + offset); + return gl::NoError(); +} + +} // anonymous namespace + Context11::Context11(const gl::ContextState &state, Renderer11 *renderer) : ContextImpl(state), mRenderer(renderer) { @@ -73,21 +151,20 @@ FramebufferImpl *Context11::createFramebuffer(const gl::FramebufferState &data) TextureImpl *Context11::createTexture(const gl::TextureState &state) { - switch (state.getTarget()) + switch (state.getType()) { - case GL_TEXTURE_2D: + case gl::TextureType::_2D: return new TextureD3D_2D(state, mRenderer); - case GL_TEXTURE_CUBE_MAP: + case gl::TextureType::CubeMap: return new TextureD3D_Cube(state, mRenderer); - case GL_TEXTURE_3D: + case gl::TextureType::_3D: return new TextureD3D_3D(state, mRenderer); - case GL_TEXTURE_2D_ARRAY: + case gl::TextureType::_2DArray: return new TextureD3D_2DArray(state, mRenderer); - case GL_TEXTURE_EXTERNAL_OES: + case gl::TextureType::External: return new TextureD3D_External(state, mRenderer); - case GL_TEXTURE_2D_MULTISAMPLE: + case gl::TextureType::_2DMultisample: return new TextureD3D_2DMultisample(state, mRenderer); - break; default: UNREACHABLE(); } @@ -159,8 +236,10 @@ gl::Error Context11::finish(const gl::Context *context) gl::Error Context11::drawArrays(const gl::Context *context, GLenum mode, GLint first, GLsizei count) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawArrays(context, mode, first, count, 0); + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(!drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawArrays(context, drawCallParams); } gl::Error Context11::drawArraysInstanced(const gl::Context *context, @@ -169,8 +248,10 @@ gl::Error Context11::drawArraysInstanced(const gl::Context *context, GLsizei count, GLsizei instanceCount) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawArrays(context, mode, first, count, instanceCount); + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(!drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawArrays(context, drawCallParams); } gl::Error Context11::drawElements(const gl::Context *context, @@ -179,8 +260,10 @@ gl::Error Context11::drawElements(const gl::Context *context, GLenum type, const void *indices) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawElements(context, mode, count, type, indices, 0); + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawElements(context, drawCallParams); } gl::Error Context11::drawElementsInstanced(const gl::Context *context, @@ -190,8 +273,10 @@ gl::Error Context11::drawElementsInstanced(const gl::Context *context, const void *indices, GLsizei instances) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawElements(context, mode, count, type, indices, instances); + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawElements(context, drawCallParams); } gl::Error Context11::drawRangeElements(const gl::Context *context, @@ -202,16 +287,32 @@ gl::Error Context11::drawRangeElements(const gl::Context *context, GLenum type, const void *indices) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawElements(context, mode, count, type, indices, 0); + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(drawCallParams.isDrawElements() && !drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawElements(context, drawCallParams); } gl::Error Context11::drawArraysIndirect(const gl::Context *context, GLenum mode, const void *indirect) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawArraysIndirect(context, mode, indirect); + if (DrawCallHasStreamingVertexArrays(context, mode)) + { + const gl::DrawArraysIndirectCommand *cmd = nullptr; + ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd)); + + gl::DrawCallParams drawCallParams(mode, cmd->first, cmd->count, cmd->instanceCount); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawArrays(context, drawCallParams); + } + else + { + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(!drawCallParams.isDrawElements() && drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawArraysIndirect(context, drawCallParams); + } } gl::Error Context11::drawElementsIndirect(const gl::Context *context, @@ -219,8 +320,34 @@ gl::Error Context11::drawElementsIndirect(const gl::Context *context, GLenum type, const void *indirect) { - ANGLE_TRY(prepareForDrawCall(context, mode)); - return mRenderer->drawElementsIndirect(context, mode, type, indirect); + if (DrawCallHasStreamingVertexArrays(context, mode) || + DrawCallHasStreamingElementArray(context, type)) + { + const gl::DrawElementsIndirectCommand *cmd = nullptr; + ANGLE_TRY(ReadbackIndirectBuffer(context, indirect, &cmd)); + + const gl::Type &typeInfo = gl::GetTypeInfo(type); + const void *indices = reinterpret_cast( + static_cast(cmd->firstIndex * typeInfo.bytes)); + + gl::DrawCallParams drawCallParams(mode, cmd->count, type, indices, cmd->baseVertex, + cmd->primCount); + + // We must explicitly resolve the index range for the slow-path indirect drawElements to + // make sure we are using the correct 'baseVertex'. This parameter does not exist for the + // direct drawElements. + ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); + + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawElements(context, drawCallParams); + } + else + { + const gl::DrawCallParams &drawCallParams = context->getParams(); + ASSERT(drawCallParams.isDrawElements() && drawCallParams.isDrawIndirect()); + ANGLE_TRY(prepareForDrawCall(context, drawCallParams)); + return mRenderer->drawElementsIndirect(context, drawCallParams); + } } GLenum Context11::getResetStatus() @@ -402,21 +529,20 @@ gl::Error Context11::triggerDrawCallProgramRecompilation(const gl::Context *cont return gl::NoError(); } -gl::Error Context11::prepareForDrawCall(const gl::Context *context, GLenum drawMode) +gl::Error Context11::prepareForDrawCall(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) { - ANGLE_TRY(mRenderer->getStateManager()->updateState(context, drawMode)); + ANGLE_TRY(mRenderer->getStateManager()->updateState(context, drawCallParams)); return gl::NoError(); } gl::Error Context11::memoryBarrier(const gl::Context *context, GLbitfield barriers) { - UNIMPLEMENTED(); return gl::NoError(); } gl::Error Context11::memoryBarrierByRegion(const gl::Context *context, GLbitfield barriers) { - UNIMPLEMENTED(); return gl::NoError(); } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h index c7c5605ca411..2a46625e95cc 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Context11.h @@ -149,7 +149,8 @@ class Context11 : public ContextImpl gl::Error triggerDrawCallProgramRecompilation(const gl::Context *context, GLenum drawMode); private: - gl::Error prepareForDrawCall(const gl::Context *context, GLenum drawMode); + gl::Error prepareForDrawCall(const gl::Context *context, + const gl::DrawCallParams &drawCallParams); Renderer11 *mRenderer; }; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp index 333ea3d9633b..1ee208a30272 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.cpp @@ -53,42 +53,12 @@ gl::Error MarkAttachmentsDirty(const gl::Context *context, return gl::NoError(); } - -void UpdateCachedRenderTarget(const gl::Context *context, - const gl::FramebufferAttachment *attachment, - RenderTarget11 *&cachedRenderTarget, - angle::ObserverBinding *channelBinding) -{ - RenderTarget11 *newRenderTarget = nullptr; - if (attachment) - { - // TODO(jmadill): Don't swallow this error. - gl::Error error = attachment->getRenderTarget(context, &newRenderTarget); - if (error.isError()) - { - ERR() << "Internal rendertarget error: " << error; - } - } - if (newRenderTarget != cachedRenderTarget) - { - channelBinding->bind(newRenderTarget); - cachedRenderTarget = newRenderTarget; - } -} } // anonymous namespace Framebuffer11::Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer) - : FramebufferD3D(data, renderer), - mRenderer(renderer), - mCachedDepthStencilRenderTarget(nullptr), - mDepthStencilRenderTargetDirty(this, gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) + : FramebufferD3D(data, renderer), mRenderer(renderer) { ASSERT(mRenderer != nullptr); - mCachedColorRenderTargets.fill(nullptr); - for (size_t colorIndex = 0; colorIndex < data.getColorAttachments().size(); ++colorIndex) - { - mColorRenderTargetsDirty.emplace_back(this, colorIndex); - } } Framebuffer11::~Framebuffer11() @@ -387,57 +357,11 @@ GLenum Framebuffer11::getRenderTargetImplementationFormat(RenderTargetD3D *rende return renderTarget11->getFormatSet().format().fboImplementationInternalFormat; } -void Framebuffer11::updateColorRenderTarget(const gl::Context *context, size_t colorIndex) +gl::Error Framebuffer11::syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) { - UpdateCachedRenderTarget(context, mState.getColorAttachment(colorIndex), - mCachedColorRenderTargets[colorIndex], - &mColorRenderTargetsDirty[colorIndex]); -} - -void Framebuffer11::updateDepthStencilRenderTarget(const gl::Context *context) -{ - UpdateCachedRenderTarget(context, mState.getDepthOrStencilAttachment(), - mCachedDepthStencilRenderTarget, &mDepthStencilRenderTargetDirty); -} - -void Framebuffer11::syncState(const gl::Context *context, - const gl::Framebuffer::DirtyBits &dirtyBits) -{ - const auto &mergedDirtyBits = dirtyBits | mInternalDirtyBits; - mInternalDirtyBits.reset(); - - for (auto dirtyBit : mergedDirtyBits) - { - switch (dirtyBit) - { - case gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT: - case gl::Framebuffer::DIRTY_BIT_STENCIL_ATTACHMENT: - updateDepthStencilRenderTarget(context); - break; - case gl::Framebuffer::DIRTY_BIT_DRAW_BUFFERS: - case gl::Framebuffer::DIRTY_BIT_READ_BUFFER: - break; - case gl::Framebuffer::DIRTY_BIT_DEFAULT_WIDTH: - case gl::Framebuffer::DIRTY_BIT_DEFAULT_HEIGHT: - case gl::Framebuffer::DIRTY_BIT_DEFAULT_SAMPLES: - case gl::Framebuffer::DIRTY_BIT_DEFAULT_FIXED_SAMPLE_LOCATIONS: - break; - default: - { - ASSERT(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 == 0 && - dirtyBit < gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_MAX); - size_t colorIndex = - static_cast(dirtyBit - gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0); - updateColorRenderTarget(context, colorIndex); - break; - } - } - } - - // We should not have dirtied any additional state during our sync. - ASSERT(!mInternalDirtyBits.any()); - - FramebufferD3D::syncState(context, dirtyBits); + ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits)); + ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits)); // Call this last to allow the state manager to take advantage of the cached render targets. mRenderer->getStateManager()->invalidateRenderTarget(); @@ -447,27 +371,8 @@ void Framebuffer11::syncState(const gl::Context *context, { mRenderer->getStateManager()->invalidateViewport(context); } -} -void Framebuffer11::onSubjectStateChange(const gl::Context *context, - angle::SubjectIndex index, - angle::SubjectMessage message) -{ - if (index == gl::IMPLEMENTATION_MAX_FRAMEBUFFER_ATTACHMENTS) - { - // Stencil is redundant in this case. - mInternalDirtyBits.set(gl::Framebuffer::DIRTY_BIT_DEPTH_ATTACHMENT); - mCachedDepthStencilRenderTarget = nullptr; - } - else - { - mInternalDirtyBits.set(gl::Framebuffer::DIRTY_BIT_COLOR_ATTACHMENT_0 + index); - mCachedColorRenderTargets[index] = nullptr; - } - - // Notify the context we need to re-validate the RenderTarget. - // TODO(jmadill): Check that we're the active draw framebuffer. - mRenderer->getStateManager()->invalidateRenderTarget(); + return gl::NoError(); } gl::Error Framebuffer11::getSamplePosition(size_t index, GLfloat *xy) const @@ -480,20 +385,9 @@ gl::Error Framebuffer11::getSamplePosition(size_t index, GLfloat *xy) const return gl::NoError(); } -bool Framebuffer11::hasAnyInternalDirtyBit() const -{ - return mInternalDirtyBits.any(); -} - -void Framebuffer11::syncInternalState(const gl::Context *context) -{ - syncState(context, gl::Framebuffer::DirtyBits()); -} - RenderTarget11 *Framebuffer11::getFirstRenderTarget() const { - ASSERT(mInternalDirtyBits.none()); - for (auto *renderTarget : mCachedColorRenderTargets) + for (auto *renderTarget : mRenderTargetCache.getColors()) { if (renderTarget) { @@ -501,7 +395,7 @@ RenderTarget11 *Framebuffer11::getFirstRenderTarget() const } } - return mCachedDepthStencilRenderTarget; + return mRenderTargetCache.getDepthStencil(); } } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h index ddb2addb75e2..d7b43b350b51 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Framebuffer11.h @@ -9,15 +9,16 @@ #ifndef LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ #define LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ +#include "libANGLE/Observer.h" +#include "libANGLE/renderer/RenderTargetCache.h" #include "libANGLE/renderer/d3d/FramebufferD3D.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" -#include "libANGLE/signal_utils.h" namespace rx { class Renderer11; -class Framebuffer11 : public FramebufferD3D, public angle::ObserverInterface +class Framebuffer11 : public FramebufferD3D { public: Framebuffer11(const gl::FramebufferState &data, Renderer11 *renderer); @@ -35,28 +36,20 @@ class Framebuffer11 : public FramebufferD3D, public angle::ObserverInterface // Invalidate the cached swizzles of all bound texture attachments. gl::Error markAttachmentsDirty(const gl::Context *context) const; - void syncState(const gl::Context *context, - const gl::Framebuffer::DirtyBits &dirtyBits) override; + gl::Error syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) override; - const RenderTargetArray &getCachedColorRenderTargets() const + const gl::AttachmentArray &getCachedColorRenderTargets() const { - return mCachedColorRenderTargets; + return mRenderTargetCache.getColors(); } const RenderTarget11 *getCachedDepthStencilRenderTarget() const { - return mCachedDepthStencilRenderTarget; + return mRenderTargetCache.getDepthStencil(); } RenderTarget11 *getFirstRenderTarget() const; - bool hasAnyInternalDirtyBit() const; - void syncInternalState(const gl::Context *context); - - // Observer implementation. - void onSubjectStateChange(const gl::Context *context, - angle::SubjectIndex index, - angle::SubjectMessage message) override; - gl::Error getSamplePosition(size_t index, GLfloat *xy) const override; private: @@ -89,19 +82,10 @@ class Framebuffer11 : public FramebufferD3D, public angle::ObserverInterface GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override; - void updateColorRenderTarget(const gl::Context *context, size_t colorIndex); - void updateDepthStencilRenderTarget(const gl::Context *context); - Renderer11 *const mRenderer; - RenderTargetArray mCachedColorRenderTargets; - RenderTarget11 *mCachedDepthStencilRenderTarget; - - std::vector mColorRenderTargetsDirty; - angle::ObserverBinding mDepthStencilRenderTargetDirty; - - gl::Framebuffer::DirtyBits mInternalDirtyBits; + RenderTargetCache mRenderTargetCache; }; -} +} // namespace rx #endif // LIBANGLE_RENDERER_D3D_D3D11_FRAMBUFFER11_H_ diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp index d06518054e12..affdd638e1b0 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.cpp @@ -228,7 +228,7 @@ void Image11::disassociateStorage() } } -bool Image11::redefine(GLenum target, +bool Image11::redefine(gl::TextureType type, GLenum internalformat, const gl::Extents &size, bool forceRelease) @@ -245,7 +245,7 @@ bool Image11::redefine(GLenum target, mHeight = size.height; mDepth = size.depth; mInternalFormat = internalformat; - mTarget = target; + mType = type; // compute the d3d format that will be used const d3d11::Format &formatInfo = @@ -281,17 +281,17 @@ gl::Error Image11::loadData(const gl::Context *context, const void *input, bool applySkipImages) { - const gl::InternalFormat &packFormat = gl::GetPackFormatInfo(mInternalFormat, type); + const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat); GLuint inputRowPitch = 0; ANGLE_TRY_RESULT( - packFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength), + formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength), inputRowPitch); GLuint inputDepthPitch = 0; - ANGLE_TRY_RESULT(packFormat.computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch), + ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, unpack.imageHeight, inputRowPitch), inputDepthPitch); GLuint inputSkipBytes = 0; ANGLE_TRY_RESULT( - packFormat.computeSkipBytes(inputRowPitch, inputDepthPitch, unpack, applySkipImages), + formatInfo.computeSkipBytes(type, inputRowPitch, inputDepthPitch, unpack, applySkipImages), inputSkipBytes); const d3d11::DXGIFormatSize &dxgiFormatInfo = d3d11::GetDXGIFormatSizeInfo(mDXGIFormat); @@ -322,7 +322,7 @@ gl::Error Image11::loadCompressedData(const gl::Context *context, { const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat); GLsizei inputRowPitch = 0; - ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch); + ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch); GLsizei inputDepthPitch = 0; ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputRowPitch), inputDepthPitch); @@ -540,76 +540,82 @@ gl::Error Image11::createStagingTexture() // adjust size if needed for compressed textures d3d11::MakeValidSize(false, dxgiFormat, &width, &height, &lodOffset); - if (mTarget == GL_TEXTURE_3D) + switch (mType) { - D3D11_TEXTURE3D_DESC desc; - desc.Width = width; - desc.Height = height; - desc.Depth = mDepth; - desc.MipLevels = lodOffset + 1; - desc.Format = dxgiFormat; - desc.Usage = D3D11_USAGE_STAGING; - desc.BindFlags = 0; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; - desc.MiscFlags = 0; - - if (formatInfo.dataInitializerFunction != nullptr) + case gl::TextureType::_3D: { - std::vector initialData; - std::vector> textureData; - d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(), - width, height, mDepth, lodOffset + 1, &initialData, - &textureData); + D3D11_TEXTURE3D_DESC desc; + desc.Width = width; + desc.Height = height; + desc.Depth = mDepth; + desc.MipLevels = lodOffset + 1; + desc.Format = dxgiFormat; + desc.Usage = D3D11_USAGE_STAGING; + desc.BindFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; - ANGLE_TRY( - mRenderer->allocateTexture(desc, formatInfo, initialData.data(), &mStagingTexture)); + if (formatInfo.dataInitializerFunction != nullptr) + { + std::vector initialData; + std::vector> textureData; + d3d11::GenerateInitialTextureData( + mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height, mDepth, + lodOffset + 1, &initialData, &textureData); + + ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, initialData.data(), + &mStagingTexture)); + } + else + { + ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture)); + } + + mStagingTexture.setDebugName("Image11::StagingTexture3D"); + mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1); } - else + break; + + case gl::TextureType::_2D: + case gl::TextureType::_2DArray: + case gl::TextureType::CubeMap: { - ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture)); + D3D11_TEXTURE2D_DESC desc; + desc.Width = width; + desc.Height = height; + desc.MipLevels = lodOffset + 1; + desc.ArraySize = 1; + desc.Format = dxgiFormat; + desc.SampleDesc.Count = 1; + desc.SampleDesc.Quality = 0; + desc.Usage = D3D11_USAGE_STAGING; + desc.BindFlags = 0; + desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; + desc.MiscFlags = 0; + + if (formatInfo.dataInitializerFunction != nullptr) + { + std::vector initialData; + std::vector> textureData; + d3d11::GenerateInitialTextureData( + mInternalFormat, mRenderer->getRenderer11DeviceCaps(), width, height, 1, + lodOffset + 1, &initialData, &textureData); + + ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, initialData.data(), + &mStagingTexture)); + } + else + { + ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture)); + } + + mStagingTexture.setDebugName("Image11::StagingTexture2D"); + mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1); } + break; - mStagingTexture.setDebugName("Image11::StagingTexture3D"); - mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1); - } - else if (mTarget == GL_TEXTURE_2D || mTarget == GL_TEXTURE_2D_ARRAY || - mTarget == GL_TEXTURE_CUBE_MAP) - { - D3D11_TEXTURE2D_DESC desc; - desc.Width = width; - desc.Height = height; - desc.MipLevels = lodOffset + 1; - desc.ArraySize = 1; - desc.Format = dxgiFormat; - desc.SampleDesc.Count = 1; - desc.SampleDesc.Quality = 0; - desc.Usage = D3D11_USAGE_STAGING; - desc.BindFlags = 0; - desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE; - desc.MiscFlags = 0; - - if (formatInfo.dataInitializerFunction != nullptr) - { - std::vector initialData; - std::vector> textureData; - d3d11::GenerateInitialTextureData(mInternalFormat, mRenderer->getRenderer11DeviceCaps(), - width, height, 1, lodOffset + 1, &initialData, - &textureData); - - ANGLE_TRY( - mRenderer->allocateTexture(desc, formatInfo, initialData.data(), &mStagingTexture)); - } - else - { - ANGLE_TRY(mRenderer->allocateTexture(desc, formatInfo, &mStagingTexture)); - } - - mStagingTexture.setDebugName("Image11::StagingTexture2D"); - mStagingSubresource = D3D11CalcSubresource(lodOffset, 0, lodOffset + 1); - } - else - { - UNREACHABLE(); + default: + UNREACHABLE(); } mDirty = false; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h index 584d231b37aa..268582e2a077 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Image11.h @@ -54,7 +54,10 @@ class Image11 : public ImageD3D const gl::ImageIndex &index, const gl::Box ®ion) override; - bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) override; + bool redefine(gl::TextureType type, + GLenum internalformat, + const gl::Extents &size, + bool forceRelease) override; DXGI_FORMAT getDXGIFormat() const; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp index 274191612f8a..f8f8865d087c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.cpp @@ -18,12 +18,10 @@ #include "libANGLE/renderer/d3d/IndexDataManager.h" #include "libANGLE/renderer/d3d/ProgramD3D.h" #include "libANGLE/renderer/d3d/VertexDataManager.h" -#include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Context11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/ShaderExecutable11.h" #include "libANGLE/renderer/d3d/d3d11/VertexArray11.h" -#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h" #include "libANGLE/renderer/d3d/d3d11/formatutils11.h" namespace rx @@ -32,11 +30,6 @@ namespace rx namespace { -size_t GetReservedBufferCount(bool usesPointSpriteEmulation) -{ - return usesPointSpriteEmulation ? 1 : 0; -} - GLenum GetGLSLAttributeType(const std::vector &shaderAttributes, size_t index) { // Count matrices differently @@ -106,8 +99,7 @@ bool PackedAttributeLayout::operator==(const PackedAttributeLayout &other) const (attributeData == other.attributeData); } -InputLayoutCache::InputLayoutCache() - : mLayoutCache(kDefaultCacheSize * 2), mPointSpriteVertexBuffer(), mPointSpriteIndexBuffer() +InputLayoutCache::InputLayoutCache() : mLayoutCache(kDefaultCacheSize * 2) { } @@ -118,198 +110,15 @@ InputLayoutCache::~InputLayoutCache() void InputLayoutCache::clear() { mLayoutCache.Clear(); - mPointSpriteVertexBuffer.reset(); - mPointSpriteIndexBuffer.reset(); } -gl::Error InputLayoutCache::applyVertexBuffers( - const gl::Context *context, - const std::vector ¤tAttributes, - GLenum mode, - GLint start, - bool isIndexedRendering) -{ - Renderer11 *renderer = GetImplAs(context)->getRenderer(); - const gl::State &state = context->getGLState(); - auto *stateManager = renderer->getStateManager(); - gl::Program *program = state.getProgram(); - ProgramD3D *programD3D = GetImplAs(program); - - bool programUsesInstancedPointSprites = programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation(); - bool instancedPointSpritesActive = programUsesInstancedPointSprites && (mode == GL_POINTS); - - // Note that if we use instance emulation, we reserve the first buffer slot. - size_t reservedBuffers = GetReservedBufferCount(programUsesInstancedPointSprites); - - for (size_t attribIndex = 0; attribIndex < (gl::MAX_VERTEX_ATTRIBS - reservedBuffers); - ++attribIndex) - { - ID3D11Buffer *buffer = nullptr; - UINT vertexStride = 0; - UINT vertexOffset = 0; - - if (attribIndex < currentAttributes.size()) - { - const auto &attrib = *currentAttributes[attribIndex]; - Buffer11 *bufferStorage = attrib.storage ? GetAs(attrib.storage) : nullptr; - - // If indexed pointsprite emulation is active, then we need to take a less efficent code path. - // Emulated indexed pointsprite rendering requires that the vertex buffers match exactly to - // the indices passed by the caller. This could expand or shrink the vertex buffer depending - // on the number of points indicated by the index list or how many duplicates are found on the index list. - if (bufferStorage == nullptr) - { - ASSERT(attrib.vertexBuffer.get()); - buffer = GetAs(attrib.vertexBuffer.get())->getBuffer().get(); - } - else if (instancedPointSpritesActive && isIndexedRendering) - { - VertexArray11 *vao11 = GetImplAs(state.getVertexArray()); - ASSERT(vao11->isCachedIndexInfoValid()); - TranslatedIndexData *indexInfo = vao11->getCachedIndexInfo(); - if (indexInfo->srcIndexData.srcBuffer != nullptr) - { - const uint8_t *bufferData = nullptr; - ANGLE_TRY(indexInfo->srcIndexData.srcBuffer->getData(context, &bufferData)); - ASSERT(bufferData != nullptr); - - ptrdiff_t offset = - reinterpret_cast(indexInfo->srcIndexData.srcIndices); - indexInfo->srcIndexData.srcBuffer = nullptr; - indexInfo->srcIndexData.srcIndices = bufferData + offset; - } - - ANGLE_TRY_RESULT(bufferStorage->getEmulatedIndexedBuffer( - context, &indexInfo->srcIndexData, attrib, start), - buffer); - } - else - { - ANGLE_TRY_RESULT( - bufferStorage->getBuffer(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK), - buffer); - } - - vertexStride = attrib.stride; - ANGLE_TRY_RESULT(attrib.computeOffset(start), vertexOffset); - } - - size_t bufferIndex = reservedBuffers + attribIndex; - - stateManager->queueVertexBufferChange(bufferIndex, buffer, vertexStride, vertexOffset); - } - - // Instanced PointSprite emulation requires two additional ID3D11Buffers. A vertex buffer needs - // to be created and added to the list of current buffers, strides and offsets collections. - // This buffer contains the vertices for a single PointSprite quad. - // An index buffer also needs to be created and applied because rendering instanced data on - // D3D11 FL9_3 requires DrawIndexedInstanced() to be used. Shaders that contain gl_PointSize and - // used without the GL_POINTS rendering mode require a vertex buffer because some drivers cannot - // handle missing vertex data and will TDR the system. - if (programUsesInstancedPointSprites) - { - const UINT pointSpriteVertexStride = sizeof(float) * 5; - - if (!mPointSpriteVertexBuffer.valid()) - { - static const float pointSpriteVertices[] = - { - // Position // TexCoord - -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, - -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, - 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, - 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, - -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, - 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, - }; - - D3D11_SUBRESOURCE_DATA vertexBufferData = { pointSpriteVertices, 0, 0 }; - D3D11_BUFFER_DESC vertexBufferDesc; - vertexBufferDesc.ByteWidth = sizeof(pointSpriteVertices); - vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; - vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE; - vertexBufferDesc.CPUAccessFlags = 0; - vertexBufferDesc.MiscFlags = 0; - vertexBufferDesc.StructureByteStride = 0; - - ANGLE_TRY(renderer->allocateResource(vertexBufferDesc, &vertexBufferData, - &mPointSpriteVertexBuffer)); - } - - // Set the stride to 0 if GL_POINTS mode is not being used to instruct the driver to avoid - // indexing into the vertex buffer. - UINT stride = instancedPointSpritesActive ? pointSpriteVertexStride : 0; - stateManager->queueVertexBufferChange(0, mPointSpriteVertexBuffer.get(), stride, 0); - - if (!mPointSpriteIndexBuffer.valid()) - { - // Create an index buffer and set it for pointsprite rendering - static const unsigned short pointSpriteIndices[] = - { - 0, 1, 2, 3, 4, 5, - }; - - D3D11_SUBRESOURCE_DATA indexBufferData = { pointSpriteIndices, 0, 0 }; - D3D11_BUFFER_DESC indexBufferDesc; - indexBufferDesc.ByteWidth = sizeof(pointSpriteIndices); - indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; - indexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE; - indexBufferDesc.CPUAccessFlags = 0; - indexBufferDesc.MiscFlags = 0; - indexBufferDesc.StructureByteStride = 0; - - ANGLE_TRY(renderer->allocateResource(indexBufferDesc, &indexBufferData, - &mPointSpriteIndexBuffer)); - } - - if (instancedPointSpritesActive) - { - // The index buffer is applied here because Instanced PointSprite emulation uses the a - // non-indexed rendering path in ANGLE (DrawArrays). This means that applyIndexBuffer() - // on the renderer will not be called and setting this buffer here ensures that the - // rendering path will contain the correct index buffers. - stateManager->setIndexBuffer(mPointSpriteIndexBuffer.get(), DXGI_FORMAT_R16_UINT, 0); - } - } - - stateManager->applyVertexBufferChanges(); - return gl::NoError(); -} - -gl::Error InputLayoutCache::updateVertexOffsetsForPointSpritesEmulation( - Renderer11 *renderer, - const std::vector ¤tAttributes, - GLint startVertex, - GLsizei emulatedInstanceId) -{ - auto *stateManager = renderer->getStateManager(); - - size_t reservedBuffers = GetReservedBufferCount(true); - for (size_t attribIndex = 0; attribIndex < currentAttributes.size(); ++attribIndex) - { - const auto &attrib = *currentAttributes[attribIndex]; - size_t bufferIndex = reservedBuffers + attribIndex; - - if (attrib.divisor > 0) - { - unsigned int offset = 0; - ANGLE_TRY_RESULT(attrib.computeOffset(startVertex), offset); - offset += (attrib.stride * (emulatedInstanceId / attrib.divisor)); - stateManager->queueVertexOffsetChange(bufferIndex, offset); - } - } - - stateManager->applyVertexBufferChanges(); - return gl::NoError(); -} - -gl::Error InputLayoutCache::updateInputLayout( +gl::Error InputLayoutCache::getInputLayout( Renderer11 *renderer, const gl::State &state, const std::vector ¤tAttributes, - GLenum mode, const AttribIndexArray &sortedSemanticIndices, - const DrawCallVertexParams &vertexParams) + const gl::DrawCallParams &drawCallParams, + const d3d11::InputLayout **inputLayoutOut) { gl::Program *program = state.getProgram(); const auto &shaderAttributes = program->getAttributes(); @@ -318,7 +127,8 @@ gl::Error InputLayoutCache::updateInputLayout( ProgramD3D *programD3D = GetImplAs(program); bool programUsesInstancedPointSprites = programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation(); - bool instancedPointSpritesActive = programUsesInstancedPointSprites && (mode == GL_POINTS); + bool instancedPointSpritesActive = + programUsesInstancedPointSprites && (drawCallParams.mode() == GL_POINTS); if (programUsesInstancedPointSprites) { @@ -330,7 +140,7 @@ gl::Error InputLayoutCache::updateInputLayout( layout.flags |= PackedAttributeLayout::FLAG_INSTANCED_SPRITES_ACTIVE; } - if (vertexParams.instances() > 0) + if (drawCallParams.instances() > 0) { layout.flags |= PackedAttributeLayout::FLAG_INSTANCED_RENDERING_ACTIVE; } @@ -358,28 +168,26 @@ gl::Error InputLayoutCache::updateInputLayout( binding.getDivisor() * divisorMultiplier); } - const d3d11::InputLayout *inputLayout = nullptr; if (layout.numAttributes > 0 || layout.flags != 0) { auto it = mLayoutCache.Get(layout); if (it != mLayoutCache.end()) { - inputLayout = &it->second; + *inputLayoutOut = &it->second; } else { angle::TrimCache(mLayoutCache.max_size() / 2, kGCLimit, "input layout", &mLayoutCache); d3d11::InputLayout newInputLayout; - ANGLE_TRY(createInputLayout(renderer, sortedSemanticIndices, currentAttributes, mode, - program, vertexParams, &newInputLayout)); + ANGLE_TRY(createInputLayout(renderer, sortedSemanticIndices, currentAttributes, program, + drawCallParams, &newInputLayout)); auto insertIt = mLayoutCache.Put(layout, std::move(newInputLayout)); - inputLayout = &insertIt->second; + *inputLayoutOut = &insertIt->second; } } - renderer->getStateManager()->setInputLayout(inputLayout); return gl::NoError(); } @@ -387,9 +195,8 @@ gl::Error InputLayoutCache::createInputLayout( Renderer11 *renderer, const AttribIndexArray &sortedSemanticIndices, const std::vector ¤tAttributes, - GLenum mode, gl::Program *program, - const DrawCallVertexParams &vertexParams, + const gl::DrawCallParams &drawCallParams, d3d11::InputLayout *inputLayoutOut) { ProgramD3D *programD3D = GetImplAs(program); @@ -439,18 +246,19 @@ gl::Error InputLayoutCache::createInputLayout( // As per the spec for ANGLE_instanced_arrays, not all attributes can be instanced // simultaneously, so a non-instanced element must exist. - GLsizei numIndicesPerInstance = 0; - if (vertexParams.instances() > 0) + UINT numIndicesPerInstance = 0; + if (drawCallParams.instances() > 0) { - // This may trigger an evaluation of the index range. - numIndicesPerInstance = vertexParams.vertexCount(); + // This requires that the index range is resolved. + // Note: Vertex indexes can be arbitrarily large. + numIndicesPerInstance = drawCallParams.getClampedVertexCount(); } for (size_t elementIndex = 0; elementIndex < inputElementCount; ++elementIndex) { // If rendering points and instanced pointsprite emulation is being used, the // inputClass is required to be configured as per instance data - if (mode == GL_POINTS) + if (drawCallParams.mode() == GL_POINTS) { inputElements[elementIndex].InputSlotClass = D3D11_INPUT_PER_INSTANCE_DATA; inputElements[elementIndex].InstanceDataStepRate = 1; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h index 24365d3ccd5e..73402c6fd90b 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/InputLayoutCache.h @@ -27,7 +27,6 @@ namespace rx { -class DrawCallVertexParams; struct PackedAttributeLayout { PackedAttributeLayout(); @@ -86,35 +85,22 @@ class InputLayoutCache : angle::NonCopyable void clear(); - gl::Error applyVertexBuffers(const gl::Context *context, - const std::vector ¤tAttributes, - GLenum mode, - GLint start, - bool isIndexedRendering); - - gl::Error updateVertexOffsetsForPointSpritesEmulation( - Renderer11 *renderer, - const std::vector ¤tAttributes, - GLint startVertex, - GLsizei emulatedInstanceId); - // Useful for testing void setCacheSize(size_t newCacheSize); - gl::Error updateInputLayout(Renderer11 *renderer, - const gl::State &state, - const std::vector ¤tAttributes, - GLenum mode, - const AttribIndexArray &sortedSemanticIndices, - const DrawCallVertexParams &vertexParams); + gl::Error getInputLayout(Renderer11 *renderer, + const gl::State &state, + const std::vector ¤tAttributes, + const AttribIndexArray &sortedSemanticIndices, + const gl::DrawCallParams &drawCallParams, + const d3d11::InputLayout **inputLayoutOut); private: gl::Error createInputLayout(Renderer11 *renderer, const AttribIndexArray &sortedSemanticIndices, const std::vector ¤tAttributes, - GLenum mode, gl::Program *program, - const DrawCallVertexParams &vertexParams, + const gl::DrawCallParams &drawCallParams, d3d11::InputLayout *inputLayoutOut); // Starting cache size. @@ -125,9 +111,6 @@ class InputLayoutCache : angle::NonCopyable using LayoutCache = angle::base::HashingMRUCache; LayoutCache mLayoutCache; - - d3d11::Buffer mPointSpriteVertexBuffer; - d3d11::Buffer mPointSpriteIndexBuffer; }; } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp index e2487facc9c9..bcde8cca9720 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/PixelTransfer11.cpp @@ -191,7 +191,7 @@ gl::Error PixelTransfer11::copyBufferToTexture(const gl::Context *context, StateManager11 *stateManager = mRenderer->getStateManager(); stateManager->setDrawShaders(&mBufferToTextureVS, geometryShader, pixelShader); - stateManager->setShaderResource(gl::SHADER_FRAGMENT, 0, bufferSRV); + stateManager->setShaderResource(gl::ShaderType::Fragment, 0, bufferSRV); stateManager->setInputLayout(nullptr); stateManager->setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp index f16fc84cede8..8db47e05638b 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.cpp @@ -200,15 +200,6 @@ RenderTarget11::RenderTarget11(const d3d11::Format &formatSet) : mFormatSet(form RenderTarget11::~RenderTarget11() { - ASSERT(!hasObservers()); -} - -void RenderTarget11::signalDirty(const gl::Context *context) -{ - onStateChange(context, angle::SubjectMessage::STATE_CHANGE); - - // Clear the list. We can't do this in the receiver because it would mutate during iteration. - resetObservers(); } TextureRenderTarget11::TextureRenderTarget11(d3d11::RenderTargetView &&rtv, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h index 66930c45a1a9..1ed34223e65c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/RenderTarget11.h @@ -20,7 +20,7 @@ namespace rx class SwapChain11; class Renderer11; -class RenderTarget11 : public RenderTargetD3D, public angle::Subject +class RenderTarget11 : public RenderTargetD3D { public: RenderTarget11(const d3d11::Format &formatSet); @@ -34,8 +34,6 @@ class RenderTarget11 : public RenderTargetD3D, public angle::Subject virtual unsigned int getSubresourceIndex() const = 0; - void signalDirty(const gl::Context *context) override; - const d3d11::Format &getFormatSet() const { return mFormatSet; } protected: diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp index c9ff9252d7e7..cd11543216a7 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp @@ -352,29 +352,6 @@ void GetTriFanIndices(const void *indices, } } -bool DrawCallNeedsTranslation(const gl::Context *context, GLenum mode) -{ - const auto &glState = context->getGLState(); - const gl::VertexArray *vertexArray = glState.getVertexArray(); - VertexArray11 *vertexArray11 = GetImplAs(vertexArray); - // Direct drawing doesn't support dynamic attribute storage since it needs the first and count - // to translate when applyVertexBuffer. GL_LINE_LOOP and GL_TRIANGLE_FAN are not supported - // either since we need to simulate them in D3D. - if (vertexArray11->hasActiveDynamicAttrib(context) || mode == GL_LINE_LOOP || - mode == GL_TRIANGLE_FAN) - { - return true; - } - - ProgramD3D *programD3D = GetImplAs(glState.getProgram()); - if (InstancedPointSpritesActive(programD3D, mode)) - { - return true; - } - - return false; -} - bool IsArrayRTV(ID3D11RenderTargetView *rtv) { D3D11_RENDER_TARGET_VIEW_DESC desc; @@ -430,12 +407,6 @@ void PopulateFormatDeviceCaps(ID3D11Device *device, } } -bool CullsEverything(const gl::State &glState) -{ - return (glState.getRasterizerState().cullFace && - glState.getRasterizerState().cullMode == gl::CullFaceMode::FrontAndBack); -} - } // anonymous namespace Renderer11DeviceCaps::Renderer11DeviceCaps() = default; @@ -1427,92 +1398,14 @@ void *Renderer11::getD3DDevice() return reinterpret_cast(mDevice); } -bool Renderer11::applyPrimitiveType(const gl::State &glState, GLenum mode, GLsizei count) +gl::Error Renderer11::drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms) { - D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_UNDEFINED; - - GLsizei minCount = 0; - - switch (mode) - { - case GL_POINTS: - { - bool usesPointSize = GetImplAs(glState.getProgram())->usesPointSize(); - - // ProgramBinary assumes non-point rendering if gl_PointSize isn't written, - // which affects varying interpolation. Since the value of gl_PointSize is - // undefined when not written, just skip drawing to avoid unexpected results. - if (!usesPointSize && !glState.isTransformFeedbackActiveUnpaused()) - { - // Notify developers of risking undefined behavior. - WARN() << "Point rendering without writing to gl_PointSize."; - return false; - } - - // If instanced pointsprites are enabled and the shader uses gl_PointSize, the topology - // must be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. - if (usesPointSize && getWorkarounds().useInstancedPointSpriteEmulation) - { - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - } - else - { - primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; - } - minCount = 1; - break; - } - case GL_LINES: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST; - minCount = 2; - break; - case GL_LINE_LOOP: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; - minCount = 2; - break; - case GL_LINE_STRIP: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; - minCount = 2; - break; - case GL_TRIANGLES: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - minCount = CullsEverything(glState) ? std::numeric_limits::max() : 3; - break; - case GL_TRIANGLE_STRIP: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; - minCount = CullsEverything(glState) ? std::numeric_limits::max() : 3; - break; - // emulate fans via rewriting index buffer - case GL_TRIANGLE_FAN: - primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; - minCount = CullsEverything(glState) ? std::numeric_limits::max() : 3; - break; - default: - UNREACHABLE(); - return false; - } - - mStateManager.setPrimitiveTopology(primitiveTopology); - - return count >= minCount; -} - -gl::Error Renderer11::drawArrays(const gl::Context *context, - GLenum mode, - GLint startVertex, - GLsizei count, - GLsizei instances) -{ - const auto &glState = context->getGLState(); - - if (!applyPrimitiveType(glState, mode, count)) + if (params.vertexCount() < static_cast(mStateManager.getCurrentMinimumDrawCount())) { return gl::NoError(); } - DrawCallVertexParams vertexParams(startVertex, count, instances); - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false)); - + const auto &glState = context->getGLState(); if (glState.isTransformFeedbackActiveUnpaused()) { ANGLE_TRY(markTransformFeedbackUsage(context)); @@ -1520,10 +1413,14 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, gl::Program *program = glState.getProgram(); ASSERT(program != nullptr); - GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, instances); + GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, params.instances()); ProgramD3D *programD3D = GetImplAs(program); - if (programD3D->usesGeometryShader(mode) && glState.isTransformFeedbackActiveUnpaused()) + // Note: vertex indexes can be arbitrarily large. + UINT clampedVertexCount = params.getClampedVertexCount(); + + if (programD3D->usesGeometryShader(params.mode()) && + glState.isTransformFeedbackActiveUnpaused()) { // Since we use a geometry if-and-only-if we rewrite vertex streams, transform feedback // won't get the correct output. To work around this, draw with *only* the stream out @@ -1533,11 +1430,11 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, if (adjustedInstanceCount > 0) { - mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0); + mDeviceContext->DrawInstanced(clampedVertexCount, adjustedInstanceCount, 0, 0); } else { - mDeviceContext->Draw(count, 0); + mDeviceContext->Draw(clampedVertexCount, 0); } rx::ShaderExecutableD3D *pixelExe = nullptr; @@ -1553,45 +1450,47 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, // Retrieve the geometry shader. rx::ShaderExecutableD3D *geometryExe = nullptr; - ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, mode, &geometryExe, - nullptr)); + ANGLE_TRY(programD3D->getGeometryExecutableForPrimitiveType(context, params.mode(), + &geometryExe, nullptr)); mStateManager.setGeometryShader( &GetAs(geometryExe)->getGeometryShader()); if (adjustedInstanceCount > 0) { - mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0); + mDeviceContext->DrawInstanced(clampedVertexCount, adjustedInstanceCount, 0, 0); } else { - mDeviceContext->Draw(count, 0); + mDeviceContext->Draw(clampedVertexCount, 0); } return gl::NoError(); } - if (mode == GL_LINE_LOOP) + if (params.mode() == GL_LINE_LOOP) { - return drawLineLoop(context, count, GL_NONE, nullptr, 0, adjustedInstanceCount); + return drawLineLoop(context, clampedVertexCount, GL_NONE, nullptr, 0, + adjustedInstanceCount); } - if (mode == GL_TRIANGLE_FAN) + if (params.mode() == GL_TRIANGLE_FAN) { - return drawTriangleFan(context, count, GL_NONE, nullptr, 0, adjustedInstanceCount); + return drawTriangleFan(context, clampedVertexCount, GL_NONE, nullptr, 0, + adjustedInstanceCount); } bool useInstancedPointSpriteEmulation = programD3D->usesPointSize() && getWorkarounds().useInstancedPointSpriteEmulation; - if (mode != GL_POINTS || !useInstancedPointSpriteEmulation) + if (params.mode() != GL_POINTS || !useInstancedPointSpriteEmulation) { if (adjustedInstanceCount == 0) { - mDeviceContext->Draw(count, 0); + mDeviceContext->Draw(clampedVertexCount, 0); } else { - mDeviceContext->DrawInstanced(count, adjustedInstanceCount, 0, 0); + mDeviceContext->DrawInstanced(clampedVertexCount, adjustedInstanceCount, 0, 0); } return gl::NoError(); } @@ -1604,7 +1503,7 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, // D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST and DrawIndexedInstanced is called instead. if (adjustedInstanceCount == 0) { - mDeviceContext->DrawIndexedInstanced(6, count, 0, 0, 0); + mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0); return gl::NoError(); } @@ -1613,10 +1512,11 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, // batch of points. An offset into the instanced data buffer is calculated and applied on each // iteration to ensure all instances are rendered correctly. Each instance being rendered // requires the inputlayout cache to reapply buffers and offsets. - for (GLsizei i = 0; i < instances; i++) + for (GLsizei i = 0; i < params.instances(); i++) { - ANGLE_TRY(mStateManager.updateVertexOffsetsForPointSpritesEmulation(startVertex, i)); - mDeviceContext->DrawIndexedInstanced(6, count, 0, 0, 0); + ANGLE_TRY( + mStateManager.updateVertexOffsetsForPointSpritesEmulation(params.baseVertex(), i)); + mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0); } // This required by updateVertexOffsets... above but is outside of the loop for speed. @@ -1624,61 +1524,50 @@ gl::Error Renderer11::drawArrays(const gl::Context *context, return gl::NoError(); } -gl::Error Renderer11::drawElements(const gl::Context *context, - GLenum mode, - GLsizei count, - GLenum type, - const void *indices, - GLsizei instances) +gl::Error Renderer11::drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms) { - const auto &glState = context->getGLState(); - - if (!applyPrimitiveType(glState, mode, count)) + if (params.indexCount() < mStateManager.getCurrentMinimumDrawCount()) { return gl::NoError(); } // Transform feedback is not allowed for DrawElements, this error should have been caught at the // API validation layer. + const auto &glState = context->getGLState(); ASSERT(!glState.isTransformFeedbackActiveUnpaused()); - const auto &lazyIndexRange = context->getParams(); - - bool usePrimitiveRestartWorkaround = - UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), type); - DrawCallVertexParams vertexParams(!usePrimitiveRestartWorkaround, lazyIndexRange, 0, instances); - - ANGLE_TRY(mStateManager.applyIndexBuffer(context, indices, count, type, lazyIndexRange, - usePrimitiveRestartWorkaround)); - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true)); - - int startVertex = static_cast(vertexParams.firstVertex()); + // If this draw call is coming from an indirect call, offset by the indirect call's base vertex. + // No base vertex parameter exists for a normal drawElements, so params.baseVertex will be zero. + int startVertex = static_cast(params.firstVertex() - params.baseVertex()); int baseVertex = -startVertex; const gl::Program *program = glState.getProgram(); - GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, instances); + GLsizei adjustedInstanceCount = GetAdjustedInstanceCount(program, params.instances()); - if (mode == GL_LINE_LOOP) + if (params.mode() == GL_LINE_LOOP) { - return drawLineLoop(context, count, type, indices, baseVertex, adjustedInstanceCount); + return drawLineLoop(context, params.indexCount(), params.type(), params.indices(), + baseVertex, adjustedInstanceCount); } - if (mode == GL_TRIANGLE_FAN) + if (params.mode() == GL_TRIANGLE_FAN) { - return drawTriangleFan(context, count, type, indices, baseVertex, adjustedInstanceCount); + return drawTriangleFan(context, params.indexCount(), params.type(), params.indices(), + baseVertex, adjustedInstanceCount); } const ProgramD3D *programD3D = GetImplAs(glState.getProgram()); - if (mode != GL_POINTS || !programD3D->usesInstancedPointSpriteEmulation()) + if (params.mode() != GL_POINTS || !programD3D->usesInstancedPointSpriteEmulation()) { if (adjustedInstanceCount == 0) { - mDeviceContext->DrawIndexed(count, 0, baseVertex); + mDeviceContext->DrawIndexed(params.indexCount(), 0, baseVertex); } else { - mDeviceContext->DrawIndexedInstanced(count, adjustedInstanceCount, 0, baseVertex, 0); + mDeviceContext->DrawIndexedInstanced(params.indexCount(), adjustedInstanceCount, 0, + baseVertex, 0); } return gl::NoError(); } @@ -1696,9 +1585,9 @@ gl::Error Renderer11::drawElements(const gl::Context *context, // Indexed pointsprite emulation replicates data for duplicate entries found in the index // buffer. This is not an efficent rendering mechanism and is only used on downlevel renderers // that do not support geometry shaders. - if (instances == 0) + if (params.instances() == 0) { - mDeviceContext->DrawIndexedInstanced(6, count, 0, 0, 0); + mDeviceContext->DrawIndexedInstanced(6, params.indexCount(), 0, 0, 0); return gl::NoError(); } @@ -1706,146 +1595,65 @@ gl::Error Renderer11::drawElements(const gl::Context *context, // efficent code path. Instanced rendering of emulated pointsprites requires a loop to draw each // batch of points. An offset into the instanced data buffer is calculated and applied on each // iteration to ensure all instances are rendered correctly. - GLsizei elementsToRender = vertexParams.vertexCount(); + UINT clampedVertexCount = params.getClampedVertexCount(); // Each instance being rendered requires the inputlayout cache to reapply buffers and offsets. - for (GLsizei i = 0; i < instances; i++) + for (GLsizei i = 0; i < params.instances(); i++) { ANGLE_TRY(mStateManager.updateVertexOffsetsForPointSpritesEmulation(startVertex, i)); - mDeviceContext->DrawIndexedInstanced(6, elementsToRender, 0, 0, 0); + mDeviceContext->DrawIndexedInstanced(6, clampedVertexCount, 0, 0, 0); } mStateManager.invalidateVertexBuffer(); return gl::NoError(); } gl::Error Renderer11::drawArraysIndirect(const gl::Context *context, - GLenum mode, - const void *indirect) + const gl::DrawCallParams ¶ms) { - const auto &glState = context->getGLState(); - ASSERT(!glState.isTransformFeedbackActiveUnpaused()); - - if (!applyPrimitiveType(glState, mode, std::numeric_limits::max() - 1)) + if (std::numeric_limits::max() == mStateManager.getCurrentMinimumDrawCount()) { return gl::NoError(); } + const gl::State &glState = context->getGLState(); + ASSERT(!glState.isTransformFeedbackActiveUnpaused()); + gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect); ASSERT(drawIndirectBuffer); Buffer11 *storage = GetImplAs(drawIndirectBuffer); - uintptr_t offset = reinterpret_cast(indirect); - if (!DrawCallNeedsTranslation(context, mode)) - { - DrawCallVertexParams vertexParams(0, 0, 0); - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false)); - ID3D11Buffer *buffer = nullptr; - ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer); - mDeviceContext->DrawInstancedIndirect(buffer, static_cast(offset)); - return gl::NoError(); - } + uintptr_t offset = reinterpret_cast(params.indirect()); - const uint8_t *bufferData = nullptr; - ANGLE_TRY(storage->getData(context, &bufferData)); - ASSERT(bufferData); - const gl::DrawArraysIndirectCommand *args = - reinterpret_cast(bufferData + offset); - GLuint count = args->count; - GLuint instances = args->instanceCount; - GLuint first = args->first; - - DrawCallVertexParams vertexParams(first, count, instances); - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, false)); - - if (mode == GL_LINE_LOOP) - { - return drawLineLoop(context, count, GL_NONE, nullptr, 0, instances); - } - if (mode == GL_TRIANGLE_FAN) - { - return drawTriangleFan(context, count, GL_NONE, nullptr, 0, instances); - } - - mDeviceContext->DrawInstanced(count, instances, 0, 0); + ID3D11Buffer *buffer = nullptr; + ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer); + mDeviceContext->DrawInstancedIndirect(buffer, static_cast(offset)); return gl::NoError(); } gl::Error Renderer11::drawElementsIndirect(const gl::Context *context, - GLenum mode, - GLenum type, - const void *indirect) + const gl::DrawCallParams ¶ms) { - const auto &glState = context->getGLState(); - ASSERT(!glState.isTransformFeedbackActiveUnpaused()); - - if (!applyPrimitiveType(glState, mode, std::numeric_limits::max() - 1)) + if (std::numeric_limits::max() == mStateManager.getCurrentMinimumDrawCount()) { return gl::NoError(); } + const gl::State &glState = context->getGLState(); + ASSERT(!glState.isTransformFeedbackActiveUnpaused()); + gl::Buffer *drawIndirectBuffer = glState.getTargetBuffer(gl::BufferBinding::DrawIndirect); ASSERT(drawIndirectBuffer); Buffer11 *storage = GetImplAs(drawIndirectBuffer); - uintptr_t offset = reinterpret_cast(indirect); + uintptr_t offset = reinterpret_cast(params.indirect()); - // TODO(jmadill): Remove the if statement and compute indirect parameters lazily. - bool usePrimitiveRestartWorkaround = - UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), type); - - if (!DrawCallNeedsTranslation(context, mode) && !IsStreamingIndexData(context, type)) - { - ANGLE_TRY(mStateManager.applyIndexBuffer(context, nullptr, 0, type, gl::HasIndexRange(), - usePrimitiveRestartWorkaround)); - DrawCallVertexParams vertexParams(0, 0, 0); - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true)); - ID3D11Buffer *buffer = nullptr; - ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer); - mDeviceContext->DrawIndexedInstancedIndirect(buffer, static_cast(offset)); - return gl::NoError(); - } - - const uint8_t *bufferData = nullptr; - ANGLE_TRY(storage->getData(context, &bufferData)); - ASSERT(bufferData); - - const gl::DrawElementsIndirectCommand *cmd = - reinterpret_cast(bufferData + offset); - GLsizei count = cmd->count; - GLuint instances = cmd->primCount; - GLuint firstIndex = cmd->firstIndex; - GLint baseVertex = cmd->baseVertex; - - // TODO(jmadill): Fix const cast. - const gl::Type &typeInfo = gl::GetTypeInfo(type); - const void *indices = - reinterpret_cast(static_cast(firstIndex * typeInfo.bytes)); - gl::HasIndexRange lazyIndexRange(const_cast(context), count, type, indices); - - ANGLE_TRY(mStateManager.applyIndexBuffer(context, indices, count, type, lazyIndexRange, - usePrimitiveRestartWorkaround)); - - DrawCallVertexParams vertexParams(false, lazyIndexRange, baseVertex, instances); - - ANGLE_TRY(mStateManager.applyVertexBuffer(context, mode, vertexParams, true)); - - int baseVertexLocation = -static_cast(lazyIndexRange.getIndexRange().value().start); - - if (mode == GL_LINE_LOOP) - { - return drawLineLoop(context, count, type, indices, baseVertexLocation, instances); - } - - if (mode == GL_TRIANGLE_FAN) - { - return drawTriangleFan(context, count, type, indices, baseVertexLocation, instances); - } - - mDeviceContext->DrawIndexedInstanced(count, instances, 0, baseVertexLocation, 0); + ID3D11Buffer *buffer = nullptr; + ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDIRECT), buffer); + mDeviceContext->DrawIndexedInstancedIndirect(buffer, static_cast(offset)); return gl::NoError(); } gl::Error Renderer11::drawLineLoop(const gl::Context *context, - GLsizei count, + GLuint count, GLenum type, const void *indexPointer, int baseVertex, @@ -1882,8 +1690,6 @@ gl::Error Renderer11::drawLineLoop(const gl::Context *context, } // Checked by Renderer11::applyPrimitiveType - ASSERT(count >= 0); - if (static_cast(count) + 1 > (std::numeric_limits::max() / sizeof(unsigned int))) { @@ -1929,7 +1735,7 @@ gl::Error Renderer11::drawLineLoop(const gl::Context *context, } gl::Error Renderer11::drawTriangleFan(const gl::Context *context, - GLsizei count, + GLuint count, GLenum type, const void *indices, int baseVertex, @@ -2464,7 +2270,7 @@ gl::Error Renderer11::copyImageCube(const gl::Context *context, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level) { TextureStorage11_Cube *storage11 = GetAs(storage); @@ -2538,7 +2344,7 @@ gl::Error Renderer11::copyTexture(const gl::Context *context, GLenum destType, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -2557,7 +2363,7 @@ gl::Error Renderer11::copyTexture(const gl::Context *context, // Check for fast path where a CopySubresourceRegion can be used. if (unpackPremultiplyAlpha == unpackUnmultiplyAlpha && !unpackFlipY && - source->getFormat(GL_TEXTURE_2D, sourceLevel).info->format == destFormat && + source->getFormat(gl::TextureTarget::_2D, sourceLevel).info->format == destFormat && sourceStorage11->getFormatSet().internalFormat == destStorage11->getFormatSet().internalFormat) { @@ -2601,9 +2407,11 @@ gl::Error Renderer11::copyTexture(const gl::Context *context, ASSERT(destRTV.valid()); gl::Box sourceArea(sourceRect.x, sourceRect.y, 0, sourceRect.width, sourceRect.height, 1); - gl::Extents sourceSize( - static_cast(source->getWidth(source->getTarget(), sourceLevel)), - static_cast(source->getHeight(source->getTarget(), sourceLevel)), 1); + gl::Extents sourceSize(static_cast(source->getWidth( + NonCubeTextureTypeToTarget(source->getType()), sourceLevel)), + static_cast(source->getHeight( + NonCubeTextureTypeToTarget(source->getType()), sourceLevel)), + 1); if (unpackFlipY) { sourceArea.y += sourceArea.height; @@ -2615,7 +2423,7 @@ gl::Error Renderer11::copyTexture(const gl::Context *context, // Use nearest filtering because source and destination are the same size for the direct // copy - GLenum sourceFormat = source->getFormat(GL_TEXTURE_2D, sourceLevel).info->format; + GLenum sourceFormat = source->getFormat(gl::TextureTarget::_2D, sourceLevel).info->format; ANGLE_TRY(mBlit->copyTexture(context, *sourceSRV, sourceArea, sourceSize, sourceFormat, destRTV, destArea, destSize, nullptr, destFormat, destType, GL_NEAREST, false, unpackPremultiplyAlpha, @@ -2713,6 +2521,7 @@ gl::Error Renderer11::createRenderTarget(int width, TextureHelper11 texture; ANGLE_TRY(allocateTexture(desc, formatInfo, &texture)); + texture.setDebugName("createRenderTarget.Texture"); d3d11::SharedSRV srv; d3d11::SharedSRV blitSRV; @@ -2726,6 +2535,7 @@ gl::Error Renderer11::createRenderTarget(int width, srvDesc.Texture2D.MipLevels = 1; ANGLE_TRY(allocateResource(srvDesc, texture.get(), &srv)); + srv.setDebugName("createRenderTarget.SRV"); if (formatInfo.blitSRVFormat != formatInfo.srvFormat) { @@ -2738,6 +2548,7 @@ gl::Error Renderer11::createRenderTarget(int width, blitSRVDesc.Texture2D.MipLevels = 1; ANGLE_TRY(allocateResource(blitSRVDesc, texture.get(), &blitSRV)); + blitSRV.setDebugName("createRenderTarget.BlitSRV"); } else { @@ -2756,6 +2567,7 @@ gl::Error Renderer11::createRenderTarget(int width, d3d11::DepthStencilView dsv; ANGLE_TRY(allocateResource(dsvDesc, texture.get(), &dsv)); + dsv.setDebugName("createRenderTarget.DSV"); *outRT = new TextureRenderTarget11(std::move(dsv), texture, srv, format, formatInfo, width, height, 1, supportedSamples); @@ -2770,6 +2582,7 @@ gl::Error Renderer11::createRenderTarget(int width, d3d11::RenderTargetView rtv; ANGLE_TRY(allocateResource(rtvDesc, texture.get(), &rtv)); + rtv.setDebugName("createRenderTarget.RTV"); if (formatInfo.dataInitializerFunction != nullptr) { @@ -2825,7 +2638,7 @@ gl::Error Renderer11::loadExecutable(const uint8_t *function, switch (type) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: { d3d11::VertexShader vertexShader; d3d11::GeometryShader streamOutShader; @@ -2856,21 +2669,21 @@ gl::Error Renderer11::loadExecutable(const uint8_t *function, std::move(streamOutShader)); } break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: { d3d11::PixelShader pixelShader; ANGLE_TRY(allocateResource(shaderData, &pixelShader)); *outExecutable = new ShaderExecutable11(function, length, std::move(pixelShader)); } break; - case gl::SHADER_GEOMETRY: + case gl::ShaderType::Geometry: { d3d11::GeometryShader geometryShader; ANGLE_TRY(allocateResource(shaderData, &geometryShader)); *outExecutable = new ShaderExecutable11(function, length, std::move(geometryShader)); } break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: { d3d11::ComputeShader computeShader; ANGLE_TRY(allocateResource(shaderData, &computeShader)); @@ -2897,16 +2710,16 @@ gl::Error Renderer11::compileToExecutable(gl::InfoLog &infoLog, switch (type) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: profileStream << "vs"; break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: profileStream << "ps"; break; - case gl::SHADER_GEOMETRY: + case gl::ShaderType::Geometry: profileStream << "gs"; break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: profileStream << "cs"; break; default: @@ -3244,6 +3057,7 @@ gl::Error Renderer11::readFromAttachment(const gl::Context *context, createStagingTexture(textureHelper.getTextureType(), textureHelper.getFormatSet(), safeSize, StagingAccess::READ), stagingHelper); + stagingHelper.setDebugName("readFromAttachment::stagingHelper"); TextureHelper11 resolvedTextureHelper; @@ -3268,6 +3082,7 @@ gl::Error Renderer11::readFromAttachment(const gl::Context *context, ANGLE_TRY( allocateTexture(resolveDesc, textureHelper.getFormatSet(), &resolvedTextureHelper)); + resolvedTextureHelper.setDebugName("readFromAttachment::resolvedTextureHelper"); mDeviceContext->ResolveSubresource(resolvedTextureHelper.get(), 0, textureHelper.get(), sourceSubResource, textureHelper.getFormat()); @@ -3784,7 +3599,7 @@ GLenum Renderer11::getVertexComponentType(gl::VertexFormatType vertexFormatType) gl::ErrorOrResult Renderer11::getVertexSpaceRequired( const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const { if (!attrib.enabled) @@ -3796,7 +3611,8 @@ gl::ErrorOrResult Renderer11::getVertexSpaceRequired( const unsigned int divisor = binding.getDivisor(); if (instances == 0 || divisor == 0) { - elementCount = count; + // This could be a clipped cast. + elementCount = gl::clampCast(count); } else { @@ -3804,6 +3620,8 @@ gl::ErrorOrResult Renderer11::getVertexSpaceRequired( elementCount = UnsignedCeilDivide(static_cast(instances), divisor); } + ASSERT(elementCount > 0); + gl::VertexFormatType formatType = gl::GetVertexFormatType(attrib); const D3D_FEATURE_LEVEL featureLevel = mRenderer11DeviceCaps.featureLevel; const d3d11::VertexFormat &vertexFormatInfo = diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h index 29672bd68259..48623ce17b5b 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.h @@ -148,8 +148,6 @@ class Renderer11 : public RendererD3D HANDLE shareHandle, const egl::AttributeMap &attribs) const override; - bool applyPrimitiveType(const gl::State &glState, GLenum mode, GLsizei count); - // lost device bool testDeviceLost() override; bool testDeviceResettable() override; @@ -182,7 +180,7 @@ class Renderer11 : public RendererD3D GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level) override; gl::Error copyImage3D(const gl::Context *context, const gl::Framebuffer *framebuffer, @@ -207,7 +205,7 @@ class Renderer11 : public RendererD3D GLenum destType, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -345,7 +343,7 @@ class Renderer11 : public RendererD3D // function. gl::ErrorOrResult getVertexSpaceRequired(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const override; gl::Error readFromAttachment(const gl::Context *context, @@ -380,24 +378,10 @@ class Renderer11 : public RendererD3D DeviceImpl *createEGLDevice() override; - gl::Error drawArrays(const gl::Context *context, - GLenum mode, - GLint startVertex, - GLsizei count, - GLsizei instances); - - gl::Error drawElements(const gl::Context *context, - GLenum mode, - GLsizei count, - GLenum type, - const void *indices, - GLsizei instances); - - gl::Error drawArraysIndirect(const gl::Context *context, GLenum mode, const void *indirect); - gl::Error drawElementsIndirect(const gl::Context *context, - GLenum mode, - GLenum type, - const void *indirect); + gl::Error drawArrays(const gl::Context *context, const gl::DrawCallParams ¶ms); + gl::Error drawElements(const gl::Context *context, const gl::DrawCallParams ¶ms); + gl::Error drawArraysIndirect(const gl::Context *context, const gl::DrawCallParams ¶ms); + gl::Error drawElementsIndirect(const gl::Context *context, const gl::DrawCallParams ¶ms); // Necessary hack for default framebuffers in D3D. FramebufferImpl *createDefaultFramebuffer(const gl::FramebufferState &state) override; @@ -477,13 +461,13 @@ class Renderer11 : public RendererD3D angle::WorkaroundsD3D generateWorkarounds() const override; gl::Error drawLineLoop(const gl::Context *context, - GLsizei count, + GLuint count, GLenum type, const void *indices, int baseVertex, int instances); gl::Error drawTriangleFan(const gl::Context *context, - GLsizei count, + GLuint count, GLenum type, const void *indices, int baseVertex, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp index 36cdb8c62f42..fa4060efc336 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.cpp @@ -9,6 +9,7 @@ #include "libANGLE/renderer/d3d/d3d11/StateManager11.h" #include "common/bitset_utils.h" +#include "common/mathutil.h" #include "common/utilities.h" #include "libANGLE/Context.h" #include "libANGLE/Query.h" @@ -24,6 +25,7 @@ #include "libANGLE/renderer/d3d/d3d11/TextureStorage11.h" #include "libANGLE/renderer/d3d/d3d11/TransformFeedback11.h" #include "libANGLE/renderer/d3d/d3d11/VertexArray11.h" +#include "libANGLE/renderer/d3d/d3d11/VertexBuffer11.h" namespace rx { @@ -33,7 +35,7 @@ namespace bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOURCE_VIEW_DESC desc) { unsigned mipLevel = index.mipIndex; - GLenum textureType = index.type; + gl::TextureType textureType = index.type; switch (desc.ViewDimension) { @@ -46,7 +48,7 @@ bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOUR unsigned mipMin = index.mipIndex; unsigned mipMax = INT_MAX; - return textureType == GL_TEXTURE_2D && + return textureType == gl::TextureType::_2D && gl::RangeUI(mipMin, mipMax) .intersects(gl::RangeUI(desc.Texture2D.MostDetailedMip, maxSrvMip)); } @@ -63,7 +65,8 @@ bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOUR unsigned maxSlice = desc.Texture2DArray.FirstArraySlice + desc.Texture2DArray.ArraySize; // Cube maps can be mapped to Texture2DArray SRVs - return (textureType == GL_TEXTURE_2D_ARRAY || textureType == GL_TEXTURE_CUBE_MAP) && + return (textureType == gl::TextureType::_2DArray || + textureType == gl::TextureType::CubeMap) && desc.Texture2DArray.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip && desc.Texture2DArray.FirstArraySlice <= static_cast(layerIndex) && static_cast(layerIndex) < maxSlice; @@ -75,7 +78,7 @@ bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOUR unsigned int maxSrvMip = desc.TextureCube.MipLevels + desc.TextureCube.MostDetailedMip; maxSrvMip = allLevels ? INT_MAX : maxSrvMip; - return textureType == GL_TEXTURE_CUBE_MAP && + return textureType == gl::TextureType::CubeMap && desc.TextureCube.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip; } @@ -85,8 +88,8 @@ bool ImageIndexConflictsWithSRV(const gl::ImageIndex &index, D3D11_SHADER_RESOUR unsigned int maxSrvMip = desc.Texture3D.MipLevels + desc.Texture3D.MostDetailedMip; maxSrvMip = allLevels ? INT_MAX : maxSrvMip; - return textureType == GL_TEXTURE_3D && desc.Texture3D.MostDetailedMip <= mipLevel && - mipLevel < maxSrvMip; + return textureType == gl::TextureType::_3D && + desc.Texture3D.MostDetailedMip <= mipLevel && mipLevel < maxSrvMip; } default: // We only handle the cases corresponding to valid image indexes @@ -178,6 +181,16 @@ void UpdateUniformBuffer(ID3D11DeviceContext *deviceContext, 0); } +size_t GetReservedBufferCount(bool usesPointSpriteEmulation) +{ + return usesPointSpriteEmulation ? 1 : 0; +} + +bool CullsEverything(const gl::State &glState) +{ + return (glState.getRasterizerState().cullFace && + glState.getRasterizerState().cullMode == gl::CullFaceMode::FrontAndBack); +} } // anonymous namespace // StateManager11::ViewCache Implementation. @@ -234,11 +247,11 @@ StateManager11::SRVCache *StateManager11::getSRVCache(gl::ShaderType shaderType) { switch (shaderType) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: return &mCurVertexSRVs; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: return &mCurPixelSRVs; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: return &mCurComputeSRVs; default: UNREACHABLE(); @@ -248,13 +261,9 @@ StateManager11::SRVCache *StateManager11::getSRVCache(gl::ShaderType shaderType) // ShaderConstants11 implementation ShaderConstants11::ShaderConstants11() - : mVertexDirty(true), - mPixelDirty(true), - mComputeDirty(true), - mNumActiveVSSamplers(0), - mNumActivePSSamplers(0), - mNumActiveCSSamplers(0) + : mNumActiveVSSamplers(0), mNumActivePSSamplers(0), mNumActiveCSSamplers(0) { + mShaderConstantsDirty.set(); } ShaderConstants11::~ShaderConstants11() @@ -272,11 +281,11 @@ size_t ShaderConstants11::getRequiredBufferSize(gl::ShaderType shaderType) const { switch (shaderType) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: return sizeof(Vertex) + mSamplerMetadataVS.size() * sizeof(SamplerMetadata); - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: return sizeof(Pixel) + mSamplerMetadataPS.size() * sizeof(SamplerMetadata); - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: return sizeof(Compute) + mSamplerMetadataCS.size() * sizeof(SamplerMetadata); default: UNREACHABLE(); @@ -286,9 +295,7 @@ size_t ShaderConstants11::getRequiredBufferSize(gl::ShaderType shaderType) const void ShaderConstants11::markDirty() { - mVertexDirty = true; - mPixelDirty = true; - mComputeDirty = true; + mShaderConstantsDirty.set(); mNumActiveVSSamplers = 0; mNumActivePSSamplers = 0; mNumActiveCSSamplers = 0; @@ -298,8 +305,10 @@ bool ShaderConstants11::updateSamplerMetadata(SamplerMetadata *data, const gl::T { bool dirty = false; unsigned int baseLevel = texture.getTextureState().getEffectiveBaseLevel(); - GLenum sizedFormat = - texture.getFormat(texture.getTarget(), baseLevel).info->sizedInternalFormat; + gl::TextureTarget target = (texture.getType() == gl::TextureType::CubeMap) + ? gl::kCubeMapTextureTargetMin + : gl::NonCubeTextureTypeToTarget(texture.getType()); + GLenum sizedFormat = texture.getFormat(target, baseLevel).info->sizedInternalFormat; if (data->baseLevel != static_cast(baseLevel)) { data->baseLevel = static_cast(baseLevel); @@ -383,15 +392,15 @@ void ShaderConstants11::setComputeWorkGroups(GLuint numGroupsX, mCompute.numWorkGroups[0] = numGroupsX; mCompute.numWorkGroups[1] = numGroupsY; mCompute.numWorkGroups[2] = numGroupsZ; - mComputeDirty = true; + mShaderConstantsDirty.set(gl::ShaderType::Compute); } void ShaderConstants11::setMultiviewWriteToViewportIndex(GLfloat index) { mVertex.multiviewWriteToViewportIndex = index; - mVertexDirty = true; mPixel.multiviewWriteToViewportIndex = index; - mPixelDirty = true; + mShaderConstantsDirty.set(gl::ShaderType::Vertex); + mShaderConstantsDirty.set(gl::ShaderType::Fragment); } void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport, @@ -399,8 +408,8 @@ void ShaderConstants11::onViewportChange(const gl::Rectangle &glViewport, bool is9_3, bool presentPathFast) { - mVertexDirty = true; - mPixelDirty = true; + mShaderConstantsDirty.set(gl::ShaderType::Vertex); + mShaderConstantsDirty.set(gl::ShaderType::Fragment); // On Feature Level 9_*, we must emulate large and/or negative viewports in the shaders // using viewAdjust (like the D3D9 renderer). @@ -457,19 +466,19 @@ void ShaderConstants11::onSamplerChange(gl::ShaderType shaderType, { switch (shaderType) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: if (updateSamplerMetadata(&mSamplerMetadataVS[samplerIndex], texture)) { mNumActiveVSSamplers = 0; } break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: if (updateSamplerMetadata(&mSamplerMetadataPS[samplerIndex], texture)) { mNumActivePSSamplers = 0; } break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: if (updateSamplerMetadata(&mSamplerMetadataCS[samplerIndex], texture)) { mNumActiveCSSamplers = 0; @@ -497,28 +506,31 @@ gl::Error ShaderConstants11::updateBuffer(Renderer11 *renderer, switch (shaderType) { - case gl::SHADER_VERTEX: - dirty = mVertexDirty || (mNumActiveVSSamplers < numSamplers); + case gl::ShaderType::Vertex: + dirty = mShaderConstantsDirty[gl::ShaderType::Vertex] || + (mNumActiveVSSamplers < numSamplers); dataSize = sizeof(Vertex); data = reinterpret_cast(&mVertex); samplerData = reinterpret_cast(mSamplerMetadataVS.data()); - mVertexDirty = false; + mShaderConstantsDirty.set(gl::ShaderType::Vertex, false); mNumActiveVSSamplers = numSamplers; break; - case gl::SHADER_FRAGMENT: - dirty = mPixelDirty || (mNumActivePSSamplers < numSamplers); + case gl::ShaderType::Fragment: + dirty = mShaderConstantsDirty[gl::ShaderType::Fragment] || + (mNumActivePSSamplers < numSamplers); dataSize = sizeof(Pixel); data = reinterpret_cast(&mPixel); samplerData = reinterpret_cast(mSamplerMetadataPS.data()); - mPixelDirty = false; + mShaderConstantsDirty.set(gl::ShaderType::Fragment, false); mNumActivePSSamplers = numSamplers; break; - case gl::SHADER_COMPUTE: - dirty = mComputeDirty || (mNumActiveCSSamplers < numSamplers); + case gl::ShaderType::Compute: + dirty = mShaderConstantsDirty[gl::ShaderType::Compute] || + (mNumActiveCSSamplers < numSamplers); dataSize = sizeof(Compute); data = reinterpret_cast(&mCompute); samplerData = reinterpret_cast(mSamplerMetadataCS.data()); - mComputeDirty = false; + mShaderConstantsDirty.set(gl::ShaderType::Compute, false); mNumActiveCSSamplers = numSamplers; break; default: @@ -572,10 +584,10 @@ StateManager11::StateManager11(Renderer11 *renderer) mDirtyCurrentValueAttribs(), mCurrentValueAttribs(), mCurrentInputLayout(), - mInputLayoutIsDirty(false), - mVertexAttribsNeedTranslation(false), mDirtyVertexBufferRange(gl::MAX_VERTEX_ATTRIBS, 0), mCurrentPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_UNDEFINED), + mLastAppliedDrawMode(GL_INVALID_INDEX), + mCurrentMinimumDrawCount(0), mDirtySwizzles(false), mAppliedIB(nullptr), mAppliedIBFormat(DXGI_FORMAT_UNKNOWN), @@ -584,8 +596,7 @@ StateManager11::StateManager11(Renderer11 *renderer) mVertexDataManager(renderer), mIndexDataManager(renderer), mIsMultiviewEnabled(false), - mEmptySerial(mRenderer->generateSerial()), - mIsTransformFeedbackCurrentlyActiveUnpaused(false) + mEmptySerial(mRenderer->generateSerial()) { mCurBlendState.blend = false; mCurBlendState.sourceBlendRGB = GL_ONE; @@ -657,13 +668,13 @@ void StateManager11::setShaderResourceInternal(gl::ShaderType shaderType, ID3D11ShaderResourceView *srvPtr = srv ? srv->get() : nullptr; switch (shaderType) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: deviceContext->VSSetShaderResources(resourceSlot, 1, &srvPtr); break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: deviceContext->PSSetShaderResources(resourceSlot, 1, &srvPtr); break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: deviceContext->CSSetShaderResources(resourceSlot, 1, &srvPtr); break; default: @@ -679,7 +690,7 @@ void StateManager11::setUnorderedAccessViewInternal(gl::ShaderType shaderType, UINT resourceSlot, const UAVType *uav) { - ASSERT(shaderType == gl::SHADER_COMPUTE); + ASSERT(shaderType == gl::ShaderType::Compute); ASSERT(static_cast(resourceSlot) < mCurComputeUAVs.size()); const ViewRecord &record = mCurComputeUAVs[resourceSlot]; @@ -744,7 +755,7 @@ gl::Error StateManager11::updateStateForCompute(const gl::Context *context, programD3D->updateSamplerMapping(); // TODO(jmadill): Use dirty bits. - ANGLE_TRY(generateSwizzlesForShader(context, gl::SHADER_COMPUTE)); + ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Compute)); // TODO(jmadill): More complete implementation. ANGLE_TRY(syncTexturesForCompute(context)); @@ -761,9 +772,9 @@ void StateManager11::syncState(const gl::Context *context, const gl::State::Dirt return; } - const auto &state = context->getGLState(); + const gl::State &state = context->getGLState(); - for (auto dirtyBit : dirtyBits) + for (size_t dirtyBit : dirtyBits) { switch (dirtyBit) { @@ -915,18 +926,21 @@ void StateManager11::syncState(const gl::Context *context, const gl::State::Dirt if (state.getRasterizerState().cullFace != mCurRasterState.cullFace) { mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE); + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); } break; case gl::State::DIRTY_BIT_CULL_FACE: if (state.getRasterizerState().cullMode != mCurRasterState.cullMode) { mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE); + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); } break; case gl::State::DIRTY_BIT_FRONT_FACE: if (state.getRasterizerState().frontFace != mCurRasterState.frontFace) { mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE); + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); } break; case gl::State::DIRTY_BIT_POLYGON_OFFSET_FILL_ENABLED: @@ -996,7 +1010,7 @@ void StateManager11::syncState(const gl::Context *context, const gl::State::Dirt // owned by the StateManager11/Context. mDirtyCurrentValueAttribs.set(); // Invalidate the cached index buffer. - mIndexBufferIsDirty = true; + invalidateIndexBuffer(); break; case gl::State::DIRTY_BIT_UNIFORM_BUFFER_BINDINGS: invalidateProgramUniformBuffers(); @@ -1007,27 +1021,29 @@ void StateManager11::syncState(const gl::Context *context, const gl::State::Dirt case gl::State::DIRTY_BIT_SAMPLER_BINDINGS: invalidateTexturesAndSamplers(); break; + case gl::State::DIRTY_BIT_TRANSFORM_FEEDBACK_BINDING: + invalidateTransformFeedback(); + break; case gl::State::DIRTY_BIT_PROGRAM_EXECUTABLE: { - mInternalDirtyBits.set(DIRTY_BIT_SHADERS); + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); + invalidateShaders(); invalidateVertexBuffer(); invalidateRenderTarget(); invalidateTexturesAndSamplers(); invalidateProgramUniforms(); invalidateProgramUniformBuffers(); invalidateDriverUniforms(); - gl::VertexArray *vao = state.getVertexArray(); - if (mIsMultiviewEnabled && vao != nullptr) + if (mIsMultiviewEnabled) { + gl::VertexArray *vao = state.getVertexArray(); + ASSERT(vao); // If ANGLE_multiview is enabled, the attribute divisor has to be updated for // each binding. VertexArray11 *vao11 = GetImplAs(vao); const gl::Program *program = state.getProgram(); - int numViews = 1; - if (program != nullptr && program->usesMultiview()) - { - numViews = program->getNumViews(); - } + ASSERT(program); + int numViews = program->usesMultiview() ? program->getNumViews() : 1; vao11->markAllAttributeDivisorsForAdjustment(numViews); } break; @@ -1144,7 +1160,8 @@ gl::Error StateManager11::syncDepthStencilState(const gl::State &glState) } ASSERT((mCurDepthStencilState.stencilWritemask & maxStencil) == (mCurDepthStencilState.stencilBackWritemask & maxStencil)); - ASSERT(mCurStencilRef == mCurStencilBackRef); + ASSERT(gl::clamp(mCurStencilRef, 0, static_cast(maxStencil)) == + gl::clamp(mCurStencilBackRef, 0, static_cast(maxStencil))); ASSERT((mCurDepthStencilState.stencilMask & maxStencil) == (mCurDepthStencilState.stencilBackMask & maxStencil)); @@ -1160,10 +1177,19 @@ gl::Error StateManager11::syncDepthStencilState(const gl::State &glState) if (mCurDisableStencil.value()) { - modifiedGLState.stencilWritemask = 0; - modifiedGLState.stencilBackWritemask = 0; - modifiedGLState.stencilTest = false; + modifiedGLState.stencilTest = false; } + if (!modifiedGLState.stencilTest) + { + modifiedGLState.stencilWritemask = 0; + modifiedGLState.stencilBackWritemask = 0; + } + + // If STENCIL_TEST is disabled in glState, stencil testing and writing should be disabled. + // Verify that's true in the modifiedGLState so it is propagated to d3dState. + ASSERT(glState.getDepthStencilState().stencilTest || + (!modifiedGLState.stencilTest && modifiedGLState.stencilWritemask == 0 && + modifiedGLState.stencilBackWritemask == 0)); const d3d11::DepthStencilState *d3dState = nullptr; ANGLE_TRY(mRenderer->getDepthStencilState(modifiedGLState, &d3dState)); @@ -1177,18 +1203,19 @@ gl::Error StateManager11::syncDepthStencilState(const gl::State &glState) "Unexpected value of D3D11_DEFAULT_STENCIL_READ_MASK"); static_assert(D3D11_DEFAULT_STENCIL_WRITE_MASK == 0xFF, "Unexpected value of D3D11_DEFAULT_STENCIL_WRITE_MASK"); - UINT dxStencilRef = std::min(mCurStencilRef, 0xFFu); + UINT dxStencilRef = static_cast(gl::clamp(mCurStencilRef, 0, 0xFF)); mRenderer->getDeviceContext()->OMSetDepthStencilState(d3dState->get(), dxStencilRef); return gl::NoError(); } -gl::Error StateManager11::syncRasterizerState(const gl::Context *context, bool pointDrawMode) +gl::Error StateManager11::syncRasterizerState(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) { // TODO: Remove pointDrawMode and multiSample from gl::RasterizerState. gl::RasterizerState rasterState = context->getGLState().getRasterizerState(); - rasterState.pointDrawMode = pointDrawMode; + rasterState.pointDrawMode = (drawCallParams.mode() == GL_POINTS); rasterState.multiSample = mCurRasterState.multiSample; ID3D11RasterizerState *dxRasterState = nullptr; @@ -1431,9 +1458,9 @@ void StateManager11::invalidateVertexBuffer() unsigned int limit = std::min(mRenderer->getNativeCaps().maxVertexAttributes, gl::MAX_VERTEX_ATTRIBS); mDirtyVertexBufferRange = gl::RangeUI(0, limit); - mInputLayoutIsDirty = true; + invalidateInputLayout(); + invalidateShaders(); mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS); - invalidateVertexAttributeTranslation(); } void StateManager11::invalidateViewport(const gl::Context *context) @@ -1494,6 +1521,25 @@ void StateManager11::invalidateShaders() mInternalDirtyBits.set(DIRTY_BIT_SHADERS); } +void StateManager11::invalidateTransformFeedback() +{ + // Transform feedback affects the stream-out geometry shader. + invalidateShaders(); + mInternalDirtyBits.set(DIRTY_BIT_TRANSFORM_FEEDBACK); + // syncPrimitiveTopology checks the transform feedback state. + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); +} + +void StateManager11::invalidateInputLayout() +{ + mInternalDirtyBits.set(DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT); +} + +void StateManager11::invalidateIndexBuffer() +{ + mIndexBufferIsDirty = true; +} + void StateManager11::setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv) { if ((rtv && unsetConflictingView(rtv)) || (dsv && unsetConflictingView(dsv))) @@ -1530,11 +1576,6 @@ void StateManager11::setRenderTargets(ID3D11RenderTargetView **rtvs, mInternalDirtyBits.set(DIRTY_BIT_RENDER_TARGET); } -void StateManager11::invalidateVertexAttributeTranslation() -{ - mVertexAttribsNeedTranslation = true; -} - void StateManager11::onBeginQuery(Query11 *query) { mCurrentQueries.insert(query); @@ -1586,17 +1627,17 @@ gl::Error StateManager11::clearSRVs(gl::ShaderType shaderType, size_t rangeStart ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); switch (shaderType) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: deviceContext->VSSetShaderResources(static_cast(clearRange.low()), static_cast(clearRange.length()), &mNullSRVs[0]); break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: deviceContext->PSSetShaderResources(static_cast(clearRange.low()), static_cast(clearRange.length()), &mNullSRVs[0]); break; - case gl::SHADER_COMPUTE: + case gl::ShaderType::Compute: deviceContext->CSSetShaderResources(static_cast(clearRange.low()), static_cast(clearRange.length()), &mNullSRVs[0]); @@ -1616,7 +1657,7 @@ gl::Error StateManager11::clearSRVs(gl::ShaderType shaderType, size_t rangeStart gl::Error StateManager11::clearUAVs(gl::ShaderType shaderType, size_t rangeStart, size_t rangeEnd) { - ASSERT(shaderType == gl::SHADER_COMPUTE); + ASSERT(shaderType == gl::ShaderType::Compute); if (rangeStart == rangeEnd) { return gl::NoError(); @@ -1644,8 +1685,8 @@ gl::Error StateManager11::clearUAVs(gl::ShaderType shaderType, size_t rangeStart bool StateManager11::unsetConflictingView(ID3D11View *view) { uintptr_t resource = reinterpret_cast(GetViewResource(view)); - return unsetConflictingSRVs(gl::SHADER_VERTEX, resource, nullptr) || - unsetConflictingSRVs(gl::SHADER_FRAGMENT, resource, nullptr); + return unsetConflictingSRVs(gl::ShaderType::Vertex, resource, nullptr) || + unsetConflictingSRVs(gl::ShaderType::Fragment, resource, nullptr); } bool StateManager11::unsetConflictingSRVs(gl::ShaderType shaderType, @@ -1683,14 +1724,14 @@ void StateManager11::unsetConflictingAttachmentResources( const gl::ImageIndex &index = attachment->getTextureImageIndex(); // The index doesn't need to be corrected for the small compressed texture workaround // because a rendertarget is never compressed. - unsetConflictingSRVs(gl::SHADER_VERTEX, resourcePtr, &index); - unsetConflictingSRVs(gl::SHADER_FRAGMENT, resourcePtr, &index); + unsetConflictingSRVs(gl::ShaderType::Vertex, resourcePtr, &index); + unsetConflictingSRVs(gl::ShaderType::Fragment, resourcePtr, &index); } else if (attachment->type() == GL_FRAMEBUFFER_DEFAULT) { uintptr_t resourcePtr = reinterpret_cast(resource); - unsetConflictingSRVs(gl::SHADER_VERTEX, resourcePtr, nullptr); - unsetConflictingSRVs(gl::SHADER_FRAGMENT, resourcePtr, nullptr); + unsetConflictingSRVs(gl::ShaderType::Vertex, resourcePtr, nullptr); + unsetConflictingSRVs(gl::ShaderType::Fragment, resourcePtr, nullptr); } } @@ -1741,6 +1782,9 @@ void StateManager11::deinitialize() mDriverConstantBufferVS.reset(); mDriverConstantBufferPS.reset(); mDriverConstantBufferCS.reset(); + + mPointSpriteVertexBuffer.reset(); + mPointSpriteIndexBuffer.reset(); } gl::Error StateManager11::syncFramebuffer(const gl::Context *context, gl::Framebuffer *framebuffer) @@ -1749,14 +1793,13 @@ gl::Error StateManager11::syncFramebuffer(const gl::Context *context, gl::Frameb // Applies the render target surface, depth stencil surface, viewport rectangle and // scissor rectangle to the renderer - ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit() && framebuffer->cachedComplete()); + ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit()); // Check for zero-sized default framebuffer, which is a special case. // in this case we do not wish to modify any state and just silently return false. // this will not report any gl error but will cause the calling method to return. if (framebuffer->id() == 0) { - ASSERT(!framebuffer11->hasAnyInternalDirtyBit()); const gl::Extents &size = framebuffer->getFirstColorbuffer()->getSize(); if (size.width == 0 || size.height == 0) { @@ -1830,6 +1873,8 @@ void StateManager11::invalidateCurrentValueAttrib(size_t attribIndex) { mDirtyCurrentValueAttribs.set(attribIndex); mInternalDirtyBits.set(DIRTY_BIT_CURRENT_VALUE_ATTRIBS); + invalidateInputLayout(); + invalidateShaders(); } gl::Error StateManager11::syncCurrentValueAttribs(const gl::State &glState) @@ -1859,7 +1904,6 @@ gl::Error StateManager11::syncCurrentValueAttribs(const gl::State &glState) currentValueAttrib->binding = &vertexBindings[attrib->bindingIndex]; mDirtyVertexBufferRange.extend(static_cast(attribIndex)); - mInputLayoutIsDirty = true; ANGLE_TRY(mVertexDataManager.storeCurrentValue(currentValue, currentValueAttrib, static_cast(attribIndex))); @@ -1869,6 +1913,14 @@ gl::Error StateManager11::syncCurrentValueAttribs(const gl::State &glState) } void StateManager11::setInputLayout(const d3d11::InputLayout *inputLayout) +{ + if (setInputLayoutInternal(inputLayout)) + { + invalidateInputLayout(); + } +} + +bool StateManager11::setInputLayoutInternal(const d3d11::InputLayout *inputLayout) { ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); if (inputLayout == nullptr) @@ -1877,15 +1929,17 @@ void StateManager11::setInputLayout(const d3d11::InputLayout *inputLayout) { deviceContext->IASetInputLayout(nullptr); mCurrentInputLayout.clear(); - mInputLayoutIsDirty = true; + return true; } } else if (inputLayout->getSerial() != mCurrentInputLayout) { deviceContext->IASetInputLayout(inputLayout->get()); mCurrentInputLayout = inputLayout->getSerial(); - mInputLayoutIsDirty = true; + return true; } + + return false; } bool StateManager11::queueVertexBufferChange(size_t bufferIndex, @@ -1897,7 +1951,6 @@ bool StateManager11::queueVertexBufferChange(size_t bufferIndex, stride != mCurrentVertexStrides[bufferIndex] || offset != mCurrentVertexOffsets[bufferIndex]) { - mInputLayoutIsDirty = true; mDirtyVertexBufferRange.extend(static_cast(bufferIndex)); mCurrentVertexBuffers[bufferIndex] = buffer; @@ -1909,18 +1962,6 @@ bool StateManager11::queueVertexBufferChange(size_t bufferIndex, return false; } -bool StateManager11::queueVertexOffsetChange(size_t bufferIndex, UINT offsetOnly) -{ - if (offsetOnly != mCurrentVertexOffsets[bufferIndex]) - { - mInputLayoutIsDirty = true; - mDirtyVertexBufferRange.extend(static_cast(bufferIndex)); - mCurrentVertexOffsets[bufferIndex] = offsetOnly; - return true; - } - return false; -} - void StateManager11::applyVertexBufferChanges() { if (mDirtyVertexBufferRange.empty()) @@ -1945,14 +1986,16 @@ void StateManager11::setSingleVertexBuffer(const d3d11::Buffer *buffer, UINT str ID3D11Buffer *native = buffer ? buffer->get() : nullptr; if (queueVertexBufferChange(0, native, stride, offset)) { + invalidateInputLayout(); applyVertexBufferChanges(); } } -gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMode) +gl::Error StateManager11::updateState(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) { - const auto &glState = context->getGLState(); - auto *programD3D = GetImplAs(glState.getProgram()); + const gl::State &glState = context->getGLState(); + auto *programD3D = GetImplAs(glState.getProgram()); // TODO(jmadill): Use dirty bits. processFramebufferInvalidation(context); @@ -1964,19 +2007,11 @@ gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMod } // TODO(jmadill): Use dirty bits. - if (programD3D->areVertexUniformsDirty() || programD3D->areFragmentUniformsDirty()) + if (programD3D->anyShaderUniformsDirty()) { mInternalDirtyBits.set(DIRTY_BIT_PROGRAM_UNIFORMS); } - // Transform feedback affects the stream-out geometry shader. - // TODO(jmadill): Use dirty bits. - if (glState.isTransformFeedbackActiveUnpaused() != mIsTransformFeedbackCurrentlyActiveUnpaused) - { - mIsTransformFeedbackCurrentlyActiveUnpaused = glState.isTransformFeedbackActiveUnpaused(); - invalidateShaders(); - } - // Swizzling can cause internal state changes with blit shaders. if (mDirtySwizzles) { @@ -1988,21 +2023,6 @@ gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMod Framebuffer11 *framebuffer11 = GetImplAs(framebuffer); ANGLE_TRY(framebuffer11->markAttachmentsDirty(context)); - if (framebuffer11->hasAnyInternalDirtyBit()) - { - ASSERT(framebuffer->id() != 0); - framebuffer11->syncInternalState(context); - } - - bool pointDrawMode = (drawMode == GL_POINTS); - if (pointDrawMode != mCurRasterState.pointDrawMode) - { - mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE); - - // Changing from points to not points (or vice-versa) affects the geometry shader. - invalidateShaders(); - } - // TODO(jiawei.shao@intel.com): This can be recomputed only on framebuffer or multisample mask // state changes. RenderTarget11 *firstRT = framebuffer11->getFirstRenderTarget(); @@ -2013,12 +2033,34 @@ gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMod mInternalDirtyBits.set(DIRTY_BIT_BLEND_STATE); } - // Changing the vertex attribute state can affect the vertex shader. - gl::VertexArray *vao = glState.getVertexArray(); - VertexArray11 *vao11 = GetImplAs(vao); - if (vao11->flushAttribUpdates(context)) + // Changes in the draw call can affect the vertex buffer translations. + if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != drawCallParams.firstVertex()) { - mInternalDirtyBits.set(DIRTY_BIT_SHADERS); + mLastFirstVertex = drawCallParams.firstVertex(); + invalidateInputLayout(); + } + + VertexArray11 *vao11 = GetImplAs(glState.getVertexArray()); + ANGLE_TRY(vao11->syncStateForDraw(context, drawCallParams)); + + if (drawCallParams.isDrawElements()) + { + ANGLE_TRY(applyIndexBuffer(context, drawCallParams)); + } + + if (mLastAppliedDrawMode != drawCallParams.mode()) + { + mLastAppliedDrawMode = drawCallParams.mode(); + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); + + bool pointDrawMode = (drawCallParams.mode() == GL_POINTS); + if (pointDrawMode != mCurRasterState.pointDrawMode) + { + mInternalDirtyBits.set(DIRTY_BIT_RASTERIZER_STATE); + + // Changing from points to not points (or vice-versa) affects the geometry shader. + invalidateShaders(); + } } auto dirtyBitsCopy = mInternalDirtyBits; @@ -2038,7 +2080,7 @@ gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMod syncScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled()); break; case DIRTY_BIT_RASTERIZER_STATE: - ANGLE_TRY(syncRasterizerState(context, pointDrawMode)); + ANGLE_TRY(syncRasterizerState(context, drawCallParams)); break; case DIRTY_BIT_BLEND_STATE: ANGLE_TRY(syncBlendState(context, framebuffer, glState.getBlendState(), @@ -2062,19 +2104,26 @@ gl::Error StateManager11::updateState(const gl::Context *context, GLenum drawMod ANGLE_TRY(syncUniformBuffers(context, programD3D)); break; case DIRTY_BIT_SHADERS: - ANGLE_TRY(syncProgram(context, drawMode)); + ANGLE_TRY(syncProgram(context, drawCallParams.mode())); break; case DIRTY_BIT_CURRENT_VALUE_ATTRIBS: ANGLE_TRY(syncCurrentValueAttribs(glState)); break; + case DIRTY_BIT_TRANSFORM_FEEDBACK: + ANGLE_TRY(syncTransformFeedbackBuffers(context)); + break; + case DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT: + ANGLE_TRY(syncVertexBuffersAndInputLayout(context, drawCallParams)); + break; + case DIRTY_BIT_PRIMITIVE_TOPOLOGY: + syncPrimitiveTopology(glState, programD3D, drawCallParams.mode()); + break; default: UNREACHABLE(); break; } } - ANGLE_TRY(syncTransformFeedbackBuffers(context)); - // Check that we haven't set any dirty bits in the flushing of the dirty bits loop. ASSERT(mInternalDirtyBits.none()); @@ -2102,11 +2151,24 @@ void StateManager11::setShaderResource(gl::ShaderType shaderType, } void StateManager11::setPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology) +{ + if (setPrimitiveTopologyInternal(primitiveTopology)) + { + mInternalDirtyBits.set(DIRTY_BIT_PRIMITIVE_TOPOLOGY); + } +} + +bool StateManager11::setPrimitiveTopologyInternal(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology) { if (primitiveTopology != mCurrentPrimitiveTopology) { mRenderer->getDeviceContext()->IASetPrimitiveTopology(primitiveTopology); mCurrentPrimitiveTopology = primitiveTopology; + return true; + } + else + { + return false; } } @@ -2302,7 +2364,7 @@ void StateManager11::setSimplePixelTextureAndSampler(const d3d11::SharedSRV &srv { ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); - setShaderResourceInternal(gl::SHADER_FRAGMENT, 0, &srv); + setShaderResourceInternal(gl::ShaderType::Fragment, 0, &srv); deviceContext->PSSetSamplers(0, 1, samplerState.getPointer()); mInternalDirtyBits.set(DIRTY_BIT_TEXTURE_AND_SAMPLER_STATE); @@ -2331,7 +2393,7 @@ void StateManager11::setScissorRectD3D(const D3D11_RECT &d3dRect) // Sampler mapping needs to be up-to-date on the program object before this is called. gl::Error StateManager11::applyTextures(const gl::Context *context, gl::ShaderType shaderType) { - ASSERT(shaderType != gl::SHADER_COMPUTE); + ASSERT(shaderType != gl::ShaderType::Compute); const auto &glState = context->getGLState(); const auto &caps = context->getCaps(); ProgramD3D *programD3D = GetImplAs(glState.getProgram()); @@ -2361,7 +2423,8 @@ gl::Error StateManager11::applyTextures(const gl::Context *context, gl::ShaderTy } else { - GLenum textureType = programD3D->getSamplerTextureType(shaderType, samplerIndex); + gl::TextureType textureType = + programD3D->getSamplerTextureType(shaderType, samplerIndex); // Texture is not sampler complete or it is in use by the framebuffer. Bind the // incomplete texture. @@ -2374,8 +2437,9 @@ gl::Error StateManager11::applyTextures(const gl::Context *context, gl::ShaderTy } // Set all the remaining textures to NULL - size_t samplerCount = (shaderType == gl::SHADER_FRAGMENT) ? caps.maxTextureImageUnits - : caps.maxVertexTextureImageUnits; + size_t samplerCount = (shaderType == gl::ShaderType::Fragment) + ? caps.maxTextureImageUnits + : caps.maxVertexTextureImageUnits; ANGLE_TRY(clearSRVs(shaderType, samplerRange, samplerCount)); return gl::NoError(); @@ -2383,8 +2447,8 @@ gl::Error StateManager11::applyTextures(const gl::Context *context, gl::ShaderTy gl::Error StateManager11::syncTextures(const gl::Context *context) { - ANGLE_TRY(applyTextures(context, gl::SHADER_VERTEX)); - ANGLE_TRY(applyTextures(context, gl::SHADER_FRAGMENT)); + ANGLE_TRY(applyTextures(context, gl::ShaderType::Vertex)); + ANGLE_TRY(applyTextures(context, gl::ShaderType::Fragment)); return gl::NoError(); } @@ -2404,7 +2468,7 @@ gl::Error StateManager11::setSamplerState(const gl::Context *context, auto *deviceContext = mRenderer->getDeviceContext(); - if (type == gl::SHADER_FRAGMENT) + if (type == gl::ShaderType::Fragment) { ASSERT(static_cast(index) < mRenderer->getNativeCaps().maxTextureImageUnits); @@ -2422,7 +2486,7 @@ gl::Error StateManager11::setSamplerState(const gl::Context *context, mForceSetPixelSamplerStates[index] = false; } - else if (type == gl::SHADER_VERTEX) + else if (type == gl::ShaderType::Vertex) { ASSERT(static_cast(index) < mRenderer->getNativeCaps().maxVertexTextureImageUnits); @@ -2441,7 +2505,7 @@ gl::Error StateManager11::setSamplerState(const gl::Context *context, mForceSetVertexSamplerStates[index] = false; } - else if (type == gl::SHADER_COMPUTE) + else if (type == gl::ShaderType::Compute) { ASSERT(static_cast(index) < mRenderer->getNativeCaps().maxComputeTextureImageUnits); @@ -2476,7 +2540,7 @@ gl::Error StateManager11::setTexture(const gl::Context *context, int index, gl::Texture *texture) { - ASSERT(type != gl::SHADER_COMPUTE); + ASSERT(type != gl::ShaderType::Compute); const d3d11::SharedSRV *textureSRV = nullptr; if (texture) @@ -2501,9 +2565,9 @@ gl::Error StateManager11::setTexture(const gl::Context *context, } ASSERT( - (type == gl::SHADER_FRAGMENT && + (type == gl::ShaderType::Fragment && static_cast(index) < mRenderer->getNativeCaps().maxTextureImageUnits) || - (type == gl::SHADER_VERTEX && + (type == gl::ShaderType::Vertex && static_cast(index) < mRenderer->getNativeCaps().maxVertexTextureImageUnits)); setShaderResourceInternal(type, index, textureSRV); @@ -2517,33 +2581,34 @@ gl::Error StateManager11::syncTexturesForCompute(const gl::Context *context) ProgramD3D *programD3D = GetImplAs(glState.getProgram()); // TODO(xinghua.cao@intel.com): Implement sampler feature in compute shader. - unsigned int readonlyImageRange = programD3D->getUsedImageRange(gl::SHADER_COMPUTE, true); + unsigned int readonlyImageRange = programD3D->getUsedImageRange(gl::ShaderType::Compute, true); for (unsigned int readonlyImageIndex = 0; readonlyImageIndex < readonlyImageRange; readonlyImageIndex++) { GLint imageUnitIndex = - programD3D->getImageMapping(gl::SHADER_COMPUTE, readonlyImageIndex, true, caps); + programD3D->getImageMapping(gl::ShaderType::Compute, readonlyImageIndex, true, caps); ASSERT(imageUnitIndex != -1); const gl::ImageUnit &imageUnit = glState.getImageUnit(imageUnitIndex); - ANGLE_TRY( - setTextureForImage(context, gl::SHADER_COMPUTE, readonlyImageIndex, true, imageUnit)); + ANGLE_TRY(setTextureForImage(context, gl::ShaderType::Compute, readonlyImageIndex, true, + imageUnit)); } - unsigned int imageRange = programD3D->getUsedImageRange(gl::SHADER_COMPUTE, false); + unsigned int imageRange = programD3D->getUsedImageRange(gl::ShaderType::Compute, false); for (unsigned int imageIndex = 0; imageIndex < imageRange; imageIndex++) { GLint imageUnitIndex = - programD3D->getImageMapping(gl::SHADER_COMPUTE, imageIndex, false, caps); + programD3D->getImageMapping(gl::ShaderType::Compute, imageIndex, false, caps); ASSERT(imageUnitIndex != -1); const gl::ImageUnit &imageUnit = glState.getImageUnit(imageUnitIndex); - ANGLE_TRY(setTextureForImage(context, gl::SHADER_COMPUTE, imageIndex, false, imageUnit)); + ANGLE_TRY( + setTextureForImage(context, gl::ShaderType::Compute, imageIndex, false, imageUnit)); } // Set all the remaining textures to NULL size_t readonlyImageCount = caps.maxImageUnits; size_t imageCount = caps.maxImageUnits; - ANGLE_TRY(clearSRVs(gl::SHADER_COMPUTE, readonlyImageRange, readonlyImageCount)); - ANGLE_TRY(clearUAVs(gl::SHADER_COMPUTE, imageRange, imageCount)); + ANGLE_TRY(clearSRVs(gl::ShaderType::Compute, readonlyImageRange, readonlyImageCount)); + ANGLE_TRY(clearUAVs(gl::ShaderType::Compute, imageRange, imageCount)); return gl::NoError(); } @@ -2657,36 +2722,13 @@ gl::Error StateManager11::syncProgram(const gl::Context *context, GLenum drawMod return gl::NoError(); } -gl::Error StateManager11::applyVertexBuffer(const gl::Context *context, - GLenum mode, - const DrawCallVertexParams &vertexParams, - bool isIndexedRendering) +gl::Error StateManager11::syncVertexBuffersAndInputLayout(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) { - const auto &state = context->getGLState(); + const gl::State &state = context->getGLState(); const gl::VertexArray *vertexArray = state.getVertexArray(); VertexArray11 *vertexArray11 = GetImplAs(vertexArray); - if (mVertexAttribsNeedTranslation) - { - ANGLE_TRY(vertexArray11->updateDirtyAndDynamicAttribs(context, &mVertexDataManager, - vertexParams)); - mInputLayoutIsDirty = true; - - // Determine if we need to update attribs on the next draw. - mVertexAttribsNeedTranslation = (vertexArray11->hasActiveDynamicAttrib(context)); - } - - if (!mLastFirstVertex.valid() || mLastFirstVertex.value() != vertexParams.firstVertex()) - { - mLastFirstVertex = vertexParams.firstVertex(); - mInputLayoutIsDirty = true; - } - - if (!mInputLayoutIsDirty) - { - return gl::NoError(); - } - const auto &vertexArrayAttribs = vertexArray11->getTranslatedAttribs(); gl::Program *program = state.getProgram(); @@ -2695,7 +2737,7 @@ gl::Error StateManager11::applyVertexBuffer(const gl::Context *context, SortAttributesByLayout(program, vertexArrayAttribs, mCurrentValueAttribs, &sortedSemanticIndices, &mCurrentAttributes); - auto featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel; + D3D_FEATURE_LEVEL featureLevel = mRenderer->getRenderer11DeviceCaps().featureLevel; // If we are using FL 9_3, make sure the first attribute is not instanced if (featureLevel <= D3D_FEATURE_LEVEL_9_3 && !mCurrentAttributes.empty()) @@ -2713,75 +2755,212 @@ gl::Error StateManager11::applyVertexBuffer(const gl::Context *context, } // Update the applied input layout by querying the cache. - ANGLE_TRY(mInputLayoutCache.updateInputLayout(mRenderer, state, mCurrentAttributes, mode, - sortedSemanticIndices, vertexParams)); + const d3d11::InputLayout *inputLayout = nullptr; + ANGLE_TRY(mInputLayoutCache.getInputLayout( + mRenderer, state, mCurrentAttributes, sortedSemanticIndices, drawCallParams, &inputLayout)); + setInputLayoutInternal(inputLayout); // Update the applied vertex buffers. - ANGLE_TRY(mInputLayoutCache.applyVertexBuffers(context, mCurrentAttributes, mode, - vertexParams.firstVertex(), isIndexedRendering)); + ANGLE_TRY(applyVertexBuffers(context, drawCallParams)); - // InputLayoutCache::applyVertexBuffers calls through to the Bufer11 to get the native vertex - // buffer (ID3D11Buffer *). Because we allocate these buffers lazily, this will trigger - // allocation. This in turn will signal that the buffer is dirty. Since we just resolved the - // dirty-ness in VertexArray11::updateDirtyAndDynamicAttribs, this can make us do a needless - // update on the second draw call. - // Hence we clear the flags here, after we've applied vertex data, since we know everything - // is clean. This is a bit of a hack. - vertexArray11->clearDirtyAndPromoteDynamicAttribs(context, vertexParams); + return gl::NoError(); +} - mInputLayoutIsDirty = false; +gl::Error StateManager11::applyVertexBuffers(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) +{ + const gl::State &state = context->getGLState(); + gl::Program *program = state.getProgram(); + ProgramD3D *programD3D = GetImplAs(program); + + bool programUsesInstancedPointSprites = + programD3D->usesPointSize() && programD3D->usesInstancedPointSpriteEmulation(); + bool instancedPointSpritesActive = + programUsesInstancedPointSprites && (drawCallParams.mode() == GL_POINTS); + + // Note that if we use instance emulation, we reserve the first buffer slot. + size_t reservedBuffers = GetReservedBufferCount(programUsesInstancedPointSprites); + + for (size_t attribIndex = 0; attribIndex < (gl::MAX_VERTEX_ATTRIBS - reservedBuffers); + ++attribIndex) + { + ID3D11Buffer *buffer = nullptr; + UINT vertexStride = 0; + UINT vertexOffset = 0; + + if (attribIndex < mCurrentAttributes.size()) + { + const TranslatedAttribute &attrib = *mCurrentAttributes[attribIndex]; + Buffer11 *bufferStorage = attrib.storage ? GetAs(attrib.storage) : nullptr; + + // If indexed pointsprite emulation is active, then we need to take a less efficent code + // path. Emulated indexed pointsprite rendering requires that the vertex buffers match + // exactly to the indices passed by the caller. This could expand or shrink the vertex + // buffer depending on the number of points indicated by the index list or how many + // duplicates are found on the index list. + if (bufferStorage == nullptr) + { + ASSERT(attrib.vertexBuffer.get()); + buffer = GetAs(attrib.vertexBuffer.get())->getBuffer().get(); + } + else if (instancedPointSpritesActive && drawCallParams.isDrawElements()) + { + VertexArray11 *vao11 = GetImplAs(state.getVertexArray()); + ASSERT(vao11->isCachedIndexInfoValid()); + TranslatedIndexData indexInfo = vao11->getCachedIndexInfo(); + if (indexInfo.srcIndexData.srcBuffer != nullptr) + { + const uint8_t *bufferData = nullptr; + ANGLE_TRY(indexInfo.srcIndexData.srcBuffer->getData(context, &bufferData)); + ASSERT(bufferData != nullptr); + + ptrdiff_t offset = + reinterpret_cast(indexInfo.srcIndexData.srcIndices); + indexInfo.srcIndexData.srcBuffer = nullptr; + indexInfo.srcIndexData.srcIndices = bufferData + offset; + } + + ANGLE_TRY_RESULT( + bufferStorage->getEmulatedIndexedBuffer(context, &indexInfo.srcIndexData, + attrib, drawCallParams.firstVertex()), + buffer); + + vao11->updateCachedIndexInfo(indexInfo); + } + else + { + ANGLE_TRY_RESULT( + bufferStorage->getBuffer(context, BUFFER_USAGE_VERTEX_OR_TRANSFORM_FEEDBACK), + buffer); + } + + vertexStride = attrib.stride; + ANGLE_TRY_RESULT(attrib.computeOffset(drawCallParams.firstVertex()), vertexOffset); + } + + size_t bufferIndex = reservedBuffers + attribIndex; + + queueVertexBufferChange(bufferIndex, buffer, vertexStride, vertexOffset); + } + + // Instanced PointSprite emulation requires two additional ID3D11Buffers. A vertex buffer needs + // to be created and added to the list of current buffers, strides and offsets collections. + // This buffer contains the vertices for a single PointSprite quad. + // An index buffer also needs to be created and applied because rendering instanced data on + // D3D11 FL9_3 requires DrawIndexedInstanced() to be used. Shaders that contain gl_PointSize and + // used without the GL_POINTS rendering mode require a vertex buffer because some drivers cannot + // handle missing vertex data and will TDR the system. + if (programUsesInstancedPointSprites) + { + constexpr UINT kPointSpriteVertexStride = sizeof(float) * 5; + + if (!mPointSpriteVertexBuffer.valid()) + { + static constexpr float kPointSpriteVertices[] = { + // Position | TexCoord + -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, /* v0 */ + -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, /* v1 */ + 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, /* v2 */ + 1.0f, -1.0f, 0.0f, 1.0f, 1.0f, /* v3 */ + -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, /* v4 */ + 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, /* v5 */ + }; + + D3D11_SUBRESOURCE_DATA vertexBufferData = {kPointSpriteVertices, 0, 0}; + D3D11_BUFFER_DESC vertexBufferDesc; + vertexBufferDesc.ByteWidth = sizeof(kPointSpriteVertices); + vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER; + vertexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE; + vertexBufferDesc.CPUAccessFlags = 0; + vertexBufferDesc.MiscFlags = 0; + vertexBufferDesc.StructureByteStride = 0; + + ANGLE_TRY(mRenderer->allocateResource(vertexBufferDesc, &vertexBufferData, + &mPointSpriteVertexBuffer)); + } + + // Set the stride to 0 if GL_POINTS mode is not being used to instruct the driver to avoid + // indexing into the vertex buffer. + UINT stride = instancedPointSpritesActive ? kPointSpriteVertexStride : 0; + queueVertexBufferChange(0, mPointSpriteVertexBuffer.get(), stride, 0); + + if (!mPointSpriteIndexBuffer.valid()) + { + // Create an index buffer and set it for pointsprite rendering + static constexpr unsigned short kPointSpriteIndices[] = { + 0, 1, 2, 3, 4, 5, + }; + + D3D11_SUBRESOURCE_DATA indexBufferData = {kPointSpriteIndices, 0, 0}; + D3D11_BUFFER_DESC indexBufferDesc; + indexBufferDesc.ByteWidth = sizeof(kPointSpriteIndices); + indexBufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER; + indexBufferDesc.Usage = D3D11_USAGE_IMMUTABLE; + indexBufferDesc.CPUAccessFlags = 0; + indexBufferDesc.MiscFlags = 0; + indexBufferDesc.StructureByteStride = 0; + + ANGLE_TRY(mRenderer->allocateResource(indexBufferDesc, &indexBufferData, + &mPointSpriteIndexBuffer)); + } + + if (instancedPointSpritesActive) + { + // The index buffer is applied here because Instanced PointSprite emulation uses the a + // non-indexed rendering path in ANGLE (DrawArrays). This means that applyIndexBuffer() + // on the renderer will not be called and setting this buffer here ensures that the + // rendering path will contain the correct index buffers. + syncIndexBuffer(mPointSpriteIndexBuffer.get(), DXGI_FORMAT_R16_UINT, 0); + } + } + + applyVertexBufferChanges(); return gl::NoError(); } gl::Error StateManager11::applyIndexBuffer(const gl::Context *context, - const void *indices, - GLsizei count, - GLenum type, - const gl::HasIndexRange &lazyIndexRange, - bool usePrimitiveRestartWorkaround) + const gl::DrawCallParams ¶ms) { const auto &glState = context->getGLState(); gl::VertexArray *vao = glState.getVertexArray(); VertexArray11 *vao11 = GetImplAs(vao); - GLenum destElementType = - GetIndexTranslationDestType(type, lazyIndexRange, usePrimitiveRestartWorkaround); - - if (!vao11->updateElementArrayStorage(context, type, destElementType, indices) && - !mIndexBufferIsDirty) + if (!mIndexBufferIsDirty) { // No streaming or index buffer application necessary. return gl::NoError(); } + GLenum destElementType = vao11->getCachedDestinationIndexType(); gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); - TranslatedIndexData *indexInfo = vao11->getCachedIndexInfo(); - ANGLE_TRY(mIndexDataManager.prepareIndexData(context, type, destElementType, count, - elementArrayBuffer, indices, indexInfo)); + TranslatedIndexData indexInfo; + ANGLE_TRY(mIndexDataManager.prepareIndexData(context, params.type(), destElementType, + params.indexCount(), elementArrayBuffer, + params.indices(), &indexInfo)); ID3D11Buffer *buffer = nullptr; DXGI_FORMAT bufferFormat = - (indexInfo->indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT; + (indexInfo.indexType == GL_UNSIGNED_INT) ? DXGI_FORMAT_R32_UINT : DXGI_FORMAT_R16_UINT; - if (indexInfo->storage) + if (indexInfo.storage) { - Buffer11 *storage = GetAs(indexInfo->storage); + Buffer11 *storage = GetAs(indexInfo.storage); ANGLE_TRY_RESULT(storage->getBuffer(context, BUFFER_USAGE_INDEX), buffer); } else { - IndexBuffer11 *indexBuffer = GetAs(indexInfo->indexBuffer); + IndexBuffer11 *indexBuffer = GetAs(indexInfo.indexBuffer); buffer = indexBuffer->getBuffer().get(); } // Track dirty indices in the index range cache. - indexInfo->srcIndexData.srcIndicesChanged = - syncIndexBuffer(buffer, bufferFormat, indexInfo->startOffset); + indexInfo.srcIndexData.srcIndicesChanged = + syncIndexBuffer(buffer, bufferFormat, indexInfo.startOffset); mIndexBufferIsDirty = false; - vao11->setCachedIndexInfoValid(); + vao11->updateCachedIndexInfo(indexInfo); return gl::NoError(); } @@ -2791,7 +2970,7 @@ void StateManager11::setIndexBuffer(ID3D11Buffer *buffer, { if (syncIndexBuffer(buffer, indexFormat, offset)) { - mIndexBufferIsDirty = true; + invalidateIndexBuffer(); } } @@ -2816,8 +2995,28 @@ bool StateManager11::syncIndexBuffer(ID3D11Buffer *buffer, gl::Error StateManager11::updateVertexOffsetsForPointSpritesEmulation(GLint startVertex, GLsizei emulatedInstanceId) { - return mInputLayoutCache.updateVertexOffsetsForPointSpritesEmulation( - mRenderer, mCurrentAttributes, startVertex, emulatedInstanceId); + size_t reservedBuffers = GetReservedBufferCount(true); + for (size_t attribIndex = 0; attribIndex < mCurrentAttributes.size(); ++attribIndex) + { + const auto &attrib = *mCurrentAttributes[attribIndex]; + size_t bufferIndex = reservedBuffers + attribIndex; + + if (attrib.divisor > 0) + { + unsigned int offset = 0; + ANGLE_TRY_RESULT(attrib.computeOffset(startVertex), offset); + offset += (attrib.stride * (emulatedInstanceId / attrib.divisor)); + if (offset != mCurrentVertexOffsets[bufferIndex]) + { + invalidateInputLayout(); + mDirtyVertexBufferRange.extend(static_cast(bufferIndex)); + mCurrentVertexOffsets[bufferIndex] = offset; + } + } + } + + applyVertexBufferChanges(); + return gl::NoError(); } gl::Error StateManager11::generateSwizzle(const gl::Context *context, gl::Texture *texture) @@ -2852,7 +3051,7 @@ gl::Error StateManager11::generateSwizzlesForShader(const gl::Context *context, for (unsigned int i = 0; i < samplerRange; i++) { - GLenum textureType = programD3D->getSamplerTextureType(type, i); + gl::TextureType textureType = programD3D->getSamplerTextureType(type, i); GLint textureUnit = programD3D->getSamplerMapping(type, i, context->getCaps()); if (textureUnit != -1) { @@ -2870,8 +3069,8 @@ gl::Error StateManager11::generateSwizzlesForShader(const gl::Context *context, gl::Error StateManager11::generateSwizzles(const gl::Context *context) { - ANGLE_TRY(generateSwizzlesForShader(context, gl::SHADER_VERTEX)); - ANGLE_TRY(generateSwizzlesForShader(context, gl::SHADER_FRAGMENT)); + ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Vertex)); + ANGLE_TRY(generateSwizzlesForShader(context, gl::ShaderType::Fragment)); return gl::NoError(); } @@ -2891,12 +3090,14 @@ gl::Error StateManager11::applyUniforms(ProgramD3D *programD3D) const d3d11::Buffer *pixelConstantBuffer = nullptr; ANGLE_TRY(fragmentUniformStorage->getConstantBuffer(mRenderer, &pixelConstantBuffer)); - if (vertexUniformStorage->size() > 0 && programD3D->areVertexUniformsDirty()) + if (vertexUniformStorage->size() > 0 && + programD3D->areShaderUniformsDirty(gl::ShaderType::Vertex)) { UpdateUniformBuffer(deviceContext, vertexUniformStorage, vertexConstantBuffer); } - if (fragmentUniformStorage->size() > 0 && programD3D->areFragmentUniformsDirty()) + if (fragmentUniformStorage->size() > 0 && + programD3D->areShaderUniformsDirty(gl::ShaderType::Fragment)) { UpdateUniformBuffer(deviceContext, fragmentUniformStorage, pixelConstantBuffer); } @@ -2930,7 +3131,7 @@ gl::Error StateManager11::applyDriverUniforms(const ProgramD3D &programD3D) if (!mDriverConstantBufferVS.valid()) { - size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SHADER_VERTEX); + size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::ShaderType::Vertex); D3D11_BUFFER_DESC constantBufferDescription = {0}; d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize); @@ -2943,7 +3144,7 @@ gl::Error StateManager11::applyDriverUniforms(const ProgramD3D &programD3D) if (!mDriverConstantBufferPS.valid()) { - size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SHADER_FRAGMENT); + size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::ShaderType::Fragment); D3D11_BUFFER_DESC constantBufferDescription = {0}; d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize); @@ -2956,9 +3157,9 @@ gl::Error StateManager11::applyDriverUniforms(const ProgramD3D &programD3D) // Sampler metadata and driver constants need to coexist in the same constant buffer to conserve // constant buffer slots. We update both in the constant buffer if needed. - ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::SHADER_VERTEX, programD3D, + ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::ShaderType::Vertex, programD3D, mDriverConstantBufferVS)); - ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::SHADER_FRAGMENT, programD3D, + ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::ShaderType::Fragment, programD3D, mDriverConstantBufferPS)); // needed for the point sprite geometry shader @@ -2987,7 +3188,8 @@ gl::Error StateManager11::applyComputeUniforms(ProgramD3D *programD3D) ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); - if (computeUniformStorage->size() > 0 && programD3D->areComputeUniformsDirty()) + if (computeUniformStorage->size() > 0 && + programD3D->areShaderUniformsDirty(gl::ShaderType::Compute)) { UpdateUniformBuffer(deviceContext, computeUniformStorage, constantBuffer); programD3D->markUniformsClean(); @@ -3003,7 +3205,7 @@ gl::Error StateManager11::applyComputeUniforms(ProgramD3D *programD3D) if (!mDriverConstantBufferCS.valid()) { - size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::SHADER_COMPUTE); + size_t requiredSize = mShaderConstants.getRequiredBufferSize(gl::ShaderType::Compute); D3D11_BUFFER_DESC constantBufferDescription = {0}; d3d11::InitConstantBufferDesc(&constantBufferDescription, requiredSize); @@ -3013,7 +3215,7 @@ gl::Error StateManager11::applyComputeUniforms(ProgramD3D *programD3D) &buffer); } - ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::SHADER_COMPUTE, *programD3D, + ANGLE_TRY(mShaderConstants.updateBuffer(mRenderer, gl::ShaderType::Compute, *programD3D, mDriverConstantBufferCS)); return gl::NoError(); @@ -3032,7 +3234,7 @@ gl::Error StateManager11::syncUniformBuffers(const gl::Context *context, Program ID3D11DeviceContext *deviceContext = mRenderer->getDeviceContext(); ID3D11DeviceContext1 *deviceContext1 = mRenderer->getDeviceContext1IfSupported(); - mOnConstantBufferDirtyReceiver.reset(); + mConstantBufferObserver.reset(); for (size_t bufferIndex = 0; bufferIndex < vertexUniformBuffers.size(); bufferIndex++) { @@ -3087,7 +3289,7 @@ gl::Error StateManager11::syncUniformBuffers(const gl::Context *context, Program mCurrentConstantBufferVSOffset[appliedIndex] = uniformBufferOffset; mCurrentConstantBufferVSSize[appliedIndex] = uniformBufferSize; - mOnConstantBufferDirtyReceiver.bindVS(bufferIndex, bufferStorage); + mConstantBufferObserver.bindVS(bufferIndex, bufferStorage); } for (size_t bufferIndex = 0; bufferIndex < fragmentUniformBuffers.size(); bufferIndex++) @@ -3142,7 +3344,7 @@ gl::Error StateManager11::syncUniformBuffers(const gl::Context *context, Program mCurrentConstantBufferPSOffset[appliedIndex] = uniformBufferOffset; mCurrentConstantBufferPSSize[appliedIndex] = uniformBufferSize; - mOnConstantBufferDirtyReceiver.bindPS(bufferIndex, bufferStorage); + mConstantBufferObserver.bindPS(bufferIndex, bufferStorage); } return gl::NoError(); @@ -3184,72 +3386,8 @@ gl::Error StateManager11::syncTransformFeedbackBuffers(const gl::Context *contex return gl::NoError(); } -// DrawCallVertexParams implementation. -DrawCallVertexParams::DrawCallVertexParams(GLint firstVertex, - GLsizei vertexCount, - GLsizei instances) - : mHasIndexRange(nullptr), - mFirstVertex(firstVertex), - mVertexCount(vertexCount), - mInstances(instances), - mBaseVertex(0) -{ -} - -// Use when in a drawElements call. -DrawCallVertexParams::DrawCallVertexParams(bool firstVertexDefinitelyZero, - const gl::HasIndexRange &hasIndexRange, - GLint baseVertex, - GLsizei instances) - : mHasIndexRange(&hasIndexRange), - mFirstVertex(), - mVertexCount(0), - mInstances(instances), - mBaseVertex(baseVertex) -{ - if (firstVertexDefinitelyZero) - { - mFirstVertex = baseVertex; - } -} - -GLint DrawCallVertexParams::firstVertex() const -{ - if (!mFirstVertex.valid()) - { - ensureResolved(); - ASSERT(mFirstVertex.valid()); - } - return mFirstVertex.value(); -} - -GLsizei DrawCallVertexParams::vertexCount() const -{ - ensureResolved(); - return mVertexCount; -} - -GLsizei DrawCallVertexParams::instances() const -{ - return mInstances; -} - -void DrawCallVertexParams::ensureResolved() const -{ - if (mHasIndexRange) - { - ASSERT(!mFirstVertex.valid() || mFirstVertex == mBaseVertex); - - // Resolve the index range now if we need to. - const auto &indexRange = mHasIndexRange->getIndexRange().value(); - mFirstVertex = mBaseVertex + static_cast(indexRange.start); - mVertexCount = static_cast(indexRange.vertexCount()); - mHasIndexRange = nullptr; - } -} - -// OnConstantBufferDirtyReceiver implementation. -StateManager11::OnConstantBufferDirtyReceiver::OnConstantBufferDirtyReceiver() +// ConstantBufferObserver implementation. +StateManager11::ConstantBufferObserver::ConstantBufferObserver() { for (size_t vsIndex = 0; vsIndex < gl::IMPLEMENTATION_MAX_VERTEX_SHADER_UNIFORM_BUFFERS; ++vsIndex) @@ -3264,34 +3402,37 @@ StateManager11::OnConstantBufferDirtyReceiver::OnConstantBufferDirtyReceiver() } } -StateManager11::OnConstantBufferDirtyReceiver::~OnConstantBufferDirtyReceiver() +StateManager11::ConstantBufferObserver::~ConstantBufferObserver() { } -void StateManager11::OnConstantBufferDirtyReceiver::onSubjectStateChange( - const gl::Context *context, - angle::SubjectIndex index, - angle::SubjectMessage message) +void StateManager11::ConstantBufferObserver::onSubjectStateChange(const gl::Context *context, + angle::SubjectIndex index, + angle::SubjectMessage message) { - StateManager11 *stateManager = GetImplAs(context)->getRenderer()->getStateManager(); - stateManager->invalidateProgramUniformBuffers(); + if (message == angle::SubjectMessage::STORAGE_CHANGED) + { + StateManager11 *stateManager = + GetImplAs(context)->getRenderer()->getStateManager(); + stateManager->invalidateProgramUniformBuffers(); + } } -void StateManager11::OnConstantBufferDirtyReceiver::bindVS(size_t index, Buffer11 *buffer) +void StateManager11::ConstantBufferObserver::bindVS(size_t index, Buffer11 *buffer) { ASSERT(buffer); ASSERT(index < mBindingsVS.size()); - mBindingsVS[index].bind(buffer->getDirectSubject()); + mBindingsVS[index].bind(buffer); } -void StateManager11::OnConstantBufferDirtyReceiver::bindPS(size_t index, Buffer11 *buffer) +void StateManager11::ConstantBufferObserver::bindPS(size_t index, Buffer11 *buffer) { ASSERT(buffer); ASSERT(index < mBindingsPS.size()); - mBindingsPS[index].bind(buffer->getDirectSubject()); + mBindingsPS[index].bind(buffer); } -void StateManager11::OnConstantBufferDirtyReceiver::reset() +void StateManager11::ConstantBufferObserver::reset() { for (angle::ObserverBinding &vsBinding : mBindingsVS) { @@ -3304,4 +3445,76 @@ void StateManager11::OnConstantBufferDirtyReceiver::reset() } } +void StateManager11::syncPrimitiveTopology(const gl::State &glState, + ProgramD3D *programD3D, + GLenum currentDrawMode) +{ + D3D11_PRIMITIVE_TOPOLOGY primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_UNDEFINED; + + switch (currentDrawMode) + { + case GL_POINTS: + { + bool usesPointSize = programD3D->usesPointSize(); + + // ProgramBinary assumes non-point rendering if gl_PointSize isn't written, + // which affects varying interpolation. Since the value of gl_PointSize is + // undefined when not written, just skip drawing to avoid unexpected results. + if (!usesPointSize && !glState.isTransformFeedbackActiveUnpaused()) + { + // Notify developers of risking undefined behavior. + WARN() << "Point rendering without writing to gl_PointSize."; + mCurrentMinimumDrawCount = std::numeric_limits::max(); + return; + } + + // If instanced pointsprites are enabled and the shader uses gl_PointSize, the topology + // must be D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST. + if (usesPointSize && mRenderer->getWorkarounds().useInstancedPointSpriteEmulation) + { + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + } + else + { + primitiveTopology = D3D11_PRIMITIVE_TOPOLOGY_POINTLIST; + } + mCurrentMinimumDrawCount = 1; + break; + } + case GL_LINES: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINELIST; + mCurrentMinimumDrawCount = 2; + break; + case GL_LINE_LOOP: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; + mCurrentMinimumDrawCount = 2; + break; + case GL_LINE_STRIP: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_LINESTRIP; + mCurrentMinimumDrawCount = 2; + break; + case GL_TRIANGLES: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + mCurrentMinimumDrawCount = + CullsEverything(glState) ? std::numeric_limits::max() : 3; + break; + case GL_TRIANGLE_STRIP: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP; + mCurrentMinimumDrawCount = + CullsEverything(glState) ? std::numeric_limits::max() : 3; + break; + // emulate fans via rewriting index buffer + case GL_TRIANGLE_FAN: + primitiveTopology = D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST; + mCurrentMinimumDrawCount = + CullsEverything(glState) ? std::numeric_limits::max() : 3; + break; + default: + UNREACHABLE(); + break; + } + + setPrimitiveTopologyInternal(primitiveTopology); +} + } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h index b8d7f757784e..a7fbfab69d98 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/StateManager11.h @@ -127,11 +127,9 @@ class ShaderConstants11 : angle::NonCopyable bool updateSamplerMetadata(SamplerMetadata *data, const gl::Texture &texture); Vertex mVertex; - bool mVertexDirty; Pixel mPixel; - bool mPixelDirty; Compute mCompute; - bool mComputeDirty; + gl::ShaderBitSet mShaderConstantsDirty; std::vector mSamplerMetadataVS; int mNumActiveVSSamplers; @@ -141,35 +139,6 @@ class ShaderConstants11 : angle::NonCopyable int mNumActiveCSSamplers; }; -class DrawCallVertexParams final : angle::NonCopyable -{ - public: - // Use when in a drawArrays call. - DrawCallVertexParams(GLint firstVertex, GLsizei vertexCount, GLsizei instances); - - // Use when in a drawElements call. - DrawCallVertexParams(bool firstVertexDefinitelyZero, - const gl::HasIndexRange &hasIndexRange, - GLint baseVertex, - GLsizei instances); - - // It should be possible to also use an overload to handle the 'slow' indirect draw path. - // TODO(jmadill): Indirect draw slow path overload. - - GLint firstVertex() const; - GLsizei vertexCount() const; - GLsizei instances() const; - - private: - void ensureResolved() const; - - mutable const gl::HasIndexRange *mHasIndexRange; - mutable Optional mFirstVertex; - mutable GLsizei mVertexCount; - GLsizei mInstances; - GLint mBaseVertex; -}; - class StateManager11 final : angle::NonCopyable { public: @@ -212,12 +181,18 @@ class StateManager11 final : angle::NonCopyable // Called by the Framebuffer11 and VertexArray11. void invalidateShaders(); - // Called by VertexArray11 to trigger attribute translation. - void invalidateVertexAttributeTranslation(); - // Called by the Program on Uniform Buffer change. Also called internally. void invalidateProgramUniformBuffers(); + // Called by TransformFeedback11. + void invalidateTransformFeedback(); + + // Called by VertexArray11. + void invalidateInputLayout(); + + // Called by VertexArray11 element array buffer sync. + void invalidateIndexBuffer(); + void setRenderTarget(ID3D11RenderTargetView *rtv, ID3D11DepthStencilView *dsv); void setRenderTargets(ID3D11RenderTargetView **rtvs, UINT numRtvs, ID3D11DepthStencilView *dsv); @@ -227,17 +202,9 @@ class StateManager11 final : angle::NonCopyable void setInputLayout(const d3d11::InputLayout *inputLayout); - // TODO(jmadill): Migrate to d3d11::Buffer. - bool queueVertexBufferChange(size_t bufferIndex, - ID3D11Buffer *buffer, - UINT stride, - UINT offset); - bool queueVertexOffsetChange(size_t bufferIndex, UINT offsetOnly); - void applyVertexBufferChanges(); - void setSingleVertexBuffer(const d3d11::Buffer *buffer, UINT stride, UINT offset); - gl::Error updateState(const gl::Context *context, GLenum drawMode); + gl::Error updateState(const gl::Context *context, const gl::DrawCallParams &drawCallParams); void setShaderResourceShared(gl::ShaderType shaderType, UINT resourceSlot, @@ -266,19 +233,6 @@ class StateManager11 final : angle::NonCopyable void setSimpleScissorRect(const gl::Rectangle &glRect); void setScissorRectD3D(const D3D11_RECT &d3dRect); - // Not handled by an internal dirty bit because of the extra draw parameters. - gl::Error applyVertexBuffer(const gl::Context *context, - GLenum mode, - const DrawCallVertexParams &vertexParams, - bool isIndexedRendering); - - gl::Error applyIndexBuffer(const gl::Context *context, - const void *indices, - GLsizei count, - GLenum type, - const gl::HasIndexRange &lazyIndexRange, - bool usePrimitiveRestartWorkaround); - void setIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset); gl::Error updateVertexOffsetsForPointSpritesEmulation(GLint startVertex, @@ -290,6 +244,9 @@ class StateManager11 final : angle::NonCopyable // Only used in testing. InputLayoutCache *getInputLayoutCache() { return &mInputLayoutCache; } + GLsizei getCurrentMinimumDrawCount() const { return mCurrentMinimumDrawCount; } + VertexDataManager *getVertexDataManager() { return &mVertexDataManager; } + private: template void setShaderResourceInternal(gl::ShaderType shaderType, @@ -315,7 +272,8 @@ class StateManager11 final : angle::NonCopyable gl::Error syncDepthStencilState(const gl::State &glState); - gl::Error syncRasterizerState(const gl::Context *context, bool pointDrawMode); + gl::Error syncRasterizerState(const gl::Context *context, + const gl::DrawCallParams &drawCallParams); void syncScissorRectangle(const gl::Rectangle &scissor, bool enabled); @@ -372,6 +330,27 @@ class StateManager11 final : angle::NonCopyable void processFramebufferInvalidation(const gl::Context *context); bool syncIndexBuffer(ID3D11Buffer *buffer, DXGI_FORMAT indexFormat, unsigned int offset); + gl::Error syncVertexBuffersAndInputLayout(const gl::Context *context, + const gl::DrawCallParams &vertexParams); + + bool setInputLayoutInternal(const d3d11::InputLayout *inputLayout); + + gl::Error applyVertexBuffers(const gl::Context *context, + const gl::DrawCallParams &drawCallParams); + // TODO(jmadill): Migrate to d3d11::Buffer. + bool queueVertexBufferChange(size_t bufferIndex, + ID3D11Buffer *buffer, + UINT stride, + UINT offset); + void applyVertexBufferChanges(); + bool setPrimitiveTopologyInternal(D3D11_PRIMITIVE_TOPOLOGY primitiveTopology); + void syncPrimitiveTopology(const gl::State &glState, + ProgramD3D *programD3D, + GLenum currentDrawMode); + + // Not handled by an internal dirty bit because it isn't synced on drawArrays calls. + gl::Error applyIndexBuffer(const gl::Context *context, + const gl::DrawCallParams &drawCallParams); enum DirtyBitType { @@ -387,6 +366,9 @@ class StateManager11 final : angle::NonCopyable DIRTY_BIT_PROGRAM_UNIFORM_BUFFERS, DIRTY_BIT_SHADERS, DIRTY_BIT_CURRENT_VALUE_ATTRIBS, + DIRTY_BIT_TRANSFORM_FEEDBACK, + DIRTY_BIT_VERTEX_BUFFERS_AND_INPUT_LAYOUT, + DIRTY_BIT_PRIMITIVE_TOPOLOGY, DIRTY_BIT_INVALID, DIRTY_BIT_MAX = DIRTY_BIT_INVALID, }; @@ -494,8 +476,6 @@ class StateManager11 final : angle::NonCopyable // Current applied input layout. ResourceSerial mCurrentInputLayout; - bool mInputLayoutIsDirty; - bool mVertexAttribsNeedTranslation; // Current applied vertex states. // TODO(jmadill): Figure out how to use ResourceSerial here. @@ -506,6 +486,8 @@ class StateManager11 final : angle::NonCopyable // Currently applied primitive topology D3D11_PRIMITIVE_TOPOLOGY mCurrentPrimitiveTopology; + GLenum mLastAppliedDrawMode; + GLsizei mCurrentMinimumDrawCount; // Currently applied shaders ResourceSerial mAppliedVertexShader; @@ -550,6 +532,9 @@ class StateManager11 final : angle::NonCopyable ResourceSerial mCurrentComputeConstantBuffer; ResourceSerial mCurrentGeometryConstantBuffer; + d3d11::Buffer mPointSpriteVertexBuffer; + d3d11::Buffer mPointSpriteIndexBuffer; + template using VertexConstantBufferArray = std::array; @@ -566,11 +551,11 @@ class StateManager11 final : angle::NonCopyable FragmentConstantBufferArray mCurrentConstantBufferPSOffset; FragmentConstantBufferArray mCurrentConstantBufferPSSize; - class OnConstantBufferDirtyReceiver : public angle::ObserverInterface + class ConstantBufferObserver : public angle::ObserverInterface { public: - OnConstantBufferDirtyReceiver(); - ~OnConstantBufferDirtyReceiver() override; + ConstantBufferObserver(); + ~ConstantBufferObserver() override; void onSubjectStateChange(const gl::Context *context, angle::SubjectIndex index, @@ -584,14 +569,12 @@ class StateManager11 final : angle::NonCopyable std::vector mBindingsVS; std::vector mBindingsPS; }; - OnConstantBufferDirtyReceiver mOnConstantBufferDirtyReceiver; + ConstantBufferObserver mConstantBufferObserver; // Currently applied transform feedback buffers Serial mAppliedTFSerial; Serial mEmptySerial; - - bool mIsTransformFeedbackCurrentlyActiveUnpaused; }; } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp index 06017751a270..47839fa76386 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TextureStorage11.cpp @@ -30,40 +30,6 @@ namespace rx { - -namespace -{ - -void InvalidateRenderTarget(const gl::Context *context, RenderTarget11 *renderTarget) -{ - if (renderTarget) - { - renderTarget->signalDirty(context); - } -} - -RenderTarget11 *GetRenderTarget(std::unique_ptr *pointer) -{ - return pointer->get(); -} - -template -RenderTarget11 *GetRenderTarget(std::pair> *pair) -{ - return pair->second.get(); -} - -template -void InvalidateRenderTargetContainer(const gl::Context *context, T *renderTargetContainer) -{ - for (auto &rt : *renderTargetContainer) - { - InvalidateRenderTarget(context, GetRenderTarget(&rt)); - } -} - -} // anonymous namespace - TextureStorage11::SamplerKey::SamplerKey() : baseLevel(0), mipLevels(0), swizzle(false), dropStencil(false) { @@ -752,9 +718,7 @@ gl::Error TextureStorage11::setData(const gl::Context *context, UINT destSubresource = getSubresourceIndex(index); const gl::InternalFormat &internalFormatInfo = - gl::GetSizedInternalFormatInfo(image->getInternalFormat()); - const gl::InternalFormat &packInfo = - gl::GetPackFormatInfo(image->getInternalFormat(), type); + gl::GetInternalFormatInfo(image->getInternalFormat(), type); gl::Box levelBox(0, 0, 0, getLevelWidth(index.mipIndex), getLevelHeight(index.mipIndex), getLevelDepth(index.mipIndex)); @@ -772,14 +736,14 @@ gl::Error TextureStorage11::setData(const gl::Context *context, const int depth = destBox ? destBox->depth : static_cast(image->getDepth()); GLuint srcRowPitch = 0; ANGLE_TRY_RESULT( - packInfo.computeRowPitch(width, unpack.alignment, unpack.rowLength), + internalFormatInfo.computeRowPitch(type, width, unpack.alignment, unpack.rowLength), srcRowPitch); GLuint srcDepthPitch = 0; - ANGLE_TRY_RESULT(packInfo.computeDepthPitch(height, unpack.imageHeight, srcRowPitch), + ANGLE_TRY_RESULT(internalFormatInfo.computeDepthPitch(height, unpack.imageHeight, srcRowPitch), srcDepthPitch); GLuint srcSkipBytes = 0; ANGLE_TRY_RESULT( - packInfo.computeSkipBytes(srcRowPitch, srcDepthPitch, unpack, index.is3D()), + internalFormatInfo.computeSkipBytes(type, srcRowPitch, srcDepthPitch, unpack, index.is3D()), srcSkipBytes); const d3d11::Format &d3d11Format = @@ -930,10 +894,6 @@ gl::Error TextureStorage11_2D::onDestroy(const gl::Context *context) mRenderer->getStateManager()->invalidateBoundViews(); } - // Invalidate RenderTargets. - InvalidateRenderTargetContainer(context, &mRenderTarget); - InvalidateRenderTarget(context, mLevelZeroRenderTarget.get()); - return gl::NoError(); } @@ -1026,18 +986,8 @@ gl::Error TextureStorage11_2D::useLevelZeroWorkaroundTexture(const gl::Context * if (lastSetting != mUseLevelZeroTexture) { - // Mark everything as dirty to be conservative. - if (mLevelZeroRenderTarget) - { - mLevelZeroRenderTarget->signalDirty(context); - } - for (auto &renderTarget : mRenderTarget) - { - if (renderTarget) - { - renderTarget->signalDirty(context); - } - } + ASSERT(mSubject); + mSubject->onStateChange(context, angle::SubjectMessage::DEPENDENT_DIRTY_BITS); } return gl::NoError(); @@ -1159,7 +1109,15 @@ gl::Error TextureStorage11_2D::ensureTextureExists(int mipLevels) desc.MiscFlags = getMiscFlags(); ANGLE_TRY(mRenderer->allocateTexture(desc, mFormatInfo, outputTexture)); - outputTexture->setDebugName("TexStorage2D.Texture"); + + if (useLevelZeroTexture) + { + outputTexture->setDebugName("TexStorage2D.Level0Texture"); + } + else + { + outputTexture->setDebugName("TexStorage2D.Texture"); + } } return gl::NoError(); @@ -1216,6 +1174,7 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::Context *context, d3d11::RenderTargetView rtv; ANGLE_TRY(mRenderer->allocateResource(rtvDesc, mLevelZeroTexture.get(), &rtv)); + rtv.setDebugName("TexStorage2D.Level0RTV"); mLevelZeroRenderTarget.reset(new TextureRenderTarget11( std::move(rtv), mLevelZeroTexture, d3d11::SharedSRV(), d3d11::SharedSRV(), @@ -1236,6 +1195,7 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::Context *context, d3d11::RenderTargetView rtv; ANGLE_TRY(mRenderer->allocateResource(rtvDesc, texture->get(), &rtv)); + rtv.setDebugName("TexStorage2D.RTV"); mRenderTarget[level].reset(new TextureRenderTarget11( std::move(rtv), *texture, *srv, *blitSRV, mFormatInfo.internalFormat, getFormatSet(), @@ -1255,6 +1215,7 @@ gl::Error TextureStorage11_2D::getRenderTarget(const gl::Context *context, d3d11::DepthStencilView dsv; ANGLE_TRY(mRenderer->allocateResource(dsvDesc, texture->get(), &dsv)); + dsv.setDebugName("TexStorage2D.DSV"); mRenderTarget[level].reset(new TextureRenderTarget11( std::move(dsv), *texture, *srv, mFormatInfo.internalFormat, getFormatSet(), @@ -1894,12 +1855,6 @@ gl::Error TextureStorage11_Cube::onDestroy(const gl::Context *context) } } - for (auto &faceRenderTargets : mRenderTarget) - { - InvalidateRenderTargetContainer(context, &faceRenderTargets); - } - InvalidateRenderTargetContainer(context, &mLevelZeroRenderTarget); - return gl::NoError(); } @@ -2544,9 +2499,6 @@ gl::Error TextureStorage11_3D::onDestroy(const gl::Context *context) } } - InvalidateRenderTargetContainer(context, &mLevelRenderTargets); - InvalidateRenderTargetContainer(context, &mLevelLayerRenderTargets); - return gl::NoError(); } @@ -2870,8 +2822,6 @@ gl::Error TextureStorage11_2DArray::onDestroy(const gl::Context *context) } mAssociatedImages.clear(); - InvalidateRenderTargetContainer(context, &mRenderTargets); - return gl::NoError(); } @@ -3251,7 +3201,6 @@ TextureStorage11_2DMultisample::TextureStorage11_2DMultisample(Renderer11 *rende gl::Error TextureStorage11_2DMultisample::onDestroy(const gl::Context *context) { - InvalidateRenderTarget(context, mRenderTarget.get()); mRenderTarget.reset(); return gl::NoError(); } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp index 4b08edf71f43..3e557be2c95b 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/TransformFeedback11.cpp @@ -46,10 +46,12 @@ void TransformFeedback11::begin(GLenum primitiveMode) mBufferOffsets[bindingIdx] = 0; } } + mRenderer->getStateManager()->invalidateTransformFeedback(); } void TransformFeedback11::end() { + mRenderer->getStateManager()->invalidateTransformFeedback(); if (mRenderer->getWorkarounds().flushAfterEndingTransformFeedback) { mRenderer->getDeviceContext()->Flush(); @@ -58,14 +60,17 @@ void TransformFeedback11::end() void TransformFeedback11::pause() { + mRenderer->getStateManager()->invalidateTransformFeedback(); } void TransformFeedback11::resume() { + mRenderer->getStateManager()->invalidateTransformFeedback(); } void TransformFeedback11::bindGenericBuffer(const gl::BindingPointer &binding) { + mRenderer->getStateManager()->invalidateTransformFeedback(); } void TransformFeedback11::bindIndexedBuffer(size_t index, @@ -73,6 +78,7 @@ void TransformFeedback11::bindIndexedBuffer(size_t index, { mIsDirty = true; mBufferOffsets[index] = static_cast(binding.getOffset()); + mRenderer->getStateManager()->invalidateTransformFeedback(); } void TransformFeedback11::onApply() diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp index 3c831b24b0d1..60e99d78d8ab 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.cpp @@ -11,6 +11,7 @@ #include "common/bitset_utils.h" #include "libANGLE/Context.h" +#include "libANGLE/renderer/d3d/IndexBuffer.h" #include "libANGLE/renderer/d3d/d3d11/Buffer11.h" #include "libANGLE/renderer/d3d/d3d11/Context11.h" @@ -18,44 +19,14 @@ using namespace angle; namespace rx { - -namespace -{ -angle::Subject *GetBufferSubject(Buffer11 *buffer11, IndexStorageType storageType) -{ - switch (storageType) - { - case IndexStorageType::Direct: - return buffer11->getDirectSubject(); - case IndexStorageType::Static: - return buffer11->getStaticSubject(); - case IndexStorageType::Dynamic: - return buffer11 ? buffer11->getStaticSubject() : nullptr; - default: - UNREACHABLE(); - return nullptr; - } -} -} // anonymous namespace - VertexArray11::VertexArray11(const gl::VertexArrayState &data) : VertexArrayImpl(data), mAttributeStorageTypes(data.getMaxAttribs(), VertexStorageType::CURRENT_VALUE), mTranslatedAttribs(data.getMaxAttribs()), - mCurrentArrayBuffers(data.getMaxAttribs()), - mCurrentElementArrayBuffer(), - mOnArrayBufferDataDirty(), - mOnElementArrayBufferDataDirty(this, mCurrentArrayBuffers.size()), mAppliedNumViewsToDivisor(1), - mLastElementType(GL_NONE), - mLastDrawElementsOffset(0), mCurrentElementArrayStorage(IndexStorageType::Invalid), - mCachedIndexInfoValid(false) + mCachedDestinationIndexType(GL_NONE) { - for (size_t attribIndex = 0; attribIndex < mCurrentArrayBuffers.size(); ++attribIndex) - { - mOnArrayBufferDataDirty.emplace_back(this, attribIndex); - } } VertexArray11::~VertexArray11() @@ -64,281 +35,268 @@ VertexArray11::~VertexArray11() void VertexArray11::destroy(const gl::Context *context) { - for (auto &buffer : mCurrentArrayBuffers) - { - if (buffer.get()) - { - buffer.set(context, nullptr); - } - } - - mCurrentElementArrayBuffer.set(context, nullptr); } -void VertexArray11::syncState(const gl::Context *context, - const gl::VertexArray::DirtyBits &dirtyBits) +gl::Error VertexArray11::syncState(const gl::Context *context, + const gl::VertexArray::DirtyBits &dirtyBits, + const gl::VertexArray::DirtyAttribBitsArray &attribBits, + const gl::VertexArray::DirtyBindingBitsArray &bindingBits) { ASSERT(dirtyBits.any()); + Renderer11 *renderer = GetImplAs(context)->getRenderer(); + StateManager11 *stateManager = renderer->getStateManager(); + // Generate a state serial. This serial is used in the program class to validate the cached // input layout, and skip recomputation in the fast path. - Renderer11 *renderer = GetImplAs(context)->getRenderer(); mCurrentStateSerial = renderer->generateSerial(); - // TODO(jmadill): Individual attribute invalidation. - renderer->getStateManager()->invalidateVertexBuffer(); + bool invalidateVertexBuffer = false; - for (auto dirtyBit : dirtyBits) + // Make sure we trigger re-translation for static index or vertex data. + for (size_t dirtyBit : dirtyBits) { - if (dirtyBit == gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER) + switch (dirtyBit) { - mCachedIndexInfoValid = false; - mLastElementType = GL_NONE; - } - else - { - size_t index = gl::VertexArray::GetVertexIndexFromDirtyBit(dirtyBit); - // TODO(jiawei.shao@intel.com): Vertex Attrib Bindings - ASSERT(index == mState.getBindingIndexFromAttribIndex(index)); - mAttribsToUpdate.set(index); - } - } -} - -bool VertexArray11::flushAttribUpdates(const gl::Context *context) -{ - if (mAttribsToUpdate.any()) - { - const auto &activeLocations = - context->getGLState().getProgram()->getActiveAttribLocationsMask(); - - // Skip attrib locations the program doesn't use. - gl::AttributesMask activeToUpdate = mAttribsToUpdate & activeLocations; - - for (auto toUpdateIndex : activeToUpdate) - { - mAttribsToUpdate.reset(toUpdateIndex); - updateVertexAttribStorage(context, toUpdateIndex); - } - - return true; - } - - return false; -} - -bool VertexArray11::updateElementArrayStorage(const gl::Context *context, - GLenum elementType, - GLenum destElementType, - const void *indices) -{ - unsigned int offset = static_cast(reinterpret_cast(indices)); - - if (mCachedIndexInfoValid && mLastElementType == elementType && - offset == mLastDrawElementsOffset) - { - // Dynamic index buffers must be re-streamed every draw. - return (mCurrentElementArrayStorage == IndexStorageType::Dynamic); - } - - gl::Buffer *newBuffer = mState.getElementArrayBuffer().get(); - gl::Buffer *oldBuffer = mCurrentElementArrayBuffer.get(); - bool needsTranslation = false; - IndexStorageType newStorageType = ClassifyIndexStorage( - context->getGLState(), newBuffer, elementType, destElementType, offset, &needsTranslation); - - if (newBuffer != oldBuffer) - { - mCurrentElementArrayBuffer.set(context, newBuffer); - } - - if (newStorageType != mCurrentElementArrayStorage || newBuffer != oldBuffer) - { - Buffer11 *newBuffer11 = SafeGetImplAs(newBuffer); - - angle::Subject *subject = GetBufferSubject(newBuffer11, newStorageType); - - mCurrentElementArrayStorage = newStorageType; - mOnElementArrayBufferDataDirty.bind(subject); - needsTranslation = true; - } - - if (mLastDrawElementsOffset != offset) - { - needsTranslation = true; - mLastDrawElementsOffset = offset; - } - - if (mLastElementType != elementType) - { - needsTranslation = true; - mLastElementType = elementType; - } - - // TODO(jmadill): We should probably promote static usage immediately, because this can change - // the storage type for dynamic buffers. - return needsTranslation || !mCachedIndexInfoValid; -} - -void VertexArray11::updateVertexAttribStorage(const gl::Context *context, size_t attribIndex) -{ - const auto &attrib = mState.getVertexAttribute(attribIndex); - const auto &binding = mState.getBindingFromAttribIndex(attribIndex); - - // Note: having an unchanged storage type doesn't mean the attribute is clean. - auto oldStorageType = mAttributeStorageTypes[attribIndex]; - auto newStorageType = ClassifyAttributeStorage(attrib, binding); - - mAttributeStorageTypes[attribIndex] = newStorageType; - - StateManager11 *stateManager = GetImplAs(context)->getRenderer()->getStateManager(); - - if (newStorageType == VertexStorageType::DYNAMIC) - { - if (oldStorageType != VertexStorageType::DYNAMIC) - { - // Sync dynamic attribs in a different set. - mAttribsToTranslate.reset(attribIndex); - mDynamicAttribsMask.set(attribIndex); - } - } - else - { - mAttribsToTranslate.set(attribIndex); - stateManager->invalidateVertexAttributeTranslation(); - - if (oldStorageType == VertexStorageType::DYNAMIC) - { - ASSERT(mDynamicAttribsMask[attribIndex]); - mDynamicAttribsMask.reset(attribIndex); - } - } - - gl::Buffer *oldBufferGL = mCurrentArrayBuffers[attribIndex].get(); - gl::Buffer *newBufferGL = binding.getBuffer().get(); - Buffer11 *oldBuffer11 = oldBufferGL ? GetImplAs(oldBufferGL) : nullptr; - Buffer11 *newBuffer11 = newBufferGL ? GetImplAs(newBufferGL) : nullptr; - - if (oldBuffer11 != newBuffer11 || oldStorageType != newStorageType) - { - angle::Subject *subject = nullptr; - - if (newStorageType == VertexStorageType::CURRENT_VALUE) - { - stateManager->invalidateCurrentValueAttrib(attribIndex); - } - else if (newBuffer11 != nullptr) - { - // Note that for static callbacks, promotion to a static buffer from a dynamic buffer - // means we need to tag dynamic buffers with static callbacks. - switch (newStorageType) + case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER: + case gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA: { - case VertexStorageType::DIRECT: - subject = newBuffer11->getDirectSubject(); - break; - case VertexStorageType::STATIC: - case VertexStorageType::DYNAMIC: - subject = newBuffer11->getStaticSubject(); - break; - default: - UNREACHABLE(); - break; + mLastDrawElementsType.reset(); + mLastDrawElementsIndices.reset(); + mLastPrimitiveRestartEnabled.reset(); + mCachedIndexInfo.reset(); + break; + } + + default: + { + size_t index = gl::VertexArray::GetVertexIndexFromDirtyBit(dirtyBit); + + // TODO(jiawei.shao@intel.com): Vertex Attrib Bindings + ASSERT(index == mState.getBindingIndexFromAttribIndex(index)); + + if (dirtyBit < gl::VertexArray::DIRTY_BIT_BINDING_MAX) + { + updateVertexAttribStorage(stateManager, dirtyBit, index); + } + else + { + ASSERT(dirtyBit >= gl::VertexArray::DIRTY_BIT_BUFFER_DATA_0 && + dirtyBit < gl::VertexArray::DIRTY_BIT_BUFFER_DATA_MAX); + if (mAttributeStorageTypes[index] == VertexStorageType::STATIC) + { + mAttribsToTranslate.set(index); + } + } + invalidateVertexBuffer = true; + break; } } - - mOnArrayBufferDataDirty[attribIndex].bind(subject); - mCurrentArrayBuffers[attribIndex].set(context, binding.getBuffer().get()); } + + if (invalidateVertexBuffer) + { + // TODO(jmadill): Individual attribute invalidation. + stateManager->invalidateVertexBuffer(); + } + + return gl::NoError(); } -bool VertexArray11::hasActiveDynamicAttrib(const gl::Context *context) +gl::Error VertexArray11::syncStateForDraw(const gl::Context *context, + const gl::DrawCallParams &drawCallParams) { - flushAttribUpdates(context); - const auto &activeLocations = - context->getGLState().getProgram()->getActiveAttribLocationsMask(); - auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); - return activeDynamicAttribs.any(); -} + Renderer11 *renderer = GetImplAs(context)->getRenderer(); + StateManager11 *stateManager = renderer->getStateManager(); -gl::Error VertexArray11::updateDirtyAndDynamicAttribs(const gl::Context *context, - VertexDataManager *vertexDataManager, - const DrawCallVertexParams &vertexParams) -{ - flushAttribUpdates(context); - - const auto &glState = context->getGLState(); - const gl::Program *program = glState.getProgram(); - const auto &activeLocations = program->getActiveAttribLocationsMask(); - const auto &attribs = mState.getVertexAttributes(); - const auto &bindings = mState.getVertexBindings(); - mAppliedNumViewsToDivisor = - (program != nullptr && program->usesMultiview()) ? program->getNumViews() : 1; + const gl::State &glState = context->getGLState(); + const gl::Program *program = glState.getProgram(); + ASSERT(program); + mAppliedNumViewsToDivisor = (program->usesMultiview() ? program->getNumViews() : 1); if (mAttribsToTranslate.any()) { - // Skip attrib locations the program doesn't use, saving for the next frame. - gl::AttributesMask dirtyActiveAttribs = (mAttribsToTranslate & activeLocations); - - for (auto dirtyAttribIndex : dirtyActiveAttribs) + const gl::AttributesMask &activeLocations = + glState.getProgram()->getActiveAttribLocationsMask(); + gl::AttributesMask activeDirtyAttribs = (mAttribsToTranslate & activeLocations); + if (activeDirtyAttribs.any()) { - mAttribsToTranslate.reset(dirtyAttribIndex); - - auto *translatedAttrib = &mTranslatedAttribs[dirtyAttribIndex]; - const auto ¤tValue = glState.getVertexAttribCurrentValue(dirtyAttribIndex); - - // Record basic attrib info - translatedAttrib->attribute = &attribs[dirtyAttribIndex]; - translatedAttrib->binding = &bindings[translatedAttrib->attribute->bindingIndex]; - translatedAttrib->currentValueType = currentValue.Type; - translatedAttrib->divisor = - translatedAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor; - - switch (mAttributeStorageTypes[dirtyAttribIndex]) - { - case VertexStorageType::DIRECT: - VertexDataManager::StoreDirectAttrib(translatedAttrib); - break; - case VertexStorageType::STATIC: - { - ANGLE_TRY(VertexDataManager::StoreStaticAttrib(context, translatedAttrib)); - break; - } - case VertexStorageType::CURRENT_VALUE: - // Current value attribs are managed by the StateManager11. - break; - default: - UNREACHABLE(); - break; - } + ANGLE_TRY(updateDirtyAttribs(context, activeDirtyAttribs)); + stateManager->invalidateInputLayout(); } } if (mDynamicAttribsMask.any()) { - auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); - if (activeDynamicAttribs.none()) + const gl::AttributesMask &activeLocations = + glState.getProgram()->getActiveAttribLocationsMask(); + gl::AttributesMask activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); + + if (activeDynamicAttribs.any()) { - return gl::NoError(); + ANGLE_TRY(updateDynamicAttribs(context, stateManager->getVertexDataManager(), + drawCallParams, activeDynamicAttribs)); + stateManager->invalidateInputLayout(); } - - for (auto dynamicAttribIndex : activeDynamicAttribs) - { - auto *dynamicAttrib = &mTranslatedAttribs[dynamicAttribIndex]; - const auto ¤tValue = glState.getVertexAttribCurrentValue(dynamicAttribIndex); - - // Record basic attrib info - dynamicAttrib->attribute = &attribs[dynamicAttribIndex]; - dynamicAttrib->binding = &bindings[dynamicAttrib->attribute->bindingIndex]; - dynamicAttrib->currentValueType = currentValue.Type; - dynamicAttrib->divisor = - dynamicAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor; - } - - ANGLE_TRY(vertexDataManager->storeDynamicAttribs( - context, &mTranslatedAttribs, activeDynamicAttribs, vertexParams.firstVertex(), - vertexParams.vertexCount(), vertexParams.instances())); } + if (drawCallParams.isDrawElements()) + { + bool restartEnabled = context->getGLState().isPrimitiveRestartEnabled(); + if (!mLastDrawElementsType.valid() || + mLastDrawElementsType.value() != drawCallParams.type() || + mLastDrawElementsIndices.value() != drawCallParams.indices() || + mLastPrimitiveRestartEnabled.value() != restartEnabled) + { + mLastDrawElementsType = drawCallParams.type(); + mLastDrawElementsIndices = drawCallParams.indices(); + mLastPrimitiveRestartEnabled = restartEnabled; + + ANGLE_TRY(updateElementArrayStorage(context, drawCallParams, restartEnabled)); + stateManager->invalidateIndexBuffer(); + } + else if (mCurrentElementArrayStorage == IndexStorageType::Dynamic) + { + stateManager->invalidateIndexBuffer(); + } + } + + return gl::NoError(); +} + +gl::Error VertexArray11::updateElementArrayStorage(const gl::Context *context, + const gl::DrawCallParams &drawCallParams, + bool restartEnabled) +{ + bool usePrimitiveRestartWorkaround = + UsePrimitiveRestartWorkaround(restartEnabled, drawCallParams.type()); + + ANGLE_TRY(GetIndexTranslationDestType(context, drawCallParams, usePrimitiveRestartWorkaround, + &mCachedDestinationIndexType)); + + unsigned int offset = + static_cast(reinterpret_cast(drawCallParams.indices())); + + mCurrentElementArrayStorage = + ClassifyIndexStorage(context->getGLState(), mState.getElementArrayBuffer().get(), + drawCallParams.type(), mCachedDestinationIndexType, offset); + + // Mark non-static buffers as irrelevant. + bool isStatic = (mCurrentElementArrayStorage == IndexStorageType::Static); + mRelevantDirtyBitsMask.set(gl::VertexArray::DIRTY_BIT_ELEMENT_ARRAY_BUFFER_DATA, isStatic); + + return gl::NoError(); +} + +void VertexArray11::updateVertexAttribStorage(StateManager11 *stateManager, + size_t dirtyBit, + size_t attribIndex) +{ + const gl::VertexAttribute &attrib = mState.getVertexAttribute(attribIndex); + const gl::VertexBinding &binding = mState.getBindingFromAttribIndex(attribIndex); + + VertexStorageType newStorageType = ClassifyAttributeStorage(attrib, binding); + + // Note: having an unchanged storage type doesn't mean the attribute is clean. + mAttribsToTranslate.set(attribIndex, newStorageType != VertexStorageType::DYNAMIC); + + if (mAttributeStorageTypes[attribIndex] == newStorageType) + return; + + mAttributeStorageTypes[attribIndex] = newStorageType; + mDynamicAttribsMask.set(attribIndex, newStorageType == VertexStorageType::DYNAMIC); + + // Mark non-static buffers as irrelevant. + size_t bufferDataDirtyBit = (gl::VertexArray::DIRTY_BIT_BUFFER_DATA_0 + attribIndex); + mRelevantDirtyBitsMask.set(bufferDataDirtyBit, newStorageType == VertexStorageType::STATIC); + + if (newStorageType == VertexStorageType::CURRENT_VALUE) + { + stateManager->invalidateCurrentValueAttrib(attribIndex); + } +} + +bool VertexArray11::hasActiveDynamicAttrib(const gl::Context *context) +{ + const auto &activeLocations = + context->getGLState().getProgram()->getActiveAttribLocationsMask(); + gl::AttributesMask activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); + return activeDynamicAttribs.any(); +} + +gl::Error VertexArray11::updateDirtyAttribs(const gl::Context *context, + const gl::AttributesMask &activeDirtyAttribs) +{ + const auto &glState = context->getGLState(); + const auto &attribs = mState.getVertexAttributes(); + const auto &bindings = mState.getVertexBindings(); + + for (size_t dirtyAttribIndex : activeDirtyAttribs) + { + mAttribsToTranslate.reset(dirtyAttribIndex); + + auto *translatedAttrib = &mTranslatedAttribs[dirtyAttribIndex]; + const auto ¤tValue = glState.getVertexAttribCurrentValue(dirtyAttribIndex); + + // Record basic attrib info + translatedAttrib->attribute = &attribs[dirtyAttribIndex]; + translatedAttrib->binding = &bindings[translatedAttrib->attribute->bindingIndex]; + translatedAttrib->currentValueType = currentValue.Type; + translatedAttrib->divisor = + translatedAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor; + + switch (mAttributeStorageTypes[dirtyAttribIndex]) + { + case VertexStorageType::DIRECT: + VertexDataManager::StoreDirectAttrib(translatedAttrib); + break; + case VertexStorageType::STATIC: + { + ANGLE_TRY(VertexDataManager::StoreStaticAttrib(context, translatedAttrib)); + break; + } + case VertexStorageType::CURRENT_VALUE: + // Current value attribs are managed by the StateManager11. + break; + default: + UNREACHABLE(); + break; + } + } + + return gl::NoError(); +} + +gl::Error VertexArray11::updateDynamicAttribs(const gl::Context *context, + VertexDataManager *vertexDataManager, + const gl::DrawCallParams &drawCallParams, + const gl::AttributesMask &activeDynamicAttribs) +{ + const auto &glState = context->getGLState(); + const auto &attribs = mState.getVertexAttributes(); + const auto &bindings = mState.getVertexBindings(); + + ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); + + for (size_t dynamicAttribIndex : activeDynamicAttribs) + { + auto *dynamicAttrib = &mTranslatedAttribs[dynamicAttribIndex]; + const auto ¤tValue = glState.getVertexAttribCurrentValue(dynamicAttribIndex); + + // Record basic attrib info + dynamicAttrib->attribute = &attribs[dynamicAttribIndex]; + dynamicAttrib->binding = &bindings[dynamicAttrib->attribute->bindingIndex]; + dynamicAttrib->currentValueType = currentValue.Type; + dynamicAttrib->divisor = dynamicAttrib->binding->getDivisor() * mAppliedNumViewsToDivisor; + } + + ANGLE_TRY(vertexDataManager->storeDynamicAttribs( + context, &mTranslatedAttribs, activeDynamicAttribs, drawCallParams.firstVertex(), + drawCallParams.vertexCount(), drawCallParams.instances())); + + VertexDataManager::PromoteDynamicAttribs(context, mTranslatedAttribs, activeDynamicAttribs, + drawCallParams.vertexCount()); + return gl::NoError(); } @@ -347,68 +305,34 @@ const std::vector &VertexArray11::getTranslatedAttribs() co return mTranslatedAttribs; } -void VertexArray11::onSubjectStateChange(const gl::Context *context, - angle::SubjectIndex index, - angle::SubjectMessage message) -{ - if (index == mAttributeStorageTypes.size()) - { - mCachedIndexInfoValid = false; - mLastElementType = GL_NONE; - mLastDrawElementsOffset = 0; - } - else - { - ASSERT(mAttributeStorageTypes[index] != VertexStorageType::CURRENT_VALUE); - - // This can change a buffer's storage, we'll need to re-check. - mAttribsToUpdate.set(index); - - // Changing the vertex attribute state can affect the vertex shader. - Renderer11 *renderer = GetImplAs(context)->getRenderer(); - renderer->getStateManager()->invalidateShaders(); - } -} - -void VertexArray11::clearDirtyAndPromoteDynamicAttribs(const gl::Context *context, - const DrawCallVertexParams &vertexParams) -{ - const gl::State &state = context->getGLState(); - const gl::Program *program = state.getProgram(); - const auto &activeLocations = program->getActiveAttribLocationsMask(); - mAttribsToUpdate &= ~activeLocations; - - // Promote to static after we clear the dirty attributes, otherwise we can lose dirtyness. - auto activeDynamicAttribs = (mDynamicAttribsMask & activeLocations); - if (activeDynamicAttribs.any()) - { - VertexDataManager::PromoteDynamicAttribs(context, mTranslatedAttribs, activeDynamicAttribs, - vertexParams.vertexCount()); - } -} - void VertexArray11::markAllAttributeDivisorsForAdjustment(int numViews) { if (mAppliedNumViewsToDivisor != numViews) { mAppliedNumViewsToDivisor = numViews; - mAttribsToUpdate.set(); + mAttribsToTranslate.set(); } } -TranslatedIndexData *VertexArray11::getCachedIndexInfo() +const TranslatedIndexData &VertexArray11::getCachedIndexInfo() const { - return &mCachedIndexInfo; + ASSERT(mCachedIndexInfo.valid()); + return mCachedIndexInfo.value(); } -void VertexArray11::setCachedIndexInfoValid() +void VertexArray11::updateCachedIndexInfo(const TranslatedIndexData &indexInfo) { - mCachedIndexInfoValid = true; + mCachedIndexInfo = indexInfo; } bool VertexArray11::isCachedIndexInfoValid() const { - return mCachedIndexInfoValid; + return mCachedIndexInfo.valid(); +} + +GLenum VertexArray11::getCachedDestinationIndexType() const +{ + return mCachedDestinationIndexType; } } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h index ee4edbff71d2..30452d7d8efa 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexArray11.h @@ -13,56 +13,61 @@ #include "libANGLE/renderer/VertexArrayImpl.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/renderer11_utils.h" -#include "libANGLE/signal_utils.h" namespace rx { class Renderer11; -class VertexArray11 : public VertexArrayImpl, public angle::ObserverInterface +class VertexArray11 : public VertexArrayImpl { public: VertexArray11(const gl::VertexArrayState &data); ~VertexArray11() override; void destroy(const gl::Context *context) override; - void syncState(const gl::Context *context, - const gl::VertexArray::DirtyBits &dirtyBits) override; - // This will flush any pending attrib updates and then check the dynamic attribs mask. + // Does not apply any state updates - these are done in syncStateForDraw which as access to + // the DrawCallParams before a draw. + gl::Error syncState(const gl::Context *context, + const gl::VertexArray::DirtyBits &dirtyBits, + const gl::VertexArray::DirtyAttribBitsArray &attribBits, + const gl::VertexArray::DirtyBindingBitsArray &bindingBits) override; + + // Applied buffer pointers are updated here. + gl::Error syncStateForDraw(const gl::Context *context, + const gl::DrawCallParams &drawCallParams); + + // This will check the dynamic attribs mask. bool hasActiveDynamicAttrib(const gl::Context *context); - gl::Error updateDirtyAndDynamicAttribs(const gl::Context *context, - VertexDataManager *vertexDataManager, - const DrawCallVertexParams &vertexParams); - void clearDirtyAndPromoteDynamicAttribs(const gl::Context *context, - const DrawCallVertexParams &vertexParams); const std::vector &getTranslatedAttribs() const; - // Observer implementation - void onSubjectStateChange(const gl::Context *context, - angle::SubjectIndex index, - angle::SubjectMessage message) override; - Serial getCurrentStateSerial() const { return mCurrentStateSerial; } // In case of a multi-view program change, we have to update all attributes so that the divisor // is adjusted. void markAllAttributeDivisorsForAdjustment(int numViews); - bool flushAttribUpdates(const gl::Context *context); - // Returns true if the element array buffer needs to be translated. - bool updateElementArrayStorage(const gl::Context *context, - GLenum elementType, - GLenum destElementType, - const void *indices); + gl::Error updateElementArrayStorage(const gl::Context *context, + const gl::DrawCallParams &drawCallParams, + bool restartEnabled); - TranslatedIndexData *getCachedIndexInfo(); - void setCachedIndexInfoValid(); + const TranslatedIndexData &getCachedIndexInfo() const; + void updateCachedIndexInfo(const TranslatedIndexData &indexInfo); bool isCachedIndexInfoValid() const; + GLenum getCachedDestinationIndexType() const; + private: - void updateVertexAttribStorage(const gl::Context *context, size_t attribIndex); + void updateVertexAttribStorage(StateManager11 *stateManager, + size_t dirtyBit, + size_t attribIndex); + gl::Error updateDirtyAttribs(const gl::Context *context, + const gl::AttributesMask &activeDirtyAttribs); + gl::Error updateDynamicAttribs(const gl::Context *context, + VertexDataManager *vertexDataManager, + const gl::DrawCallParams &drawCallParams, + const gl::AttributesMask &activeDynamicAttribs); std::vector mAttributeStorageTypes; std::vector mTranslatedAttribs; @@ -70,30 +75,24 @@ class VertexArray11 : public VertexArrayImpl, public angle::ObserverInterface // The mask of attributes marked as dynamic. gl::AttributesMask mDynamicAttribsMask; - // A mask of attributes that need to be re-evaluated. - gl::AttributesMask mAttribsToUpdate; + // Mask applied to dirty bits on syncState. If a bit is on, it is relevant. + gl::VertexArray::DirtyBits mRelevantDirtyBitsMask; // A set of attributes we know are dirty, and need to be re-translated. gl::AttributesMask mAttribsToTranslate; - // We need to keep a safe pointer to the Buffer so we can attach the correct dirty callbacks. - std::vector> mCurrentArrayBuffers; - gl::BindingPointer mCurrentElementArrayBuffer; - - std::vector mOnArrayBufferDataDirty; - angle::ObserverBinding mOnElementArrayBufferDataDirty; - Serial mCurrentStateSerial; // The numViews value used to adjust the divisor. int mAppliedNumViewsToDivisor; // If the index buffer needs re-streaming. - GLenum mLastElementType; - unsigned int mLastDrawElementsOffset; + Optional mLastDrawElementsType; + Optional mLastDrawElementsIndices; + Optional mLastPrimitiveRestartEnabled; IndexStorageType mCurrentElementArrayStorage; - TranslatedIndexData mCachedIndexInfo; - bool mCachedIndexInfoValid; + Optional mCachedIndexInfo; + GLenum mCachedDestinationIndexType; }; } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp index 69e598784cba..3649cbe1f283 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.cpp @@ -96,7 +96,7 @@ gl::Error VertexBuffer11::storeVertexAttributes(const gl::VertexAttribute &attri const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int offset, const uint8_t *sourceData) diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h index ab619ae50305..7778c31dcd7a 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/VertexBuffer11.h @@ -31,7 +31,7 @@ class VertexBuffer11 : public VertexBuffer const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int offset, const uint8_t *sourceData) override; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp index ff8034f797b8..49ef80694d6e 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.cpp @@ -21,7 +21,6 @@ #include "libANGLE/formatutils.h" #include "libANGLE/renderer/d3d/BufferD3D.h" #include "libANGLE/renderer/d3d/FramebufferD3D.h" -#include "libANGLE/renderer/d3d/IndexBuffer.h" #include "libANGLE/renderer/d3d/d3d11/RenderTarget11.h" #include "libANGLE/renderer/d3d/d3d11/Renderer11.h" #include "libANGLE/renderer/d3d/d3d11/dxgi_support_table.h" @@ -2358,57 +2357,15 @@ bool UsePrimitiveRestartWorkaround(bool primitiveRestartFixedIndexEnabled, GLenu return (!primitiveRestartFixedIndexEnabled && type == GL_UNSIGNED_SHORT); } -bool IsStreamingIndexData(const gl::Context *context, GLenum srcType) -{ - const auto &glState = context->getGLState(); - gl::Buffer *glBuffer = glState.getVertexArray()->getElementArrayBuffer().get(); - - // Case 1: the indices are passed by pointer, which forces the streaming of index data - if (glBuffer == nullptr) - { - return true; - } - - bool primitiveRestartWorkaround = - UsePrimitiveRestartWorkaround(glState.isPrimitiveRestartEnabled(), srcType); - - BufferD3D *buffer = GetImplAs(glBuffer); - const GLenum dstType = (srcType == GL_UNSIGNED_INT || primitiveRestartWorkaround) - ? GL_UNSIGNED_INT - : GL_UNSIGNED_SHORT; - - // Case 2a: the buffer can be used directly - if (buffer->supportsDirectBinding() && dstType == srcType) - { - return false; - } - - // Case 2b: use a static translated copy or fall back to streaming - StaticIndexBufferInterface *staticBuffer = buffer->getStaticIndexBuffer(); - if (staticBuffer == nullptr) - { - return true; - } - - if ((staticBuffer->getBufferSize() == 0) || (staticBuffer->getIndexType() != dstType)) - { - return true; - } - - return false; -} - IndexStorageType ClassifyIndexStorage(const gl::State &glState, const gl::Buffer *elementArrayBuffer, GLenum elementType, GLenum destElementType, - unsigned int offset, - bool *needsTranslation) + unsigned int offset) { // No buffer bound means we are streaming from a client pointer. if (!elementArrayBuffer || !IsOffsetAligned(elementType, offset)) { - *needsTranslation = true; return IndexStorageType::Dynamic; } @@ -2416,7 +2373,6 @@ IndexStorageType ClassifyIndexStorage(const gl::State &glState, BufferD3D *bufferD3D = GetImplAs(elementArrayBuffer); if (bufferD3D->supportsDirectBinding() && destElementType == elementType) { - *needsTranslation = false; return IndexStorageType::Direct; } @@ -2424,15 +2380,10 @@ IndexStorageType ClassifyIndexStorage(const gl::State &glState, StaticIndexBufferInterface *staticBuffer = bufferD3D->getStaticIndexBuffer(); if (staticBuffer != nullptr) { - // Need to re-translate the static data if has never been used, or changed type. - *needsTranslation = - (staticBuffer->getBufferSize() == 0 || staticBuffer->getIndexType() != destElementType); return IndexStorageType::Static; } // Static buffer not available, fall back to streaming. - *needsTranslation = true; return IndexStorageType::Dynamic; } - } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h index 35dff28bfa6f..f3a958689c5a 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/renderer11_utils.h @@ -33,7 +33,6 @@ class Renderer11; class RenderTarget11; struct Renderer11DeviceCaps; -using RenderTargetArray = std::array; using RTVArray = std::array; namespace gl_d3d11 @@ -398,7 +397,6 @@ enum class StagingAccess bool UsePresentPathFast(const Renderer11 *renderer, const gl::FramebufferAttachment *colorbuffer); bool UsePrimitiveRestartWorkaround(bool primitiveRestartFixedIndexEnabled, GLenum type); -bool IsStreamingIndexData(const gl::Context *context, GLenum srcType); enum class IndexStorageType { @@ -421,8 +419,7 @@ IndexStorageType ClassifyIndexStorage(const gl::State &glState, const gl::Buffer *elementArrayBuffer, GLenum elementType, GLenum destElementType, - unsigned int offset, - bool *needsTranslation); + unsigned int offset); } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp index d0026b4ef849..990d1d426018 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.cpp @@ -258,7 +258,8 @@ gl::Error Blit9::copy2D(const gl::Context *context, IDirect3DSurface9 *destSurface = nullptr; TextureStorage9 *storage9 = GetAs(storage); - gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_2D, level, true, &destSurface); + gl::Error error = + storage9->getSurfaceLevel(context, gl::TextureTarget::_2D, level, true, &destSurface); if (error.isError()) { SafeRelease(source); @@ -281,7 +282,7 @@ gl::Error Blit9::copyCube(const gl::Context *context, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level) { gl::Error error = initialize(); @@ -330,7 +331,7 @@ gl::Error Blit9::copyTexture(const gl::Context *context, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool flipY, bool premultiplyAlpha, @@ -354,8 +355,8 @@ gl::Error Blit9::copyTexture(const gl::Context *context, ANGLE_TRY(sourceStorage9->getBaseTexture(context, &sourceTexture)); IDirect3DSurface9 *sourceSurface = nullptr; - ANGLE_TRY( - sourceStorage9->getSurfaceLevel(context, GL_TEXTURE_2D, sourceLevel, true, &sourceSurface)); + ANGLE_TRY(sourceStorage9->getSurfaceLevel(context, gl::TextureTarget::_2D, sourceLevel, true, + &sourceSurface)); IDirect3DSurface9 *destSurface = nullptr; gl::Error error = diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h index 026874f8ae38..5913787959ce 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Blit9.h @@ -11,8 +11,7 @@ #include "common/angleutils.h" #include "libANGLE/Error.h" - -#include +#include "libANGLE/PackedGLEnums.h" namespace gl { @@ -51,7 +50,7 @@ class Blit9 : angle::NonCopyable GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level); gl::Error copyTexture(const gl::Context *context, const gl::Texture *source, @@ -60,7 +59,7 @@ class Blit9 : angle::NonCopyable GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool flipY, bool premultiplyAlpha, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp index 5b7cd68fe175..5dd8f7aba048 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Context9.cpp @@ -63,13 +63,13 @@ FramebufferImpl *Context9::createFramebuffer(const gl::FramebufferState &data) TextureImpl *Context9::createTexture(const gl::TextureState &state) { - switch (state.getTarget()) + switch (state.getType()) { - case GL_TEXTURE_2D: + case gl::TextureType::_2D: return new TextureD3D_2D(state, mRenderer); - case GL_TEXTURE_CUBE_MAP: + case gl::TextureType::CubeMap: return new TextureD3D_Cube(state, mRenderer); - case GL_TEXTURE_EXTERNAL_OES: + case gl::TextureType::External: return new TextureD3D_External(state, mRenderer); default: UNREACHABLE(); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp index dff12e03f849..992c65fbc1b9 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.cpp @@ -24,7 +24,6 @@ namespace rx { - Framebuffer9::Framebuffer9(const gl::FramebufferState &data, Renderer9 *renderer) : FramebufferD3D(data, renderer), mRenderer(renderer) { @@ -61,10 +60,8 @@ gl::Error Framebuffer9::invalidateSub(const gl::Context *context, gl::Error Framebuffer9::clearImpl(const gl::Context *context, const ClearParameters &clearParams) { - const gl::FramebufferAttachment *colorAttachment = mState.getColorAttachment(0); - const gl::FramebufferAttachment *depthStencilAttachment = mState.getDepthOrStencilAttachment(); - - ANGLE_TRY(mRenderer->applyRenderTarget(context, colorAttachment, depthStencilAttachment)); + ANGLE_TRY(mRenderer->applyRenderTarget(context, mRenderTargetCache.getColors()[0], + mRenderTargetCache.getDepthStencil())); const gl::State &glState = context->getGLState(); float nearZ = glState.getNearPlane(); @@ -74,7 +71,8 @@ gl::Error Framebuffer9::clearImpl(const gl::Context *context, const ClearParamet mRenderer->setScissorRectangle(glState.getScissor(), glState.isScissorTestEnabled()); - return mRenderer->clear(context, clearParams, colorAttachment, depthStencilAttachment); + return mRenderer->clear(context, clearParams, mRenderTargetCache.getColors()[0], + mRenderTargetCache.getDepthStencil()); } gl::Error Framebuffer9::readPixelsImpl(const gl::Context *context, @@ -111,15 +109,17 @@ gl::Error Framebuffer9::readPixelsImpl(const gl::Context *context, HRESULT result; IDirect3DSurface9 *systemSurface = nullptr; - bool directToPixels = !pack.reverseRowOrder && pack.alignment <= 4 && mRenderer->getShareHandleSupport() && - area.x == 0 && area.y == 0 && - static_cast(area.width) == desc.Width && static_cast(area.height) == desc.Height && - desc.Format == D3DFMT_A8R8G8B8 && format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE; + bool directToPixels = + !pack.reverseRowOrder && pack.alignment <= 4 && mRenderer->getShareHandleSupport() && + area.x == 0 && area.y == 0 && static_cast(area.width) == desc.Width && + static_cast(area.height) == desc.Height && desc.Format == D3DFMT_A8R8G8B8 && + format == GL_BGRA_EXT && type == GL_UNSIGNED_BYTE; if (directToPixels) { // Use the pixels ptr as a shared handle to write directly into client's memory result = device->CreateOffscreenPlainSurface(desc.Width, desc.Height, desc.Format, - D3DPOOL_SYSTEMMEM, &systemSurface, reinterpret_cast(&pixels)); + D3DPOOL_SYSTEMMEM, &systemSurface, + reinterpret_cast(&pixels)); if (FAILED(result)) { // Try again without the shared handle @@ -408,4 +408,11 @@ gl::Error Framebuffer9::getSamplePosition(size_t index, GLfloat *xy) const return gl::InternalError() << "getSamplePosition is unsupported to d3d9."; } +gl::Error Framebuffer9::syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) +{ + ANGLE_TRY(FramebufferD3D::syncState(context, dirtyBits)); + ANGLE_TRY(mRenderTargetCache.update(context, mState, dirtyBits)); + return gl::NoError(); +} } // namespace rx diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h index d2b46435ee28..2cca4c0c405f 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Framebuffer9.h @@ -9,7 +9,9 @@ #ifndef LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_ #define LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_ +#include "libANGLE/renderer/RenderTargetCache.h" #include "libANGLE/renderer/d3d/FramebufferD3D.h" +#include "libANGLE/renderer/d3d/d3d9/renderer9_utils.h" namespace rx { @@ -32,6 +34,19 @@ class Framebuffer9 : public FramebufferD3D gl::Error getSamplePosition(size_t index, GLfloat *xy) const override; + gl::Error syncState(const gl::Context *context, + const gl::Framebuffer::DirtyBits &dirtyBits) override; + + const gl::AttachmentArray &getCachedColorRenderTargets() const + { + return mRenderTargetCache.getColors(); + } + + const RenderTarget9 *getCachedDepthStencilRenderTarget() const + { + return mRenderTargetCache.getDepthStencil(); + } + private: gl::Error clearImpl(const gl::Context *context, const ClearParameters &clearParams) override; @@ -56,8 +71,10 @@ class Framebuffer9 : public FramebufferD3D GLenum getRenderTargetImplementationFormat(RenderTargetD3D *renderTarget) const override; Renderer9 *const mRenderer; + + RenderTargetCache mRenderTargetCache; }; -} +} // namespace rx #endif // LIBANGLE_RENDERER_D3D_D3D9_FRAMBUFFER9_H_ diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp index fa0d1420bcb6..f3d71c70cb8c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.cpp @@ -237,13 +237,16 @@ gl::Error Image9::CopyImage(const gl::Context *context, return gl::NoError(); } -bool Image9::redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) +bool Image9::redefine(gl::TextureType type, + GLenum internalformat, + const gl::Extents &size, + bool forceRelease) { // 3D textures are not supported by the D3D9 backend. ASSERT(size.depth <= 1); // Only 2D and cube texture are supported by the D3D9 backend. - ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_CUBE_MAP); + ASSERT(type == gl::TextureType::_2D || type == gl::TextureType::CubeMap); if (mWidth != size.width || mHeight != size.height || @@ -254,6 +257,7 @@ bool Image9::redefine(GLenum target, GLenum internalformat, const gl::Extents &s mWidth = size.width; mHeight = size.height; mDepth = size.depth; + mType = type; mInternalFormat = internalformat; // compute the d3d format that will be used @@ -407,7 +411,8 @@ gl::Error Image9::setManagedSurface2D(const gl::Context *context, { IDirect3DSurface9 *surface = nullptr; TextureStorage9 *storage9 = GetAs(storage); - gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_2D, level, false, &surface); + gl::Error error = + storage9->getSurfaceLevel(context, gl::TextureTarget::_2D, level, false, &surface); if (error.isError()) { return error; @@ -422,7 +427,7 @@ gl::Error Image9::setManagedSurfaceCube(const gl::Context *context, { IDirect3DSurface9 *surface = nullptr; TextureStorage9 *storage9 = GetAs(storage); - gl::Error error = storage9->getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, + gl::Error error = storage9->getSurfaceLevel(context, gl::CubeFaceIndexToTextureTarget(face), level, false, &surface); if (error.isError()) { @@ -546,10 +551,10 @@ gl::Error Image9::loadData(const gl::Context *context, // 3D textures are not supported by the D3D9 backend. ASSERT(area.z == 0 && area.depth == 1); - const gl::InternalFormat &packFormat = gl::GetPackFormatInfo(mInternalFormat, type); + const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat); GLuint inputRowPitch = 0; ANGLE_TRY_RESULT( - packFormat.computeRowPitch(area.width, unpack.alignment, unpack.rowLength), + formatInfo.computeRowPitch(type, area.width, unpack.alignment, unpack.rowLength), inputRowPitch); ASSERT(!applySkipImages); ASSERT(unpack.skipPixels == 0); @@ -589,7 +594,7 @@ gl::Error Image9::loadCompressedData(const gl::Context *context, const gl::InternalFormat &formatInfo = gl::GetSizedInternalFormatInfo(mInternalFormat); GLsizei inputRowPitch = 0; - ANGLE_TRY_RESULT(formatInfo.computeRowPitch(area.width, 1, 0), inputRowPitch); + ANGLE_TRY_RESULT(formatInfo.computeRowPitch(GL_UNSIGNED_BYTE, area.width, 1, 0), inputRowPitch); GLsizei inputDepthPitch = 0; ANGLE_TRY_RESULT(formatInfo.computeDepthPitch(area.height, 0, inputDepthPitch), inputDepthPitch); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h index 01c60dc4fb43..cda5a1a1cf0b 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Image9.h @@ -40,7 +40,10 @@ class Image9 : public ImageD3D bool unpackPremultiplyAlpha, bool unpackUnmultiplyAlpha); - bool redefine(GLenum target, GLenum internalformat, const gl::Extents &size, bool forceRelease) override; + bool redefine(gl::TextureType type, + GLenum internalformat, + const gl::Extents &size, + bool forceRelease) override; D3DFORMAT getD3DFormat() const; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp index e75d8ce83a12..c2b83d1f1d89 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.cpp @@ -121,10 +121,10 @@ Renderer9::Renderer9(egl::Display *display) : RendererD3D(display), mStateManage mMaxNullColorbufferLRU = 0; for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++) { - mNullColorbufferCache[i].lruCount = 0; - mNullColorbufferCache[i].width = 0; - mNullColorbufferCache[i].height = 0; - mNullColorbufferCache[i].buffer = nullptr; + mNullRenderTargetCache[i].lruCount = 0; + mNullRenderTargetCache[i].width = 0; + mNullRenderTargetCache[i].height = 0; + mNullRenderTargetCache[i].renderTarget = nullptr; } mAppliedVertexShader = nullptr; @@ -937,7 +937,7 @@ gl::Error Renderer9::setSamplerState(const gl::Context *context, gl::Texture *texture, const gl::SamplerState &samplerState) { - CurSamplerState &appliedSampler = (type == gl::SHADER_FRAGMENT) + CurSamplerState &appliedSampler = (type == gl::ShaderType::Fragment) ? mCurPixelSamplerStates[index] : mCurVertexSamplerStates[index]; @@ -955,7 +955,7 @@ gl::Error Renderer9::setSamplerState(const gl::Context *context, if (appliedSampler.forceSet || appliedSampler.baseLevel != baseLevel || memcmp(&samplerState, &appliedSampler, sizeof(gl::SamplerState)) != 0) { - int d3dSamplerOffset = (type == gl::SHADER_FRAGMENT) ? 0 : D3DVERTEXTEXTURESAMPLER0; + int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0; int d3dSampler = index + d3dSamplerOffset; mDevice->SetSamplerState(d3dSampler, D3DSAMP_ADDRESSU, @@ -995,13 +995,13 @@ gl::Error Renderer9::setTexture(const gl::Context *context, int index, gl::Texture *texture) { - int d3dSamplerOffset = (type == gl::SHADER_FRAGMENT) ? 0 : D3DVERTEXTEXTURESAMPLER0; + int d3dSamplerOffset = (type == gl::ShaderType::Fragment) ? 0 : D3DVERTEXTEXTURESAMPLER0; int d3dSampler = index + d3dSamplerOffset; IDirect3DBaseTexture9 *d3dTexture = nullptr; bool forceSetTexture = false; std::vector &appliedTextures = - (type == gl::SHADER_FRAGMENT) ? mCurPixelTextures : mCurVertexTextures; + (type == gl::ShaderType::Fragment) ? mCurPixelTextures : mCurVertexTextures; if (texture) { @@ -1041,9 +1041,12 @@ gl::Error Renderer9::updateState(const gl::Context *context, GLenum drawMode) // Applies the render target surface, depth stencil surface, viewport rectangle and // scissor rectangle to the renderer gl::Framebuffer *framebuffer = glState.getDrawFramebuffer(); - ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit() && framebuffer->cachedComplete()); + ASSERT(framebuffer && !framebuffer->hasAnyDirtyBit()); - ANGLE_TRY(applyRenderTarget(context, framebuffer)); + Framebuffer9 *framebuffer9 = GetImplAs(framebuffer); + + ANGLE_TRY(applyRenderTarget(context, framebuffer9->getCachedColorRenderTargets()[0], + framebuffer9->getCachedDepthStencilRenderTarget())); // Setting viewport state setViewport(glState.getViewport(), glState.getNearPlane(), glState.getFarPlane(), drawMode, @@ -1158,109 +1161,89 @@ bool Renderer9::applyPrimitiveType(GLenum mode, GLsizei count, bool usesPointSiz return mPrimitiveCount > 0; } -gl::Error Renderer9::getNullColorbuffer(const gl::Context *context, - const gl::FramebufferAttachment *depthbuffer, - const gl::FramebufferAttachment **outColorBuffer) +gl::Error Renderer9::getNullColorRenderTarget(const gl::Context *context, + const RenderTarget9 *depthRenderTarget, + const RenderTarget9 **outColorRenderTarget) { - ASSERT(depthbuffer); + ASSERT(depthRenderTarget); - const gl::Extents &size = depthbuffer->getSize(); + const gl::Extents &size = depthRenderTarget->getExtents(); // search cached nullcolorbuffers for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++) { - if (mNullColorbufferCache[i].buffer != nullptr && - mNullColorbufferCache[i].width == size.width && - mNullColorbufferCache[i].height == size.height) + if (mNullRenderTargetCache[i].renderTarget != nullptr && + mNullRenderTargetCache[i].width == size.width && + mNullRenderTargetCache[i].height == size.height) { - mNullColorbufferCache[i].lruCount = ++mMaxNullColorbufferLRU; - *outColorBuffer = mNullColorbufferCache[i].buffer; + mNullRenderTargetCache[i].lruCount = ++mMaxNullColorbufferLRU; + *outColorRenderTarget = mNullRenderTargetCache[i].renderTarget; return gl::NoError(); } } - auto *implFactory = context->getImplementation(); - - gl::Renderbuffer *nullRenderbuffer = new gl::Renderbuffer(implFactory, 0); - gl::Error error = nullRenderbuffer->setStorage(context, GL_NONE, size.width, size.height); - if (error.isError()) - { - SafeDelete(nullRenderbuffer); - return error; - } - - gl::FramebufferAttachment *nullbuffer = new gl::FramebufferAttachment( - context, GL_RENDERBUFFER, GL_NONE, gl::ImageIndex::MakeInvalid(), nullRenderbuffer); + RenderTargetD3D *nullRenderTarget = nullptr; + ANGLE_TRY(createRenderTarget(size.width, size.height, GL_NONE, 0, &nullRenderTarget)); // add nullbuffer to the cache - NullColorbufferCacheEntry *oldest = &mNullColorbufferCache[0]; + NullRenderTargetCacheEntry *oldest = &mNullRenderTargetCache[0]; for (int i = 1; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++) { - if (mNullColorbufferCache[i].lruCount < oldest->lruCount) + if (mNullRenderTargetCache[i].lruCount < oldest->lruCount) { - oldest = &mNullColorbufferCache[i]; + oldest = &mNullRenderTargetCache[i]; } } - delete oldest->buffer; - oldest->buffer = nullbuffer; + SafeDelete(oldest->renderTarget); + oldest->renderTarget = GetAs(nullRenderTarget); oldest->lruCount = ++mMaxNullColorbufferLRU; oldest->width = size.width; oldest->height = size.height; - *outColorBuffer = nullbuffer; + *outColorRenderTarget = oldest->renderTarget; return gl::NoError(); } gl::Error Renderer9::applyRenderTarget(const gl::Context *context, - const gl::FramebufferAttachment *colorAttachment, - const gl::FramebufferAttachment *depthStencilAttachment) + const RenderTarget9 *colorRenderTargetIn, + const RenderTarget9 *depthStencilRenderTarget) { - const gl::FramebufferAttachment *renderAttachment = colorAttachment; - // if there is no color attachment we must synthesize a NULL colorattachment // to keep the D3D runtime happy. This should only be possible if depth texturing. - if (renderAttachment == nullptr) + const RenderTarget9 *colorRenderTarget = colorRenderTargetIn; + if (colorRenderTarget == nullptr) { - ANGLE_TRY(getNullColorbuffer(context, depthStencilAttachment, &renderAttachment)); + ANGLE_TRY(getNullColorRenderTarget(context, depthStencilRenderTarget, &colorRenderTarget)); } - ASSERT(renderAttachment != nullptr); + ASSERT(colorRenderTarget != nullptr); size_t renderTargetWidth = 0; size_t renderTargetHeight = 0; D3DFORMAT renderTargetFormat = D3DFMT_UNKNOWN; - RenderTarget9 *renderTarget = nullptr; - ANGLE_TRY(renderAttachment->getRenderTarget(context, &renderTarget)); - ASSERT(renderTarget); - bool renderTargetChanged = false; - unsigned int renderTargetSerial = renderTarget->getSerial(); + unsigned int renderTargetSerial = colorRenderTarget->getSerial(); if (renderTargetSerial != mAppliedRenderTargetSerial) { // Apply the render target on the device - IDirect3DSurface9 *renderTargetSurface = renderTarget->getSurface(); + IDirect3DSurface9 *renderTargetSurface = colorRenderTarget->getSurface(); ASSERT(renderTargetSurface); mDevice->SetRenderTarget(0, renderTargetSurface); SafeRelease(renderTargetSurface); - renderTargetWidth = renderTarget->getWidth(); - renderTargetHeight = renderTarget->getHeight(); - renderTargetFormat = renderTarget->getD3DFormat(); + renderTargetWidth = colorRenderTarget->getWidth(); + renderTargetHeight = colorRenderTarget->getHeight(); + renderTargetFormat = colorRenderTarget->getD3DFormat(); mAppliedRenderTargetSerial = renderTargetSerial; renderTargetChanged = true; } - RenderTarget9 *depthStencilRenderTarget = nullptr; - unsigned int depthStencilSerial = 0; - - if (depthStencilAttachment != nullptr) + unsigned int depthStencilSerial = 0; + if (depthStencilRenderTarget != nullptr) { - ANGLE_TRY(depthStencilAttachment->getRenderTarget(context, &depthStencilRenderTarget)); - ASSERT(depthStencilRenderTarget); - depthStencilSerial = depthStencilRenderTarget->getSerial(); } @@ -1278,8 +1261,11 @@ gl::Error Renderer9::applyRenderTarget(const gl::Context *context, mDevice->SetDepthStencilSurface(depthStencilSurface); SafeRelease(depthStencilSurface); - depthSize = depthStencilAttachment->getDepthSize(); - stencilSize = depthStencilAttachment->getStencilSize(); + const gl::InternalFormat &format = + gl::GetSizedInternalFormatInfo(depthStencilRenderTarget->getInternalFormat()); + + depthSize = format.depthBits; + stencilSize = format.stencilBits; } else { @@ -1304,13 +1290,6 @@ gl::Error Renderer9::applyRenderTarget(const gl::Context *context, return gl::NoError(); } -gl::Error Renderer9::applyRenderTarget(const gl::Context *context, - const gl::Framebuffer *framebuffer) -{ - return applyRenderTarget(context, framebuffer->getColorbuffer(0), - framebuffer->getDepthOrStencilbuffer()); -} - gl::Error Renderer9::applyVertexBuffer(const gl::Context *context, GLenum mode, GLint first, @@ -1338,11 +1317,12 @@ gl::Error Renderer9::applyIndexBuffer(const gl::Context *context, GLenum type, TranslatedIndexData *indexInfo) { - gl::VertexArray *vao = context->getGLState().getVertexArray(); - gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); - const auto &lazyIndexRange = context->getParams(); + gl::VertexArray *vao = context->getGLState().getVertexArray(); + gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); + const gl::DrawCallParams &drawCallParams = context->getParams(); - GLenum dstType = GetIndexTranslationDestType(type, lazyIndexRange, false); + GLenum dstType = GL_NONE; + ANGLE_TRY(GetIndexTranslationDestType(context, drawCallParams, false, &dstType)); ANGLE_TRY(mIndexDataManager->prepareIndexData(context, type, dstType, count, elementArrayBuffer, indices, indexInfo)); @@ -1417,8 +1397,10 @@ gl::Error Renderer9::drawElementsImpl(const gl::Context *context, ANGLE_TRY(applyIndexBuffer(context, indices, count, mode, type, &indexInfo)); - const auto &lazyIndexRange = context->getParams(); - const gl::IndexRange &indexRange = lazyIndexRange.getIndexRange().value(); + const auto &drawCallParams = context->getParams(); + ANGLE_TRY(drawCallParams.ensureIndexRangeResolved(context)); + + const gl::IndexRange &indexRange = drawCallParams.getIndexRange(); size_t vertexCount = indexRange.vertexCount(); ANGLE_TRY(applyVertexBuffer(context, mode, static_cast(indexRange.start), static_cast(vertexCount), instances, &indexInfo)); @@ -1824,8 +1806,8 @@ gl::Error Renderer9::applyShaders(const gl::Context *context, GLenum drawMode) gl::Error Renderer9::applyUniforms(ProgramD3D *programD3D) { - // Skip updates if we're not dirty. Note that D3D9 cannot have compute. - if (!programD3D->areVertexUniformsDirty() && !programD3D->areFragmentUniformsDirty()) + // Skip updates if we're not dirty. Note that D3D9 cannot have compute or geometry. + if (!programD3D->anyShaderUniformsDirty()) { return gl::NoError(); } @@ -1927,8 +1909,8 @@ void Renderer9::applyUniformnbv(const D3DUniform *targetUniform, const GLint *v) gl::Error Renderer9::clear(const gl::Context *context, const ClearParameters &clearParams, - const gl::FramebufferAttachment *colorBuffer, - const gl::FramebufferAttachment *depthStencilBuffer) + const RenderTarget9 *colorRenderTarget, + const RenderTarget9 *depthStencilRenderTarget) { if (clearParams.colorType != GL_FLOAT) { @@ -1953,23 +1935,16 @@ gl::Error Renderer9::clear(const gl::Context *context, DWORD stencil = clearParams.stencilValue & 0x000000FF; unsigned int stencilUnmasked = 0x0; - if (clearParams.clearStencil && depthStencilBuffer->getStencilSize() > 0) + if (clearParams.clearStencil && depthStencilRenderTarget) { - ASSERT(depthStencilBuffer != nullptr); - - RenderTargetD3D *stencilRenderTarget = nullptr; - gl::Error error = depthStencilBuffer->getRenderTarget(context, &stencilRenderTarget); - if (error.isError()) + const gl::InternalFormat &depthStencilFormat = + gl::GetSizedInternalFormatInfo(depthStencilRenderTarget->getInternalFormat()); + if (depthStencilFormat.stencilBits > 0) { - return error; + const d3d9::D3DFormat &d3dFormatInfo = + d3d9::GetD3DFormatInfo(depthStencilRenderTarget->getD3DFormat()); + stencilUnmasked = (0x1 << d3dFormatInfo.stencilBits) - 1; } - - RenderTarget9 *stencilRenderTarget9 = GetAs(stencilRenderTarget); - ASSERT(stencilRenderTarget9); - - const d3d9::D3DFormat &d3dFormatInfo = - d3d9::GetD3DFormatInfo(stencilRenderTarget9->getD3DFormat()); - stencilUnmasked = (0x1 << d3dFormatInfo.stencilBits) - 1; } const bool needMaskedStencilClear = @@ -1980,21 +1955,12 @@ gl::Error Renderer9::clear(const gl::Context *context, D3DCOLOR color = D3DCOLOR_ARGB(255, 0, 0, 0); if (clearColor) { - ASSERT(colorBuffer != nullptr); + ASSERT(colorRenderTarget != nullptr); - RenderTargetD3D *colorRenderTarget = nullptr; - gl::Error error = colorBuffer->getRenderTarget(context, &colorRenderTarget); - if (error.isError()) - { - return error; - } - - RenderTarget9 *colorRenderTarget9 = GetAs(colorRenderTarget); - ASSERT(colorRenderTarget9); - - const gl::InternalFormat &formatInfo = *colorBuffer->getFormat().info; + const gl::InternalFormat &formatInfo = + gl::GetSizedInternalFormatInfo(colorRenderTarget->getInternalFormat()); const d3d9::D3DFormat &d3dFormatInfo = - d3d9::GetD3DFormatInfo(colorRenderTarget9->getD3DFormat()); + d3d9::GetD3DFormatInfo(colorRenderTarget->getD3DFormat()); color = D3DCOLOR_ARGB(gl::unorm<8>((formatInfo.alphaBits == 0 && d3dFormatInfo.alphaBits > 0) @@ -2240,11 +2206,7 @@ void Renderer9::releaseDeviceResources() for (int i = 0; i < NUM_NULL_COLORBUFFER_CACHE_ENTRIES; i++) { - if (mNullColorbufferCache[i].buffer) - { - mNullColorbufferCache[i].buffer->detach(mDisplay->getProxyContext()); - } - SafeDelete(mNullColorbufferCache[i].buffer); + SafeDelete(mNullRenderTargetCache[i].renderTarget); } } @@ -2380,7 +2342,7 @@ bool Renderer9::isRemovedDeviceResettable() const SafeRelease(d3d9Ex); #else - ASSERT(UNREACHABLE()); + UNREACHABLE(); #endif return success; @@ -2511,7 +2473,7 @@ gl::Error Renderer9::copyImageCube(const gl::Context *context, GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level) { RECT rect; @@ -2558,7 +2520,7 @@ gl::Error Renderer9::copyTexture(const gl::Context *context, GLenum destType, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -2694,7 +2656,7 @@ gl::Error Renderer9::loadExecutable(const uint8_t *function, switch (type) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: { IDirect3DVertexShader9 *vshader = nullptr; gl::Error error = createVertexShader((DWORD *)function, length, &vshader); @@ -2705,7 +2667,7 @@ gl::Error Renderer9::loadExecutable(const uint8_t *function, *outExecutable = new ShaderExecutable9(function, length, vshader); } break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: { IDirect3DPixelShader9 *pshader = nullptr; gl::Error error = createPixelShader((DWORD *)function, length, &pshader); @@ -2739,10 +2701,10 @@ gl::Error Renderer9::compileToExecutable(gl::InfoLog &infoLog, switch (type) { - case gl::SHADER_VERTEX: + case gl::ShaderType::Vertex: profileStream << "vs"; break; - case gl::SHADER_FRAGMENT: + case gl::ShaderType::Fragment: profileStream << "ps"; break; default: @@ -3036,7 +2998,7 @@ GLenum Renderer9::getVertexComponentType(gl::VertexFormatType vertexFormatType) gl::ErrorOrResult Renderer9::getVertexSpaceRequired(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const { if (!attrib.enabled) @@ -3259,7 +3221,8 @@ gl::Error Renderer9::applyTextures(const gl::Context *context, gl::ShaderType sh } else { - GLenum textureType = programD3D->getSamplerTextureType(shaderType, samplerIndex); + gl::TextureType textureType = + programD3D->getSamplerTextureType(shaderType, samplerIndex); // Texture is not sampler complete or it is in use by the framebuffer. Bind the // incomplete texture. @@ -3272,8 +3235,9 @@ gl::Error Renderer9::applyTextures(const gl::Context *context, gl::ShaderType sh } // Set all the remaining textures to NULL - size_t samplerCount = (shaderType == gl::SHADER_FRAGMENT) ? caps.maxTextureImageUnits - : caps.maxVertexTextureImageUnits; + size_t samplerCount = (shaderType == gl::ShaderType::Fragment) + ? caps.maxTextureImageUnits + : caps.maxVertexTextureImageUnits; // TODO(jmadill): faster way? for (size_t samplerIndex = samplerRange; samplerIndex < samplerCount; samplerIndex++) @@ -3286,8 +3250,8 @@ gl::Error Renderer9::applyTextures(const gl::Context *context, gl::ShaderType sh gl::Error Renderer9::applyTextures(const gl::Context *context) { - ANGLE_TRY(applyTextures(context, gl::SHADER_VERTEX)); - ANGLE_TRY(applyTextures(context, gl::SHADER_FRAGMENT)); + ANGLE_TRY(applyTextures(context, gl::ShaderType::Vertex)); + ANGLE_TRY(applyTextures(context, gl::ShaderType::Fragment)); return gl::NoError(); } diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h index 7912ea070bf6..0d5f450da194 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/Renderer9.h @@ -36,6 +36,7 @@ class Blit9; class Context9; class IndexDataManager; class ProgramD3D; +class RenderTarget9; class StreamingIndexBufferInterface; class StaticIndexBufferInterface; class VertexDataManager; @@ -139,10 +140,9 @@ class Renderer9 : public RendererD3D GLenum frontFace, bool ignoreViewport); - gl::Error applyRenderTarget(const gl::Context *context, const gl::Framebuffer *frameBuffer); gl::Error applyRenderTarget(const gl::Context *context, - const gl::FramebufferAttachment *colorAttachment, - const gl::FramebufferAttachment *depthStencilAttachment); + const RenderTarget9 *colorRenderTarget, + const RenderTarget9 *depthStencilRenderTarget); gl::Error applyUniforms(ProgramD3D *programD3D); bool applyPrimitiveType(GLenum primitiveType, GLsizei elementCount, bool usesPointSize); gl::Error applyVertexBuffer(const gl::Context *context, @@ -160,8 +160,8 @@ class Renderer9 : public RendererD3D gl::Error clear(const gl::Context *context, const ClearParameters &clearParams, - const gl::FramebufferAttachment *colorBuffer, - const gl::FramebufferAttachment *depthStencilBuffer); + const RenderTarget9 *colorRenderTarget, + const RenderTarget9 *depthStencilRenderTarget); void markAllStateDirty(); @@ -201,7 +201,7 @@ class Renderer9 : public RendererD3D GLenum destFormat, const gl::Offset &destOffset, TextureStorage *storage, - GLenum target, + gl::TextureTarget target, GLint level) override; gl::Error copyImage3D(const gl::Context *context, const gl::Framebuffer *framebuffer, @@ -226,7 +226,7 @@ class Renderer9 : public RendererD3D GLenum destType, const gl::Offset &destOffset, TextureStorage *storage, - GLenum destTarget, + gl::TextureTarget destTarget, GLint destLevel, bool unpackFlipY, bool unpackPremultiplyAlpha, @@ -346,7 +346,7 @@ class Renderer9 : public RendererD3D // function. gl::ErrorOrResult getVertexSpaceRequired(const gl::VertexAttribute &attrib, const gl::VertexBinding &binding, - GLsizei count, + size_t count, GLsizei instances) const override; gl::Error copyToRenderTarget(IDirect3DSurface9 *dest, @@ -436,9 +436,9 @@ class Renderer9 : public RendererD3D gl::Error getCountingIB(size_t count, StaticIndexBufferInterface **outIB); - gl::Error getNullColorbuffer(const gl::Context *context, - const gl::FramebufferAttachment *depthbuffer, - const gl::FramebufferAttachment **outColorBuffer); + gl::Error getNullColorRenderTarget(const gl::Context *context, + const RenderTarget9 *depthRenderTarget, + const RenderTarget9 **outColorRenderTarget); D3DPOOL getBufferPool(DWORD usage) const; @@ -523,13 +523,16 @@ class Renderer9 : public RendererD3D { NUM_NULL_COLORBUFFER_CACHE_ENTRIES = 12 }; - struct NullColorbufferCacheEntry + struct NullRenderTargetCacheEntry { UINT lruCount; int width; int height; - gl::FramebufferAttachment *buffer; - } mNullColorbufferCache[NUM_NULL_COLORBUFFER_CACHE_ENTRIES]; + RenderTarget9 *renderTarget; + }; + + std::array + mNullRenderTargetCache; UINT mMaxNullColorbufferLRU; std::vector mTranslatedAttribCache; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp index b0ea8254ebc0..12ffa0e47522 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.cpp @@ -154,12 +154,12 @@ TextureStorage9_2D::~TextureStorage9_2D() // Increments refcount on surface. // caller must Release() the returned surface gl::Error TextureStorage9_2D::getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) { - ASSERT(target == GL_TEXTURE_2D); + ASSERT(target == gl::TextureTarget::_2D); IDirect3DBaseTexture9 *baseTexture = nullptr; gl::Error error = getBaseTexture(context, &baseTexture); @@ -204,7 +204,7 @@ gl::Error TextureStorage9_2D::getRenderTarget(const gl::Context *context, } IDirect3DSurface9 *surface = nullptr; - error = getSurfaceLevel(context, GL_TEXTURE_2D, index.mipIndex, false, &surface); + error = getSurfaceLevel(context, gl::TextureTarget::_2D, index.mipIndex, false, &surface); if (error.isError()) { return error; @@ -230,14 +230,15 @@ gl::Error TextureStorage9_2D::generateMipmap(const gl::Context *context, const gl::ImageIndex &destIndex) { IDirect3DSurface9 *upper = nullptr; - gl::Error error = getSurfaceLevel(context, GL_TEXTURE_2D, sourceIndex.mipIndex, false, &upper); + gl::Error error = + getSurfaceLevel(context, gl::TextureTarget::_2D, sourceIndex.mipIndex, false, &upper); if (error.isError()) { return error; } IDirect3DSurface9 *lower = nullptr; - error = getSurfaceLevel(context, GL_TEXTURE_2D, destIndex.mipIndex, true, &lower); + error = getSurfaceLevel(context, gl::TextureTarget::_2D, destIndex.mipIndex, true, &lower); if (error.isError()) { SafeRelease(upper); @@ -290,14 +291,14 @@ gl::Error TextureStorage9_2D::copyToStorage(const gl::Context *context, TextureS for (int i = 0; i < levels; ++i) { IDirect3DSurface9 *srcSurf = nullptr; - gl::Error error = getSurfaceLevel(context, GL_TEXTURE_2D, i, false, &srcSurf); + gl::Error error = getSurfaceLevel(context, gl::TextureTarget::_2D, i, false, &srcSurf); if (error.isError()) { return error; } IDirect3DSurface9 *dstSurf = nullptr; - error = dest9->getSurfaceLevel(context, GL_TEXTURE_2D, i, true, &dstSurf); + error = dest9->getSurfaceLevel(context, gl::TextureTarget::_2D, i, true, &dstSurf); if (error.isError()) { SafeRelease(srcSurf); @@ -336,12 +337,12 @@ TextureStorage9_EGLImage::~TextureStorage9_EGLImage() } gl::Error TextureStorage9_EGLImage::getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool, IDirect3DSurface9 **outSurface) { - ASSERT(target == GL_TEXTURE_2D); + ASSERT(target == gl::TextureTarget::_2D); ASSERT(level == 0); RenderTargetD3D *renderTargetD3D = nullptr; @@ -477,7 +478,7 @@ TextureStorage9_Cube::~TextureStorage9_Cube() // Increments refcount on surface. // caller must Release() the returned surface gl::Error TextureStorage9_Cube::getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) @@ -517,7 +518,8 @@ gl::Error TextureStorage9_Cube::getRenderTarget(const gl::Context *context, ASSERT(outRT); ASSERT(index.mipIndex == 0); - ASSERT(index.type == GL_TEXTURE_CUBE_MAP && gl::IsCubeMapTextureTarget(index.target)); + ASSERT(index.type == gl::TextureType::CubeMap && + gl::TextureTargetToType(index.target) == gl::TextureType::CubeMap); const size_t renderTargetIndex = index.cubeMapFaceIndex(); if (mRenderTarget[renderTargetIndex] == nullptr && isRenderTarget()) @@ -610,21 +612,19 @@ gl::Error TextureStorage9_Cube::copyToStorage(const gl::Context *context, TextureStorage9_Cube *dest9 = GetAs(destStorage); int levels = getLevelCount(); - for (int f = 0; f < static_cast(gl::CUBE_FACE_COUNT); f++) + for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets()) { for (int i = 0; i < levels; i++) { IDirect3DSurface9 *srcSurf = nullptr; - gl::Error error = - getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, false, &srcSurf); + gl::Error error = getSurfaceLevel(context, face, i, false, &srcSurf); if (error.isError()) { return error; } IDirect3DSurface9 *dstSurf = nullptr; - error = dest9->getSurfaceLevel(context, GL_TEXTURE_CUBE_MAP_POSITIVE_X + f, i, true, - &dstSurf); + error = dest9->getSurfaceLevel(context, face, i, true, &dstSurf); if (error.isError()) { SafeRelease(srcSurf); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h index 2f51901931eb..9835bad942c4 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/TextureStorage9.h @@ -33,10 +33,10 @@ class TextureStorage9 : public TextureStorage DWORD getUsage() const; virtual gl::Error getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, - IDirect3DSurface9 **outSurface) = 0; + IDirect3DSurface9 **outSurface) = 0; virtual gl::Error getBaseTexture(const gl::Context *context, IDirect3DBaseTexture9 **outTexture) = 0; @@ -79,7 +79,7 @@ class TextureStorage9_2D : public TextureStorage9 ~TextureStorage9_2D() override; gl::Error getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) override; @@ -105,7 +105,7 @@ class TextureStorage9_EGLImage final : public TextureStorage9 ~TextureStorage9_EGLImage() override; gl::Error getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) override; @@ -130,7 +130,7 @@ class TextureStorage9_Cube : public TextureStorage9 ~TextureStorage9_Cube() override; gl::Error getSurfaceLevel(const gl::Context *context, - GLenum target, + gl::TextureTarget target, int level, bool dirty, IDirect3DSurface9 **outSurface) override; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h index 0f4410b8ded7..2c04f472a0a8 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexArray9.h @@ -23,8 +23,10 @@ class VertexArray9 : public VertexArrayImpl public: VertexArray9(const gl::VertexArrayState &data) : VertexArrayImpl(data) {} - void syncState(const gl::Context *context, - const gl::VertexArray::DirtyBits &dirtyBits) override; + gl::Error syncState(const gl::Context *context, + const gl::VertexArray::DirtyBits &dirtyBits, + const gl::VertexArray::DirtyAttribBitsArray &attribBits, + const gl::VertexArray::DirtyBindingBitsArray &bindingBits) override; ~VertexArray9() override {} @@ -34,13 +36,16 @@ class VertexArray9 : public VertexArrayImpl Serial mCurrentStateSerial; }; -inline void VertexArray9::syncState(const gl::Context *context, - const gl::VertexArray::DirtyBits &dirtyBits) +inline gl::Error VertexArray9::syncState(const gl::Context *context, + const gl::VertexArray::DirtyBits &dirtyBits, + const gl::VertexArray::DirtyAttribBitsArray &attribBits, + const gl::VertexArray::DirtyBindingBitsArray &bindingBits) { ASSERT(dirtyBits.any()); Renderer9 *renderer = GetImplAs(context)->getRenderer(); mCurrentStateSerial = renderer->generateSerial(); + return gl::NoError(); } -} +} // namespace rx #endif // LIBANGLE_RENDERER_D3D_D3D9_VERTEXARRAY9_H_ diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp index c0b80a847c3c..51af37aae863 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.cpp @@ -61,7 +61,7 @@ gl::Error VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int offset, const uint8_t *sourceData) @@ -71,8 +71,8 @@ gl::Error VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib return gl::OutOfMemory() << "Internal vertex buffer is not initialized."; } - int inputStride = static_cast(gl::ComputeVertexAttributeStride(attrib, binding)); - int elementSize = static_cast(gl::ComputeVertexAttributeTypeSize(attrib)); + size_t inputStride = gl::ComputeVertexAttributeStride(attrib, binding); + size_t elementSize = gl::ComputeVertexAttributeTypeSize(attrib); DWORD lockFlags = mDynamicUsage ? D3DLOCK_NOOVERWRITE : 0; @@ -105,7 +105,7 @@ gl::Error VertexBuffer9::storeVertexAttributes(const gl::VertexAttribute &attrib if (!needsConversion && inputStride == elementSize) { - size_t copySize = static_cast(count) * static_cast(inputStride); + size_t copySize = count * inputStride; memcpy(mapPtr, input, copySize); } else diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h index 983616f4e407..90defb317095 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/VertexBuffer9.h @@ -28,7 +28,7 @@ class VertexBuffer9 : public VertexBuffer const gl::VertexBinding &binding, GLenum currentValueType, GLint start, - GLsizei count, + size_t count, GLsizei instances, unsigned int offset, const uint8_t *sourceData) override; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp index c9dc3a573aab..9066313946ac 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.cpp @@ -156,31 +156,32 @@ D3DCULL ConvertCullMode(gl::CullFaceMode cullFace, GLenum frontFace) return cull; } -D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace) +D3DCUBEMAP_FACES ConvertCubeFace(gl::TextureTarget cubeFace) { D3DCUBEMAP_FACES face = D3DCUBEMAP_FACE_POSITIVE_X; switch (cubeFace) { - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - face = D3DCUBEMAP_FACE_POSITIVE_X; - break; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - face = D3DCUBEMAP_FACE_NEGATIVE_X; - break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - face = D3DCUBEMAP_FACE_POSITIVE_Y; - break; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - face = D3DCUBEMAP_FACE_NEGATIVE_Y; - break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - face = D3DCUBEMAP_FACE_POSITIVE_Z; - break; - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - face = D3DCUBEMAP_FACE_NEGATIVE_Z; - break; - default: UNREACHABLE(); + case gl::TextureTarget::CubeMapPositiveX: + face = D3DCUBEMAP_FACE_POSITIVE_X; + break; + case gl::TextureTarget::CubeMapNegativeX: + face = D3DCUBEMAP_FACE_NEGATIVE_X; + break; + case gl::TextureTarget::CubeMapPositiveY: + face = D3DCUBEMAP_FACE_POSITIVE_Y; + break; + case gl::TextureTarget::CubeMapNegativeY: + face = D3DCUBEMAP_FACE_NEGATIVE_Y; + break; + case gl::TextureTarget::CubeMapPositiveZ: + face = D3DCUBEMAP_FACE_POSITIVE_Z; + break; + case gl::TextureTarget::CubeMapNegativeZ: + face = D3DCUBEMAP_FACE_NEGATIVE_Z; + break; + default: + UNREACHABLE(); } return face; diff --git a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h index bbbf72672109..8d83d870fe50 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d9/renderer9_utils.h @@ -34,7 +34,7 @@ D3DBLENDOP ConvertBlendOp(GLenum blendOp); D3DSTENCILOP ConvertStencilOp(GLenum stencilOp); D3DTEXTUREADDRESS ConvertTextureWrap(GLenum wrap); D3DCULL ConvertCullMode(gl::CullFaceMode cullFace, GLenum frontFace); -D3DCUBEMAP_FACES ConvertCubeFace(GLenum cubeFace); +D3DCUBEMAP_FACES ConvertCubeFace(gl::TextureTarget cubeFace); DWORD ConvertColorMask(bool red, bool green, bool blue, bool alpha); D3DTEXTUREFILTERTYPE ConvertMagFilter(GLenum magFilter, float maxAnisotropy); void ConvertMinFilter(GLenum minFilter, D3DTEXTUREFILTERTYPE *d3dMinFilter, D3DTEXTUREFILTERTYPE *d3dMipFilter, diff --git a/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp index 6da1a7a2bc92..997c9069e35c 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/load_functions_table_autogen.cpp @@ -148,6 +148,18 @@ LoadImageFunctionInfo ALPHA8_EXT_to_R8G8B8A8_UNORM(GLenum type) } } +LoadImageFunctionInfo ALPHA8_EXT_to_R8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadToNative, false); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo BGR565_ANGLEX_to_B5G6R5_UNORM(GLenum type) { switch (type) @@ -648,7 +660,7 @@ LoadImageFunctionInfo LUMINANCE32F_EXT_to_default(GLenum type) } } -LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_default(GLenum type) +LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_R8G8B8A8_UNORM(GLenum type) { switch (type) { @@ -660,7 +672,19 @@ LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_default(GLenum type) } } -LoadImageFunctionInfo LUMINANCE8_EXT_to_default(GLenum type) +LoadImageFunctionInfo LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadToNative, false); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + +LoadImageFunctionInfo LUMINANCE8_EXT_to_R8G8B8A8_UNORM(GLenum type) { switch (type) { @@ -672,6 +696,18 @@ LoadImageFunctionInfo LUMINANCE8_EXT_to_default(GLenum type) } } +LoadImageFunctionInfo LUMINANCE8_EXT_to_R8_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_BYTE: + return LoadImageFunctionInfo(LoadToNative, false); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo LUMINANCE_ALPHA_to_R16G16B16A16_FLOAT(GLenum type) { switch (type) @@ -1206,6 +1242,18 @@ LoadImageFunctionInfo RGB565_to_B5G6R5_UNORM(GLenum type) } } +LoadImageFunctionInfo RGB565_to_R5G6B5_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_SHORT_5_6_5: + return LoadImageFunctionInfo(LoadToNative, false); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo RGB565_to_R8G8B8A8_UNORM(GLenum type) { switch (type) @@ -1220,6 +1268,18 @@ LoadImageFunctionInfo RGB565_to_R8G8B8A8_UNORM(GLenum type) } } +LoadImageFunctionInfo RGB5_A1_to_A1R5G5B5_UNORM(GLenum type) +{ + switch (type) + { + case GL_UNSIGNED_SHORT_5_5_5_1: + return LoadImageFunctionInfo(LoadRGB5A1ToA1RGB5, true); + default: + UNREACHABLE(); + return LoadImageFunctionInfo(UnreachableLoadFunction, true); + } +} + LoadImageFunctionInfo RGB5_A1_to_B5G5R5A1_UNORM(GLenum type) { switch (type) @@ -1577,6 +1637,8 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, Format::ID angleForma return ALPHA8_EXT_to_A8_UNORM; case Format::ID::R8G8B8A8_UNORM: return ALPHA8_EXT_to_R8G8B8A8_UNORM; + case Format::ID::R8_UNORM: + return ALPHA8_EXT_to_R8_UNORM; default: break; } @@ -1867,9 +1929,31 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, Format::ID angleForma case GL_LUMINANCE32F_EXT: return LUMINANCE32F_EXT_to_default; case GL_LUMINANCE8_ALPHA8_EXT: - return LUMINANCE8_ALPHA8_EXT_to_default; + { + switch (angleFormat) + { + case Format::ID::R8G8B8A8_UNORM: + return LUMINANCE8_ALPHA8_EXT_to_R8G8B8A8_UNORM; + case Format::ID::R8G8_UNORM: + return LUMINANCE8_ALPHA8_EXT_to_R8G8_UNORM; + default: + break; + } + break; + } case GL_LUMINANCE8_EXT: - return LUMINANCE8_EXT_to_default; + { + switch (angleFormat) + { + case Format::ID::R8G8B8A8_UNORM: + return LUMINANCE8_EXT_to_R8G8B8A8_UNORM; + case Format::ID::R8_UNORM: + return LUMINANCE8_EXT_to_R8_UNORM; + default: + break; + } + break; + } case GL_LUMINANCE_ALPHA: { switch (angleFormat) @@ -2279,6 +2363,8 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, Format::ID angleForma { case Format::ID::B5G6R5_UNORM: return RGB565_to_B5G6R5_UNORM; + case Format::ID::R5G6B5_UNORM: + return RGB565_to_R5G6B5_UNORM; case Format::ID::R8G8B8A8_UNORM: return RGB565_to_R8G8B8A8_UNORM; default: @@ -2290,6 +2376,8 @@ LoadFunctionMap GetLoadFunctionsMap(GLenum internalFormat, Format::ID angleForma { switch (angleFormat) { + case Format::ID::A1R5G5B5_UNORM: + return RGB5_A1_to_A1R5G5B5_UNORM; case Format::ID::B5G5R5A1_UNORM: return RGB5_A1_to_B5G5R5A1_UNORM; case Format::ID::R8G8B8A8_UNORM: diff --git a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp index 4737af9768f8..2d74f661412e 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp +++ b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.cpp @@ -477,22 +477,23 @@ void IncompleteTextureSet::onDestroy(const gl::Context *context) // Clear incomplete textures. for (auto &incompleteTexture : mIncompleteTextures) { - ANGLE_SWALLOW_ERR(incompleteTexture.second->onDestroy(context)); - incompleteTexture.second.set(context, nullptr); + if (incompleteTexture.get() != nullptr) + { + ANGLE_SWALLOW_ERR(incompleteTexture->onDestroy(context)); + incompleteTexture.set(context, nullptr); + } } - mIncompleteTextures.clear(); } gl::Error IncompleteTextureSet::getIncompleteTexture( const gl::Context *context, - GLenum type, + gl::TextureType type, MultisampleTextureInitializer *multisampleInitializer, gl::Texture **textureOut) { - auto iter = mIncompleteTextures.find(type); - if (iter != mIncompleteTextures.end()) + *textureOut = mIncompleteTextures[type].get(); + if (*textureOut != nullptr) { - *textureOut = iter->second.get(); return gl::NoError(); } @@ -505,12 +506,12 @@ gl::Error IncompleteTextureSet::getIncompleteTexture( const gl::Box area(0, 0, 0, 1, 1, 1); // If a texture is external use a 2D texture for the incomplete texture - GLenum createType = (type == GL_TEXTURE_EXTERNAL_OES) ? GL_TEXTURE_2D : type; + gl::TextureType createType = (type == gl::TextureType::External) ? gl::TextureType::_2D : type; gl::Texture *tex = new gl::Texture(implFactory, std::numeric_limits::max(), createType); angle::UniqueObjectPointer t(tex, context); - if (createType == GL_TEXTURE_2D_MULTISAMPLE) + if (createType == gl::TextureType::_2DMultisample) { ANGLE_TRY(t->setStorageMultisample(context, createType, 1, GL_RGBA8, colorSize, true)); } @@ -519,24 +520,23 @@ gl::Error IncompleteTextureSet::getIncompleteTexture( ANGLE_TRY(t->setStorage(context, createType, 1, GL_RGBA8, colorSize)); } - if (type == GL_TEXTURE_CUBE_MAP) + if (type == gl::TextureType::CubeMap) { - for (GLenum face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; - face++) + for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets()) { ANGLE_TRY( t->setSubImage(context, unpack, face, 0, area, GL_RGBA, GL_UNSIGNED_BYTE, color)); } } - else if (type == GL_TEXTURE_2D_MULTISAMPLE) + else if (type == gl::TextureType::_2DMultisample) { // Call a specialized clear function to init a multisample texture. ANGLE_TRY(multisampleInitializer->initializeMultisampleTextureToBlack(context, t.get())); } else { - ANGLE_TRY( - t->setSubImage(context, unpack, createType, 0, area, GL_RGBA, GL_UNSIGNED_BYTE, color)); + ANGLE_TRY(t->setSubImage(context, unpack, gl::NonCubeTextureTypeToTarget(createType), 0, + area, GL_RGBA, GL_UNSIGNED_BYTE, color)); } t->syncState(); diff --git a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h index 8a60307812fe..250e68928a17 100644 --- a/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h +++ b/gfx/angle/checkout/src/libANGLE/renderer/renderer_utils.h @@ -250,7 +250,7 @@ class IncompleteTextureSet final : angle::NonCopyable void onDestroy(const gl::Context *context); gl::Error getIncompleteTexture(const gl::Context *context, - GLenum type, + gl::TextureType type, MultisampleTextureInitializer *multisampleInitializer, gl::Texture **textureOut); diff --git a/gfx/angle/checkout/src/libANGLE/validationEGL.cpp b/gfx/angle/checkout/src/libANGLE/validationEGL.cpp index 3714fe8bdc64..cf024b862c9f 100644 --- a/gfx/angle/checkout/src/libANGLE/validationEGL.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationEGL.cpp @@ -25,28 +25,28 @@ namespace egl { namespace { -size_t GetMaximumMipLevel(const gl::Context *context, GLenum target) +size_t GetMaximumMipLevel(const gl::Context *context, gl::TextureType type) { const gl::Caps &caps = context->getCaps(); size_t maxDimension = 0; - switch (target) + switch (type) { - case GL_TEXTURE_2D: + case gl::TextureType::_2D: + case gl::TextureType::_2DArray: + case gl::TextureType::_2DMultisample: maxDimension = caps.max2DTextureSize; break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case gl::TextureType::Rectangle: maxDimension = caps.maxRectangleTextureSize; break; - case GL_TEXTURE_CUBE_MAP: + case gl::TextureType::CubeMap: maxDimension = caps.maxCubeMapTextureSize; break; - case GL_TEXTURE_3D: + case gl::TextureType::_3D: maxDimension = caps.max3DTextureSize; break; - case GL_TEXTURE_2D_ARRAY: - maxDimension = caps.max2DTextureSize; - break; + default: UNREACHABLE(); } @@ -56,13 +56,12 @@ size_t GetMaximumMipLevel(const gl::Context *context, GLenum target) bool TextureHasNonZeroMipLevelsSpecified(const gl::Context *context, const gl::Texture *texture) { - size_t maxMip = GetMaximumMipLevel(context, texture->getTarget()); + size_t maxMip = GetMaximumMipLevel(context, texture->getType()); for (size_t level = 1; level < maxMip; level++) { - if (texture->getTarget() == GL_TEXTURE_CUBE_MAP) + if (texture->getType() == gl::TextureType::CubeMap) { - for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget; - face++) + for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets()) { if (texture->getFormat(face, level).valid()) { @@ -72,7 +71,8 @@ bool TextureHasNonZeroMipLevelsSpecified(const gl::Context *context, const gl::T } else { - if (texture->getFormat(texture->getTarget(), level).valid()) + if (texture->getFormat(gl::NonCubeTextureTypeToTarget(texture->getType()), level) + .valid()) { return true; } @@ -84,8 +84,8 @@ bool TextureHasNonZeroMipLevelsSpecified(const gl::Context *context, const gl::T bool CubeTextureHasUnspecifiedLevel0Face(const gl::Texture *texture) { - ASSERT(texture->getTarget() == GL_TEXTURE_CUBE_MAP); - for (GLenum face = gl::FirstCubeMapTextureTarget; face <= gl::LastCubeMapTextureTarget; face++) + ASSERT(texture->getType() == gl::TextureType::CubeMap); + for (gl::TextureTarget face : gl::AllCubeFaceTextureTargets()) { if (!texture->getFormat(face, 0).valid()) { @@ -738,6 +738,20 @@ Error ValidateCreateContext(Display *display, Config *configuration, gl::Context } break; + case EGL_EXTENSIONS_ENABLED_ANGLE: + if (!display->getExtensions().createContextExtensionsEnabled) + { + return EglBadAttribute() + << "Attribute EGL_EXTENSIONS_ENABLED_ANGLE " + "requires EGL_ANGLE_create_context_extensions_enabled."; + } + if (value != EGL_TRUE && value != EGL_FALSE) + { + return EglBadAttribute() << "EGL_EXTENSIONS_ENABLED_ANGLE must be " + "either EGL_TRUE or EGL_FALSE."; + } + break; + default: return EglBadAttribute() << "Unknown attribute."; } @@ -1479,7 +1493,7 @@ Error ValidateCreateImageKHR(const Display *display, const gl::Texture *texture = context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer)); - if (texture == nullptr || texture->getTarget() != GL_TEXTURE_2D) + if (texture == nullptr || texture->getType() != gl::TextureType::_2D) { return EglBadParameter() << "target is not a 2D texture."; } @@ -1490,8 +1504,8 @@ Error ValidateCreateImageKHR(const Display *display, } EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0); - if (texture->getWidth(GL_TEXTURE_2D, static_cast(level)) == 0 || - texture->getHeight(GL_TEXTURE_2D, static_cast(level)) == 0) + if (texture->getWidth(gl::TextureTarget::_2D, static_cast(level)) == 0 || + texture->getHeight(gl::TextureTarget::_2D, static_cast(level)) == 0) { return EglBadParameter() << "target 2D texture does not have a valid size at specified level."; @@ -1521,7 +1535,7 @@ Error ValidateCreateImageKHR(const Display *display, const gl::Texture *texture = context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer)); - if (texture == nullptr || texture->getTarget() != GL_TEXTURE_CUBE_MAP) + if (texture == nullptr || texture->getType() != gl::TextureType::CubeMap) { return EglBadParameter() << "target is not a cubemap texture."; } @@ -1532,7 +1546,7 @@ Error ValidateCreateImageKHR(const Display *display, } EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0); - GLenum cubeMapFace = egl_gl::EGLCubeMapTargetToGLCubeMapTarget(target); + gl::TextureTarget cubeMapFace = egl_gl::EGLCubeMapTargetToCubeMapTarget(target); if (texture->getWidth(cubeMapFace, static_cast(level)) == 0 || texture->getHeight(cubeMapFace, static_cast(level)) == 0) { @@ -1566,7 +1580,7 @@ Error ValidateCreateImageKHR(const Display *display, const gl::Texture *texture = context->getTexture(egl_gl::EGLClientBufferToGLObjectHandle(buffer)); - if (texture == nullptr || texture->getTarget() != GL_TEXTURE_3D) + if (texture == nullptr || texture->getType() != gl::TextureType::_3D) { return EglBadParameter() << "target is not a 3D texture."; } @@ -1578,16 +1592,16 @@ Error ValidateCreateImageKHR(const Display *display, EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0); EGLAttrib zOffset = attributes.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0); - if (texture->getWidth(GL_TEXTURE_3D, static_cast(level)) == 0 || - texture->getHeight(GL_TEXTURE_3D, static_cast(level)) == 0 || - texture->getDepth(GL_TEXTURE_3D, static_cast(level)) == 0) + if (texture->getWidth(gl::TextureTarget::_3D, static_cast(level)) == 0 || + texture->getHeight(gl::TextureTarget::_3D, static_cast(level)) == 0 || + texture->getDepth(gl::TextureTarget::_3D, static_cast(level)) == 0) { return EglBadParameter() << "target 3D texture does not have a valid size at specified level."; } if (static_cast(zOffset) >= - texture->getDepth(GL_TEXTURE_3D, static_cast(level))) + texture->getDepth(gl::TextureTarget::_3D, static_cast(level))) { return EglBadParameter() << "target 3D texture does not have enough layers " "for the specified Z offset at the specified " @@ -1821,7 +1835,7 @@ Error ValidateStreamConsumerGLTextureExternalKHR(const Display *display, } // Lookup the texture and ensure it is correct - gl::Texture *texture = context->getGLState().getTargetTexture(GL_TEXTURE_EXTERNAL_OES); + gl::Texture *texture = context->getGLState().getTargetTexture(gl::TextureType::External); if (texture == nullptr || texture->getId() == 0) { return EglBadAccess() << "No external texture bound"; @@ -2026,7 +2040,7 @@ Error ValidateStreamConsumerGLTextureExternalAttribsNV(const Display *display, } // Lookup the texture and ensure it is correct - gl::Texture *texture = context->getGLState().getTargetTexture(GL_TEXTURE_EXTERNAL_OES); + gl::Texture *texture = context->getGLState().getTargetTexture(gl::TextureType::External); if (texture == nullptr || texture->getId() == 0) { return EglBadAccess() << "No external texture bound"; @@ -2061,7 +2075,7 @@ Error ValidateStreamConsumerGLTextureExternalAttribsNV(const Display *display, if (plane[i] != EGL_NONE) { gl::Texture *texture = context->getGLState().getSamplerTexture( - static_cast(plane[i]), GL_TEXTURE_EXTERNAL_OES); + static_cast(plane[i]), gl::TextureType::External); if (texture == nullptr || texture->getId() == 0) { return EglBadAccess() diff --git a/gfx/angle/checkout/src/libANGLE/validationES.cpp b/gfx/angle/checkout/src/libANGLE/validationES.cpp index cee8f7d246f6..1e53415c167a 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationES.cpp @@ -19,6 +19,7 @@ #include "libANGLE/Texture.h" #include "libANGLE/TransformFeedback.h" #include "libANGLE/VertexArray.h" +#include "libANGLE/angletypes.h" #include "libANGLE/formatutils.h" #include "libANGLE/queryconversions.h" #include "libANGLE/validationES2.h" @@ -67,10 +68,7 @@ bool CompressedSubTextureFormatRequiresExactSize(GLenum internalFormat) return CompressedTextureFormatRequiresExactSize(internalFormat) || IsETC2EACFormat(internalFormat); } -bool ValidateDrawAttribs(ValidationContext *context, - GLint primcount, - GLint maxVertex, - GLint vertexCount) +bool ValidateDrawAttribs(Context *context, GLint primcount, GLint maxVertex, GLint vertexCount) { const gl::State &state = context->getGLState(); const gl::Program *program = state.getProgram(); @@ -92,8 +90,8 @@ bool ValidateDrawAttribs(ValidationContext *context, // If we have no buffer, then we either get an error, or there are no more checks to be // done. - const VertexBinding &binding = vertexBindings[attrib.bindingIndex]; - gl::Buffer *buffer = binding.getBuffer().get(); + const VertexBinding &binding = vertexBindings[attrib.bindingIndex]; + gl::Buffer *buffer = binding.getBuffer().get(); if (!buffer) { if (webglCompatibility || !state.areClientArraysEnabled()) @@ -178,12 +176,19 @@ bool ValidateDrawAttribs(ValidationContext *context, ANGLE_VALIDATION_ERR(context, InvalidOperation(), InsufficientVertexBufferSize); return false; } + + if (webglCompatibility && buffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), + VertexBufferBoundForTransformFeedback); + return false; + } } return true; } -bool ValidReadPixelsTypeEnum(ValidationContext *context, GLenum type) +bool ValidReadPixelsTypeEnum(Context *context, GLenum type) { switch (type) { @@ -224,7 +229,7 @@ bool ValidReadPixelsTypeEnum(ValidationContext *context, GLenum type) } } -bool ValidReadPixelsFormatEnum(ValidationContext *context, GLenum format) +bool ValidReadPixelsFormatEnum(Context *context, GLenum format) { switch (format) { @@ -255,7 +260,7 @@ bool ValidReadPixelsFormatEnum(ValidationContext *context, GLenum format) } } -bool ValidReadPixelsFormatType(ValidationContext *context, +bool ValidReadPixelsFormatType(Context *context, GLenum framebufferComponentType, GLenum format, GLenum type) @@ -453,7 +458,7 @@ bool ValidateTextureMaxAnisotropyValue(Context *context, GLfloat paramValue) return true; } -bool ValidateFragmentShaderColorBufferTypeMatch(ValidationContext *context) +bool ValidateFragmentShaderColorBufferTypeMatch(Context *context) { const Program *program = context->getGLState().getProgram(); const Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer(); @@ -470,9 +475,9 @@ bool ValidateFragmentShaderColorBufferTypeMatch(ValidationContext *context) return true; } -bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context) +bool ValidateVertexShaderAttributeTypeMatch(Context *context) { - const auto &glState = context->getGLState(); + const auto &glState = context->getGLState(); const Program *program = context->getGLState().getProgram(); const VertexArray *vao = context->getGLState().getVertexArray(); @@ -493,8 +498,40 @@ bool ValidateVertexShaderAttributeTypeMatch(ValidationContext *context) return true; } +bool IsCompatibleDrawModeWithGeometryShader(GLenum drawMode, + GLenum geometryShaderInputPrimitiveType) +{ + // [EXT_geometry_shader] Section 11.1gs.1, Geometry Shader Input Primitives + switch (geometryShaderInputPrimitiveType) + { + case GL_POINTS: + return drawMode == GL_POINTS; + case GL_LINES: + return drawMode == GL_LINES || drawMode == GL_LINE_STRIP || drawMode == GL_LINE_LOOP; + case GL_LINES_ADJACENCY_EXT: + return drawMode == GL_LINES_ADJACENCY_EXT || drawMode == GL_LINE_STRIP_ADJACENCY_EXT; + case GL_TRIANGLES: + return drawMode == GL_TRIANGLES || drawMode == GL_TRIANGLE_FAN || + drawMode == GL_TRIANGLE_STRIP; + case GL_TRIANGLES_ADJACENCY_EXT: + return drawMode == GL_TRIANGLES_ADJACENCY_EXT || + drawMode == GL_TRIANGLE_STRIP_ADJACENCY_EXT; + default: + UNREACHABLE(); + return false; + } +} + } // anonymous namespace +void SetRobustLengthParam(GLsizei *length, GLsizei value) +{ + if (length) + { + *length = value; + } +} + bool IsETC2EACFormat(const GLenum format) { // ES 3.1, Table 8.19 @@ -517,22 +554,22 @@ bool IsETC2EACFormat(const GLenum format) } } -bool ValidTextureTarget(const ValidationContext *context, GLenum target) +bool ValidTextureTarget(const Context *context, TextureType type) { - switch (target) + switch (type) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP: + case TextureType::_2D: + case TextureType::CubeMap: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: return context->getExtensions().textureRectangle; - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: + case TextureType::_3D: + case TextureType::_2DArray: return (context->getClientMajorVersion() >= 3); - case GL_TEXTURE_2D_MULTISAMPLE: + case TextureType::_2DMultisample: return (context->getClientVersion() >= Version(3, 1)); default: @@ -540,15 +577,15 @@ bool ValidTextureTarget(const ValidationContext *context, GLenum target) } } -bool ValidTexture2DTarget(const ValidationContext *context, GLenum target) +bool ValidTexture2DTarget(const Context *context, TextureType type) { - switch (target) + switch (type) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP: + case TextureType::_2D: + case TextureType::CubeMap: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: return context->getExtensions().textureRectangle; default: @@ -556,12 +593,12 @@ bool ValidTexture2DTarget(const ValidationContext *context, GLenum target) } } -bool ValidTexture3DTarget(const ValidationContext *context, GLenum target) +bool ValidTexture3DTarget(const Context *context, TextureType target) { switch (target) { - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: + case TextureType::_3D: + case TextureType::_2DArray: return (context->getClientMajorVersion() >= 3); default: @@ -571,9 +608,9 @@ bool ValidTexture3DTarget(const ValidationContext *context, GLenum target) // Most texture GL calls are not compatible with external textures, so we have a separate validation // function for use in the GL calls that do -bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target) +bool ValidTextureExternalTarget(const Context *context, TextureType target) { - return (target == GL_TEXTURE_EXTERNAL_OES) && + return (target == TextureType::External) && (context->getExtensions().eglImageExternal || context->getExtensions().eglStreamConsumerExternal); } @@ -582,26 +619,26 @@ bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target) // usable as the destination of a 2D operation-- so a cube face is valid, but // GL_TEXTURE_CUBE_MAP is not. // Note: duplicate of IsInternalTextureTarget -bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum target) +bool ValidTexture2DDestinationTarget(const Context *context, TextureTarget target) { switch (target) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureTarget::_2D: + case TextureTarget::CubeMapNegativeX: + case TextureTarget::CubeMapNegativeY: + case TextureTarget::CubeMapNegativeZ: + case TextureTarget::CubeMapPositiveX: + case TextureTarget::CubeMapPositiveY: + case TextureTarget::CubeMapPositiveZ: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureTarget::Rectangle: return context->getExtensions().textureRectangle; default: return false; } } -bool ValidateDrawElementsInstancedBase(ValidationContext *context, +bool ValidateDrawElementsInstancedBase(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -642,7 +679,7 @@ bool ValidateDrawArraysInstancedBase(Context *context, return true; } -bool ValidateDrawInstancedANGLE(ValidationContext *context) +bool ValidateDrawInstancedANGLE(Context *context) { // Verify there is at least one active attribute with a divisor of zero const State &state = context->getGLState(); @@ -665,41 +702,36 @@ bool ValidateDrawInstancedANGLE(ValidationContext *context) return false; } -bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target) +bool ValidTexture3DDestinationTarget(const Context *context, TextureType target) { switch (target) { - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: + case TextureType::_3D: + case TextureType::_2DArray: return true; default: return false; } } -bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target) +bool ValidTexLevelDestinationTarget(const Context *context, TextureType type) { - switch (target) + switch (type) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: - case GL_TEXTURE_2D_MULTISAMPLE: + case TextureType::_2D: + case TextureType::_2DArray: + case TextureType::_2DMultisample: + case TextureType::CubeMap: + case TextureType::_3D: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: return context->getExtensions().textureRectangle; default: return false; } } -bool ValidFramebufferTarget(const ValidationContext *context, GLenum target) +bool ValidFramebufferTarget(const Context *context, GLenum target) { static_assert(GL_DRAW_FRAMEBUFFER_ANGLE == GL_DRAW_FRAMEBUFFER && GL_READ_FRAMEBUFFER_ANGLE == GL_READ_FRAMEBUFFER, @@ -720,35 +752,25 @@ bool ValidFramebufferTarget(const ValidationContext *context, GLenum target) } } -bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level) +bool ValidMipLevel(const Context *context, TextureType type, GLint level) { const auto &caps = context->getCaps(); size_t maxDimension = 0; - switch (target) + switch (type) { - case GL_TEXTURE_2D: + case TextureType::_2D: + case TextureType::_2DArray: + case TextureType::_2DMultisample: maxDimension = caps.max2DTextureSize; break; - case GL_TEXTURE_CUBE_MAP: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureType::CubeMap: maxDimension = caps.maxCubeMapTextureSize; break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: return level == 0; - case GL_TEXTURE_3D: + case TextureType::_3D: maxDimension = caps.max3DTextureSize; break; - case GL_TEXTURE_2D_ARRAY: - maxDimension = caps.max2DTextureSize; - break; - case GL_TEXTURE_2D_MULTISAMPLE: - maxDimension = caps.max2DTextureSize; - break; default: UNREACHABLE(); } @@ -756,8 +778,8 @@ bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level) return level <= gl::log2(static_cast(maxDimension)) && level >= 0; } -bool ValidImageSizeParameters(ValidationContext *context, - GLenum target, +bool ValidImageSizeParameters(Context *context, + TextureType target, GLint level, GLsizei width, GLsizei height, @@ -795,7 +817,7 @@ bool ValidCompressedDimension(GLsizei size, GLuint blockSize, bool smallerThanBl (size % blockSize == 0); } -bool ValidCompressedImageSize(const ValidationContext *context, +bool ValidCompressedImageSize(const Context *context, GLenum internalFormat, GLint level, GLsizei width, @@ -831,7 +853,7 @@ bool ValidCompressedImageSize(const ValidationContext *context, return true; } -bool ValidCompressedSubImageSize(const ValidationContext *context, +bool ValidCompressedSubImageSize(const Context *context, GLenum internalFormat, GLint xoffset, GLint yoffset, @@ -875,8 +897,8 @@ bool ValidCompressedSubImageSize(const ValidationContext *context, return true; } -bool ValidImageDataSize(ValidationContext *context, - GLenum textureTarget, +bool ValidImageDataSize(Context *context, + TextureType texType, GLsizei width, GLsizei height, GLsizei depth, @@ -900,8 +922,8 @@ bool ValidImageDataSize(ValidationContext *context, const gl::Extents size(width, height, depth); const auto &unpack = context->getGLState().getUnpackState(); - bool targetIs3D = textureTarget == GL_TEXTURE_3D || textureTarget == GL_TEXTURE_2D_ARRAY; - auto endByteOrErr = formatInfo.computePackUnpackEndByte(size, unpack, targetIs3D); + bool targetIs3D = texType == TextureType::_3D || texType == TextureType::_2DArray; + auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, unpack, targetIs3D); if (endByteOrErr.isError()) { context->handleError(endByteOrErr.getError()); @@ -923,6 +945,13 @@ bool ValidImageDataSize(ValidationContext *context, context->handleError(InvalidOperation()); return false; } + if (context->getExtensions().webglCompatibility && + pixelUnpackBuffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), + PixelUnpackBufferBoundForTransformFeedback); + return false; + } } else { @@ -963,12 +992,14 @@ bool ValidQueryType(const Context *context, GLenum queryType) return context->getExtensions().disjointTimerQuery; case GL_COMMANDS_COMPLETED_CHROMIUM: return context->getExtensions().syncQuery; + case GL_PRIMITIVES_GENERATED_EXT: + return context->getExtensions().geometryShader; default: return false; } } -bool ValidateWebGLVertexAttribPointer(ValidationContext *context, +bool ValidateWebGLVertexAttribPointer(Context *context, GLenum type, GLboolean normalized, GLsizei stride, @@ -1012,7 +1043,7 @@ bool ValidateWebGLVertexAttribPointer(ValidationContext *context, return true; } -Program *GetValidProgram(ValidationContext *context, GLuint id) +Program *GetValidProgram(Context *context, GLuint id) { // ES3 spec (section 2.11.1) -- "Commands that accept shader or program object names will // generate the error INVALID_VALUE if the provided name is not the name of either a shader @@ -1036,7 +1067,7 @@ Program *GetValidProgram(ValidationContext *context, GLuint id) return validProgram; } -Shader *GetValidShader(ValidationContext *context, GLuint id) +Shader *GetValidShader(Context *context, GLuint id) { // See ValidProgram for spec details. @@ -1102,7 +1133,7 @@ bool ValidateAttachmentTarget(gl::Context *context, GLenum attachment) return true; } -bool ValidateRenderbufferStorageParametersBase(ValidationContext *context, +bool ValidateRenderbufferStorageParametersBase(Context *context, GLenum target, GLsizei samples, GLenum internalformat, @@ -1249,15 +1280,13 @@ bool ValidateBlitFramebufferParameters(Context *context, return false; } - if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, readFramebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } - if (drawFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, drawFramebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } @@ -1267,9 +1296,8 @@ bool ValidateBlitFramebufferParameters(Context *context, return false; } - if (drawFramebuffer->getSamples(context) != 0) + if (!ValidateFramebufferNotMultisampled(context, drawFramebuffer)) { - context->handleError(InvalidOperation()); return false; } @@ -1305,7 +1333,7 @@ bool ValidateBlitFramebufferParameters(Context *context, GLenum drawComponentType = drawFormat.info->componentType; bool readFixedPoint = (readComponentType == GL_UNSIGNED_NORMALIZED || readComponentType == GL_SIGNED_NORMALIZED); - bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED || + bool drawFixedPoint = (drawComponentType == GL_UNSIGNED_NORMALIZED || drawComponentType == GL_SIGNED_NORMALIZED); if (extensions.colorBufferFloat) @@ -1463,17 +1491,25 @@ bool ValidateReadPixelsRobustANGLE(Context *context, return false; } - if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, length, - columns, rows, pixels)) + GLsizei writeLength = 0; + GLsizei writeColumns = 0; + GLsizei writeRows = 0; + + if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, &writeLength, + &writeColumns, &writeRows, pixels)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + SetRobustLengthParam(columns, writeColumns); + SetRobustLengthParam(rows, writeRows); + return true; } @@ -1510,22 +1546,30 @@ bool ValidateReadnPixelsRobustANGLE(Context *context, GLsizei *rows, void *data) { + GLsizei writeLength = 0; + GLsizei writeColumns = 0; + GLsizei writeRows = 0; + if (!ValidateRobustEntryPoint(context, bufSize)) { return false; } - if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, length, - columns, rows, data)) + if (!ValidateReadPixelsBase(context, x, y, width, height, format, type, bufSize, &writeLength, + &writeColumns, &writeRows, data)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + SetRobustLengthParam(columns, writeColumns); + SetRobustLengthParam(rows, writeRows); + return true; } @@ -1761,16 +1805,20 @@ bool ValidateGetQueryivRobustANGLE(Context *context, return false; } - if (!ValidateGetQueryivBase(context, target, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetQueryivBase(context, target, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -1842,16 +1890,20 @@ bool ValidateGetQueryObjectivRobustANGLE(Context *context, return false; } - if (!ValidateGetQueryObjectValueBase(context, id, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -1885,16 +1937,20 @@ bool ValidateGetQueryObjectuivRobustANGLE(Context *context, return false; } - if (!ValidateGetQueryObjectValueBase(context, id, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -1926,16 +1982,20 @@ bool ValidateGetQueryObjecti64vRobustANGLE(Context *context, return false; } - if (!ValidateGetQueryObjectValueBase(context, id, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -1967,20 +2027,24 @@ bool ValidateGetQueryObjectui64vRobustANGLE(Context *context, return false; } - if (!ValidateGetQueryObjectValueBase(context, id, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetQueryObjectValueBase(context, id, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateUniformCommonBase(ValidationContext *context, +bool ValidateUniformCommonBase(Context *context, gl::Program *program, GLint location, GLsizei count, @@ -2045,7 +2109,7 @@ bool ValidateUniformCommonBase(ValidationContext *context, return true; } -bool ValidateUniform1ivValue(ValidationContext *context, +bool ValidateUniform1ivValue(Context *context, GLenum uniformType, GLsizei count, const GLint *value) @@ -2077,7 +2141,7 @@ bool ValidateUniform1ivValue(ValidationContext *context, return false; } -bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType) +bool ValidateUniformValue(Context *context, GLenum valueType, GLenum uniformType) { // Check that the value type is compatible with uniform type. // Do the cheaper test first, for a little extra speed. @@ -2090,7 +2154,7 @@ bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum u return false; } -bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType) +bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum uniformType) { // Check that the value type is compatible with uniform type. if (valueType == uniformType) @@ -2102,7 +2166,7 @@ bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GL return false; } -bool ValidateUniform(ValidationContext *context, GLenum valueType, GLint location, GLsizei count) +bool ValidateUniform(Context *context, GLenum valueType, GLint location, GLsizei count) { const LinkedUniform *uniform = nullptr; gl::Program *programObject = context->getGLState().getProgram(); @@ -2110,10 +2174,7 @@ bool ValidateUniform(ValidationContext *context, GLenum valueType, GLint locatio ValidateUniformValue(context, valueType, uniform->type); } -bool ValidateUniform1iv(ValidationContext *context, - GLint location, - GLsizei count, - const GLint *value) +bool ValidateUniform1iv(Context *context, GLint location, GLsizei count, const GLint *value) { const LinkedUniform *uniform = nullptr; gl::Program *programObject = context->getGLState().getProgram(); @@ -2121,7 +2182,7 @@ bool ValidateUniform1iv(ValidationContext *context, ValidateUniform1ivValue(context, uniform->type, count, value); } -bool ValidateUniformMatrix(ValidationContext *context, +bool ValidateUniformMatrix(Context *context, GLenum valueType, GLint location, GLsizei count, @@ -2139,10 +2200,7 @@ bool ValidateUniformMatrix(ValidationContext *context, ValidateUniformMatrixValue(context, valueType, uniform->type); } -bool ValidateStateQuery(ValidationContext *context, - GLenum pname, - GLenum *nativeType, - unsigned int *numParams) +bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams) { if (!context->getQueryParameterInfo(pname, nativeType, numParams)) { @@ -2193,23 +2251,21 @@ bool ValidateStateQuery(ValidationContext *context, case GL_IMPLEMENTATION_COLOR_READ_TYPE: case GL_IMPLEMENTATION_COLOR_READ_FORMAT: { - if (context->getGLState().getReadFramebuffer()->checkStatus(context) != - GL_FRAMEBUFFER_COMPLETE) + Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer(); + ASSERT(readFramebuffer); + + if (!ValidateFramebufferComplete(context, readFramebuffer, false)) { - context->handleError(InvalidOperation()); return false; } - const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); - ASSERT(framebuffer); - - if (framebuffer->getReadBufferState() == GL_NONE) + if (readFramebuffer->getReadBufferState() == GL_NONE) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), ReadBufferNone); return false; } - const FramebufferAttachment *attachment = framebuffer->getReadColorbuffer(); + const FramebufferAttachment *attachment = readFramebuffer->getReadColorbuffer(); if (!attachment) { context->handleError(InvalidOperation()); @@ -2231,7 +2287,88 @@ bool ValidateStateQuery(ValidationContext *context, return true; } -bool ValidateRobustStateQuery(ValidationContext *context, +bool ValidateGetBooleanvRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLboolean *params) +{ + GLenum nativeType; + unsigned int numParams = 0; + + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return false; + } + + SetRobustLengthParam(length, numParams); + + return true; +} + +bool ValidateGetFloatvRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + GLenum nativeType; + unsigned int numParams = 0; + + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return false; + } + + SetRobustLengthParam(length, numParams); + + return true; +} + +bool ValidateGetIntegervRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *data) +{ + GLenum nativeType; + unsigned int numParams = 0; + + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return false; + } + + SetRobustLengthParam(length, numParams); + + return true; +} + +bool ValidateGetInteger64vRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *data) +{ + GLenum nativeType; + unsigned int numParams = 0; + + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return false; + } + + if (nativeType == GL_INT_64_ANGLEX) + { + CastStateValues(context, nativeType, pname, numParams, data); + return false; + } + + SetRobustLengthParam(length, numParams); + return true; +} + +bool ValidateRobustStateQuery(Context *context, GLenum pname, GLsizei bufSize, GLenum *nativeType, @@ -2255,8 +2392,8 @@ bool ValidateRobustStateQuery(ValidationContext *context, return true; } -bool ValidateCopyTexImageParametersBase(ValidationContext *context, - GLenum target, +bool ValidateCopyTexImageParametersBase(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -2270,6 +2407,8 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, GLint border, Format *textureFormatOut) { + TextureType texType = TextureTargetToType(target); + if (xoffset < 0 || yoffset < 0 || zoffset < 0) { ANGLE_VALIDATION_ERR(context, InvalidValue(), NegativeOffset); @@ -2295,23 +2434,21 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, return false; } - if (!ValidMipLevel(context, target, level)) + if (!ValidMipLevel(context, texType, level)) { ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); return false; } - const auto &state = context->getGLState(); + const gl::State &state = context->getGLState(); Framebuffer *readFramebuffer = state.getReadFramebuffer(); - if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, readFramebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } - if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context) != 0) + if (readFramebuffer->id() != 0 && !ValidateFramebufferNotMultisampled(context, readFramebuffer)) { - context->handleError(InvalidOperation()); return false; } @@ -2346,30 +2483,25 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, const gl::Caps &caps = context->getCaps(); GLuint maxDimension = 0; - switch (target) + switch (texType) { - case GL_TEXTURE_2D: + case TextureType::_2D: maxDimension = caps.max2DTextureSize; break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureType::CubeMap: maxDimension = caps.maxCubeMapTextureSize; break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: maxDimension = caps.maxRectangleTextureSize; break; - case GL_TEXTURE_2D_ARRAY: + case TextureType::_2DArray: maxDimension = caps.max2DTextureSize; break; - case GL_TEXTURE_3D: + case TextureType::_3D: maxDimension = caps.max3DTextureSize; break; @@ -2378,8 +2510,7 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, return false; } - gl::Texture *texture = - state.getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + gl::Texture *texture = state.getTargetTexture(texType); if (!texture) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), TextureNotBound); @@ -2414,7 +2545,7 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, } else { - if (IsCubeMapTextureTarget(target) && width != height) + if (texType == TextureType::CubeMap && width != height) { ANGLE_VALIDATION_ERR(context, InvalidValue(), CubemapIncomplete); return false; @@ -2453,8 +2584,10 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, return true; } -bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) +bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count) { + const Extensions &extensions = context->getExtensions(); + switch (mode) { case GL_POINTS: @@ -2465,6 +2598,17 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) case GL_TRIANGLE_STRIP: case GL_TRIANGLE_FAN: break; + + case GL_LINES_ADJACENCY_EXT: + case GL_LINE_STRIP_ADJACENCY_EXT: + case GL_TRIANGLES_ADJACENCY_EXT: + case GL_TRIANGLE_STRIP_ADJACENCY_EXT: + if (!extensions.geometryShader) + { + ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled); + return false; + } + break; default: ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidDrawMode); return false; @@ -2478,8 +2622,6 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) const State &state = context->getGLState(); - const Extensions &extensions = context->getExtensions(); - // WebGL buffers cannot be mapped/unmapped because the MapBufferRange, FlushMappedBufferRange, // and UnmapBuffer entry points are removed from the WebGL 2.0 API. // https://www.khronos.org/registry/webgl/specs/latest/2.0/#5.14 @@ -2499,34 +2641,40 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) Framebuffer *framebuffer = state.getDrawFramebuffer(); if (context->getLimitations().noSeparateStencilRefsAndMasks || extensions.webglCompatibility) { + ASSERT(framebuffer); const FramebufferAttachment *dsAttachment = framebuffer->getStencilOrDepthStencilAttachment(); - GLuint stencilBits = dsAttachment ? dsAttachment->getStencilSize() : 0; - GLuint minimumRequiredStencilMask = (1 << stencilBits) - 1; + const GLuint stencilBits = dsAttachment ? dsAttachment->getStencilSize() : 0; + ASSERT(stencilBits <= 8); + const DepthStencilState &depthStencilState = state.getDepthStencilState(); - - bool differentRefs = state.getStencilRef() != state.getStencilBackRef(); - bool differentWritemasks = - (depthStencilState.stencilWritemask & minimumRequiredStencilMask) != - (depthStencilState.stencilBackWritemask & minimumRequiredStencilMask); - bool differentMasks = (depthStencilState.stencilMask & minimumRequiredStencilMask) != - (depthStencilState.stencilBackMask & minimumRequiredStencilMask); - - if (differentRefs || differentWritemasks || differentMasks) + if (depthStencilState.stencilTest && stencilBits > 0) { - if (!extensions.webglCompatibility) + GLuint maxStencilValue = (1 << stencilBits) - 1; + + bool differentRefs = + clamp(state.getStencilRef(), 0, static_cast(maxStencilValue)) != + clamp(state.getStencilBackRef(), 0, static_cast(maxStencilValue)); + bool differentWritemasks = (depthStencilState.stencilWritemask & maxStencilValue) != + (depthStencilState.stencilBackWritemask & maxStencilValue); + bool differentMasks = (depthStencilState.stencilMask & maxStencilValue) != + (depthStencilState.stencilBackMask & maxStencilValue); + + if (differentRefs || differentWritemasks || differentMasks) { - ERR() << "This ANGLE implementation does not support separate front/back stencil " - "writemasks, reference values, or stencil mask values."; + if (!extensions.webglCompatibility) + { + ERR() << "This ANGLE implementation does not support separate front/back " + "stencil writemasks, reference values, or stencil mask values."; + } + ANGLE_VALIDATION_ERR(context, InvalidOperation(), StencilReferenceMaskOrMismatch); + return false; } - ANGLE_VALIDATION_ERR(context, InvalidOperation(), StencilReferenceMaskOrMismatch); - return false; } } - if (framebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, framebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } @@ -2541,7 +2689,8 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) // vertex shader stage or fragment shader stage is a undefined behaviour. // But ANGLE should clearly generate an INVALID_OPERATION error instead of // produce undefined result. - if (!program->hasLinkedVertexShader() || !program->hasLinkedFragmentShader()) + if (!program->hasLinkedShaderStage(ShaderType::Vertex) || + !program->hasLinkedShaderStage(ShaderType::Fragment)) { context->handleError(InvalidOperation() << "It is a undefined behaviour to render without " "vertex shader stage or fragment shader stage."); @@ -2587,12 +2736,24 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) } } + // Do geometry shader specific validations + if (program->hasLinkedShaderStage(ShaderType::Geometry)) + { + if (!IsCompatibleDrawModeWithGeometryShader(mode, + program->getGeometryShaderInputPrimitiveType())) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), + IncompatibleDrawModeAgainstGeometryShader); + return false; + } + } + // Uniform buffer validation for (unsigned int uniformBlockIndex = 0; uniformBlockIndex < program->getActiveUniformBlockCount(); uniformBlockIndex++) { const gl::InterfaceBlock &uniformBlock = program->getUniformBlockByIndex(uniformBlockIndex); - GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex); + GLuint blockBinding = program->getUniformBlockBinding(uniformBlockIndex); const OffsetBindingPointer &uniformBuffer = state.getIndexedUniformBuffer(blockBinding); @@ -2605,13 +2766,7 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) return false; } - size_t uniformBufferSize = uniformBuffer.getSize(); - if (uniformBufferSize == 0) - { - // Bind the whole buffer. - uniformBufferSize = static_cast(uniformBuffer->getSize()); - } - + size_t uniformBufferSize = GetBoundBufferAvailableSize(uniformBuffer); if (uniformBufferSize < uniformBlock.dataSize) { // undefined behaviour @@ -2620,11 +2775,26 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) << "It is undefined behaviour to use a uniform buffer that is too small."); return false; } + + if (extensions.webglCompatibility && + uniformBuffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), + UniformBufferBoundForTransformFeedback); + return false; + } } // Do some additonal WebGL-specific validation if (extensions.webglCompatibility) { + const TransformFeedback *transformFeedbackObject = state.getCurrentTransformFeedback(); + if (transformFeedbackObject != nullptr && transformFeedbackObject->isActive() && + transformFeedbackObject->buffersBoundForOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), TransformFeedbackBufferDoubleBound); + return false; + } // Detect rendering feedback loops for WebGL. if (framebuffer->formsRenderingFeedbackLoopWith(state)) { @@ -2648,7 +2818,7 @@ bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count) return true; } -bool ValidateDrawArraysCommon(ValidationContext *context, +bool ValidateDrawArraysCommon(Context *context, GLenum mode, GLint first, GLsizei count, @@ -2663,14 +2833,23 @@ bool ValidateDrawArraysCommon(ValidationContext *context, const State &state = context->getGLState(); gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback(); if (curTransformFeedback && curTransformFeedback->isActive() && - !curTransformFeedback->isPaused() && curTransformFeedback->getPrimitiveMode() != mode) + !curTransformFeedback->isPaused()) { - // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode - // that does not match the current transform feedback object's draw mode (if transform - // feedback - // is active), (3.0.2, section 2.14, pg 86) - ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidDrawModeTransformFeedback); - return false; + if (curTransformFeedback->getPrimitiveMode() != mode) + { + // It is an invalid operation to call DrawArrays or DrawArraysInstanced with a draw mode + // that does not match the current transform feedback object's draw mode (if transform + // feedback + // is active), (3.0.2, section 2.14, pg 86) + ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidDrawModeTransformFeedback); + return false; + } + + if (!curTransformFeedback->checkBufferSpaceForDraw(count, primcount)) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), TransformFeedbackBufferTooSmall); + return false; + } } if (!ValidateDrawBase(context, mode, count)) @@ -2721,7 +2900,7 @@ bool ValidateDrawArraysInstancedANGLE(Context *context, return ValidateDrawInstancedANGLE(context); } -bool ValidateDrawElementsBase(ValidationContext *context, GLenum type) +bool ValidateDrawElementsBase(Context *context, GLenum type) { switch (type) { @@ -2756,7 +2935,7 @@ bool ValidateDrawElementsBase(ValidationContext *context, GLenum type) return true; } -bool ValidateDrawElementsCommon(ValidationContext *context, +bool ValidateDrawElementsCommon(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -2873,6 +3052,14 @@ bool ValidateDrawElementsCommon(ValidationContext *context, ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedByteCountType); return false; } + + if (context->getExtensions().webglCompatibility && + elementArrayBuffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), + ElementArrayBufferBoundForTransformFeedback); + return false; + } } if (context->getExtensions().robustBufferAccessBehavior) @@ -2896,37 +3083,33 @@ bool ValidateDrawElementsCommon(ValidationContext *context, else { // Use the parameter buffer to retrieve and cache the index range. - const auto ¶ms = context->getParams(); - const auto &indexRangeOpt = params.getIndexRange(); - if (!indexRangeOpt.valid()) - { - // Unexpected error. - return false; - } + const DrawCallParams ¶ms = context->getParams(); + ANGLE_VALIDATION_TRY(params.ensureIndexRangeResolved(context)); + const IndexRange &indexRange = params.getIndexRange(); // If we use an index greater than our maximum supported index range, return an error. // The ES3 spec does not specify behaviour here, it is undefined, but ANGLE should always // return an error if possible here. - if (static_cast(indexRangeOpt.value().end) >= context->getCaps().maxElementIndex) + if (static_cast(indexRange.end) >= context->getCaps().maxElementIndex) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), ExceedsMaxElement); return false; } - if (!ValidateDrawAttribs(context, primcount, static_cast(indexRangeOpt.value().end), - static_cast(indexRangeOpt.value().vertexCount()))) + if (!ValidateDrawAttribs(context, primcount, static_cast(indexRange.end), + static_cast(indexRange.vertexCount()))) { return false; } // No op if there are no real indices in the index data (all are primitive restart). - return (indexRangeOpt.value().vertexIndexCount > 0); + return (indexRange.vertexIndexCount > 0); } return true; } -bool ValidateDrawElementsInstancedCommon(ValidationContext *context, +bool ValidateDrawElementsInstancedCommon(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -3083,6 +3266,17 @@ bool ValidateGetnUniformfvEXT(Context *context, return ValidateSizedGetUniform(context, program, location, bufSize, nullptr); } +bool ValidateGetnUniformfvRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, @@ -3092,6 +3286,28 @@ bool ValidateGetnUniformivEXT(Context *context, return ValidateSizedGetUniform(context, program, location, bufSize, nullptr); } +bool ValidateGetnUniformivRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + +bool ValidateGetnUniformuivRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetUniformfvRobustANGLE(Context *context, GLuint program, GLint location, @@ -3104,8 +3320,17 @@ bool ValidateGetUniformfvRobustANGLE(Context *context, return false; } + GLsizei writeLength = 0; + // bufSize is validated in ValidateSizedGetUniform - return ValidateSizedGetUniform(context, program, location, bufSize, length); + if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength)) + { + return false; + } + + SetRobustLengthParam(length, writeLength); + + return true; } bool ValidateGetUniformivRobustANGLE(Context *context, @@ -3120,8 +3345,17 @@ bool ValidateGetUniformivRobustANGLE(Context *context, return false; } + GLsizei writeLength = 0; + // bufSize is validated in ValidateSizedGetUniform - return ValidateSizedGetUniform(context, program, location, bufSize, length); + if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength)) + { + return false; + } + + SetRobustLengthParam(length, writeLength); + + return true; } bool ValidateGetUniformuivRobustANGLE(Context *context, @@ -3142,8 +3376,17 @@ bool ValidateGetUniformuivRobustANGLE(Context *context, return false; } + GLsizei writeLength = 0; + // bufSize is validated in ValidateSizedGetUniform - return ValidateSizedGetUniform(context, program, location, bufSize, length); + if (!ValidateSizedGetUniform(context, program, location, bufSize, &writeLength)) + { + return false; + } + + SetRobustLengthParam(length, writeLength); + + return true; } bool ValidateDiscardFramebufferBase(Context *context, @@ -3258,7 +3501,7 @@ bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *ma return true; } -bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image) +bool ValidateEGLImageTargetTexture2DOES(Context *context, TextureType type, GLeglImageOES image) { if (!context->getExtensions().eglImage && !context->getExtensions().eglImageExternal) { @@ -3266,9 +3509,9 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglIm return false; } - switch (target) + switch (type) { - case GL_TEXTURE_2D: + case TextureType::_2D: if (!context->getExtensions().eglImage) { context->handleError(InvalidEnum() @@ -3276,7 +3519,7 @@ bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglIm } break; - case GL_TEXTURE_EXTERNAL_OES: + case TextureType::External: if (!context->getExtensions().eglImageExternal) { context->handleError(InvalidEnum() << "GL_TEXTURE_EXTERNAL_OES texture target " @@ -3431,7 +3674,7 @@ bool ValidateGetProgramBinaryBase(Context *context, return true; } -bool ValidateDrawBuffersBase(ValidationContext *context, GLsizei n, const GLenum *bufs) +bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs) { // INVALID_VALUE is generated if n is negative or greater than value of MAX_DRAW_BUFFERS if (n < 0) @@ -3739,7 +3982,7 @@ bool ValidateGenOrDelete(Context *context, GLint n) return true; } -bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize) +bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize) { if (!context->getExtensions().robustClientMemory) { @@ -3757,7 +4000,7 @@ bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize) return true; } -bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams) +bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numParams) { if (bufSize < numParams) { @@ -4036,28 +4279,32 @@ bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(Context *context, GLenum attachment, GLenum pname, GLsizei bufSize, - GLsizei *numParams) + GLsizei *length, + GLint *params) { if (!ValidateRobustEntryPoint(context, bufSize)) { return false; } + GLsizei numParams = 0; if (!ValidateGetFramebufferAttachmentParameterivBase(context, target, attachment, pname, - numParams)) + &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *numParams)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context, +bool ValidateGetBufferParameterivRobustANGLE(Context *context, BufferBinding target, GLenum pname, GLsizei bufSize, @@ -4069,48 +4316,52 @@ bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context, return false; } - if (!ValidateGetBufferParameterBase(context, target, pname, false, length)) + GLsizei numParams = 0; + + if (!ValidateGetBufferParameterBase(context, target, pname, false, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); return true; } -bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context, +bool ValidateGetBufferParameteri64vRobustANGLE(Context *context, BufferBinding target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params) { + GLsizei numParams = 0; + if (!ValidateRobustEntryPoint(context, bufSize)) { return false; } - if (!ValidateGetBufferParameterBase(context, target, pname, false, length)) + if (!ValidateGetBufferParameterBase(context, target, pname, false, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateGetProgramivBase(ValidationContext *context, - GLuint program, - GLenum pname, - GLsizei *numParams) +bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GLsizei *numParams) { // Currently, all GetProgramiv queries return 1 parameter if (numParams) @@ -4185,13 +4436,40 @@ bool ValidateGetProgramivBase(ValidationContext *context, ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked); return false; } - if (!programObject->hasLinkedComputeShader()) + if (!programObject->hasLinkedShaderStage(ShaderType::Compute)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveComputeShaderStage); return false; } break; + case GL_GEOMETRY_LINKED_INPUT_TYPE_EXT: + case GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT: + case GL_GEOMETRY_LINKED_VERTICES_OUT_EXT: + case GL_GEOMETRY_SHADER_INVOCATIONS_EXT: + if (!context->getExtensions().geometryShader) + { + ANGLE_VALIDATION_ERR(context, InvalidEnum(), GeometryShaderExtensionNotEnabled); + return false; + } + + // [EXT_geometry_shader] Chapter 7.12 + // An INVALID_OPERATION error is generated if GEOMETRY_LINKED_VERTICES_OUT_EXT, + // GEOMETRY_LINKED_INPUT_TYPE_EXT, GEOMETRY_LINKED_OUTPUT_TYPE_EXT, or + // GEOMETRY_SHADER_INVOCATIONS_EXT are queried for a program which has not been linked + // successfully, or which does not contain objects to form a geometry shader. + if (!programObject->isLinked()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), ProgramNotLinked); + return false; + } + if (!programObject->hasLinkedShaderStage(ShaderType::Geometry)) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveGeometryShaderStage); + return false; + } + break; + default: ANGLE_VALIDATION_ERR(context, InvalidEnum(), EnumNotSupported); return false; @@ -4204,23 +4482,28 @@ bool ValidateGetProgramivRobustANGLE(Context *context, GLuint program, GLenum pname, GLsizei bufSize, - GLsizei *numParams) + GLsizei *length, + GLint *params) { if (!ValidateRobustEntryPoint(context, bufSize)) { return false; } - if (!ValidateGetProgramivBase(context, program, pname, numParams)) + GLsizei numParams = 0; + + if (!ValidateGetProgramivBase(context, program, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *numParams)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -4236,16 +4519,20 @@ bool ValidateGetRenderbufferParameterivRobustANGLE(Context *context, return false; } - if (!ValidateGetRenderbufferParameterivBase(context, target, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetRenderbufferParameterivBase(context, target, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -4261,21 +4548,25 @@ bool ValidateGetShaderivRobustANGLE(Context *context, return false; } - if (!ValidateGetShaderivBase(context, shader, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetShaderivBase(context, shader, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } bool ValidateGetTexParameterfvRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, GLsizei *length, @@ -4286,46 +4577,74 @@ bool ValidateGetTexParameterfvRobustANGLE(Context *context, return false; } - if (!ValidateGetTexParameterBase(context, target, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetTexParameterBase(context, target, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } bool ValidateGetTexParameterivRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params) { + if (!ValidateRobustEntryPoint(context, bufSize)) { return false; } - - if (!ValidateGetTexParameterBase(context, target, pname, length)) + GLsizei numParams = 0; + if (!ValidateGetTexParameterBase(context, target, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); return true; } +bool ValidateGetTexParameterIivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + +bool ValidateGetTexParameterIuivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateTexParameterfvRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const GLfloat *params) @@ -4339,7 +4658,7 @@ bool ValidateTexParameterfvRobustANGLE(Context *context, } bool ValidateTexParameterivRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const GLint *params) @@ -4352,6 +4671,26 @@ bool ValidateTexParameterivRobustANGLE(Context *context, return ValidateTexParameterBase(context, target, pname, bufSize, params); } +bool ValidateTexParameterIivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + +bool ValidateTexParameterIuivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + const GLuint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetSamplerParameterfvRobustANGLE(Context *context, GLuint sampler, GLenum pname, @@ -4364,23 +4703,26 @@ bool ValidateGetSamplerParameterfvRobustANGLE(Context *context, return false; } - if (!ValidateGetSamplerParameterBase(context, sampler, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetSamplerParameterBase(context, sampler, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); return true; } bool ValidateGetSamplerParameterivRobustANGLE(Context *context, GLuint sampler, GLenum pname, - GLuint bufSize, + GLsizei bufSize, GLsizei *length, GLint *params) { @@ -4389,19 +4731,44 @@ bool ValidateGetSamplerParameterivRobustANGLE(Context *context, return false; } - if (!ValidateGetSamplerParameterBase(context, sampler, pname, length)) + GLsizei numParams = 0; + + if (!ValidateGetSamplerParameterBase(context, sampler, pname, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); return true; } +bool ValidateGetSamplerParameterIivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + +bool ValidateGetSamplerParameterIuivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateSamplerParameterfvRobustANGLE(Context *context, GLuint sampler, GLenum pname, @@ -4430,6 +4797,26 @@ bool ValidateSamplerParameterivRobustANGLE(Context *context, return ValidateSamplerParameterBase(context, sampler, pname, bufSize, params); } +bool ValidateSamplerParameterIivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param) +{ + UNIMPLEMENTED(); + return false; +} + +bool ValidateSamplerParameterIuivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetVertexAttribfvRobustANGLE(Context *context, GLuint index, GLenum pname, @@ -4442,16 +4829,19 @@ bool ValidateGetVertexAttribfvRobustANGLE(Context *context, return false; } - if (!ValidateGetVertexAttribBase(context, index, pname, length, false, false)) + GLsizei writeLength = 0; + + if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, false)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); return true; } @@ -4467,16 +4857,20 @@ bool ValidateGetVertexAttribivRobustANGLE(Context *context, return false; } - if (!ValidateGetVertexAttribBase(context, index, pname, length, false, false)) + GLsizei writeLength = 0; + + if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, false)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + return true; } @@ -4492,16 +4886,20 @@ bool ValidateGetVertexAttribPointervRobustANGLE(Context *context, return false; } - if (!ValidateGetVertexAttribBase(context, index, pname, length, true, false)) + GLsizei writeLength = 0; + + if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, true, false)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + return true; } @@ -4517,16 +4915,20 @@ bool ValidateGetVertexAttribIivRobustANGLE(Context *context, return false; } - if (!ValidateGetVertexAttribBase(context, index, pname, length, false, true)) + GLsizei writeLength = 0; + + if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, true)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + return true; } @@ -4542,16 +4944,20 @@ bool ValidateGetVertexAttribIuivRobustANGLE(Context *context, return false; } - if (!ValidateGetVertexAttribBase(context, index, pname, length, false, true)) + GLsizei writeLength = 0; + + if (!ValidateGetVertexAttribBase(context, index, pname, &writeLength, false, true)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + return true; } @@ -4568,16 +4974,21 @@ bool ValidateGetActiveUniformBlockivRobustANGLE(Context *context, return false; } - if (!ValidateGetActiveUniformBlockivBase(context, program, uniformBlockIndex, pname, length)) + GLsizei writeLength = 0; + + if (!ValidateGetActiveUniformBlockivBase(context, program, uniformBlockIndex, pname, + &writeLength)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, writeLength)) { return false; } + SetRobustLengthParam(length, writeLength); + return true; } @@ -4594,20 +5005,25 @@ bool ValidateGetInternalFormativRobustANGLE(Context *context, return false; } - if (!ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize, length)) + GLsizei numParams = 0; + + if (!ValidateGetInternalFormativBase(context, target, internalformat, pname, bufSize, + &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateVertexFormatBase(ValidationContext *context, +bool ValidateVertexFormatBase(Context *context, GLuint attribIndex, GLint size, GLenum type, @@ -4701,7 +5117,7 @@ bool ValidateVertexFormatBase(ValidationContext *context, // In the WebGL 2 API, trying to perform a clear when there is a mismatch between the type of the // specified clear value and the type of a buffer that is being cleared generates an // INVALID_OPERATION error instead of producing undefined results -bool ValidateWebGLFramebufferAttachmentClearType(ValidationContext *context, +bool ValidateWebGLFramebufferAttachmentClearType(Context *context, GLint drawbuffer, const GLenum *validComponentTypes, size_t validComponentTypeCount) @@ -4724,9 +5140,7 @@ bool ValidateWebGLFramebufferAttachmentClearType(ValidationContext *context, return true; } -bool ValidateRobustCompressedTexImageBase(ValidationContext *context, - GLsizei imageSize, - GLsizei dataSize) +bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, GLsizei dataSize) { if (!ValidateRobustEntryPoint(context, dataSize)) { @@ -4745,7 +5159,7 @@ bool ValidateRobustCompressedTexImageBase(ValidationContext *context, return true; } -bool ValidateGetBufferParameterBase(ValidationContext *context, +bool ValidateGetBufferParameterBase(Context *context, BufferBinding target, GLenum pname, bool pointerVersion, @@ -4931,7 +5345,10 @@ bool ValidateGetShaderivBase(Context *context, GLuint shader, GLenum pname, GLsi return true; } -bool ValidateGetTexParameterBase(Context *context, GLenum target, GLenum pname, GLsizei *length) +bool ValidateGetTexParameterBase(Context *context, + TextureType target, + GLenum pname, + GLsizei *length) { if (length) { @@ -5162,19 +5579,17 @@ bool ValidateReadPixelsBase(Context *context, Framebuffer *readFramebuffer = context->getGLState().getReadFramebuffer(); - if (readFramebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, readFramebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } - if (readFramebuffer->id() != 0 && readFramebuffer->getSamples(context) != 0) + if (readFramebuffer->id() != 0 && !ValidateFramebufferNotMultisampled(context, readFramebuffer)) { - context->handleError(InvalidOperation()); return false; } - const Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); + Framebuffer *framebuffer = context->getGLState().getReadFramebuffer(); ASSERT(framebuffer); if (framebuffer->getReadBufferState() == GL_NONE) @@ -5226,8 +5641,12 @@ bool ValidateReadPixelsBase(Context *context, } } - GLenum currentFormat = framebuffer->getImplementationColorReadFormat(context); - GLenum currentType = framebuffer->getImplementationColorReadType(context); + GLenum currentFormat = GL_NONE; + ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadFormat(context, ¤tFormat)); + + GLenum currentType = GL_NONE; + ANGLE_VALIDATION_TRY(framebuffer->getImplementationColorReadType(context, ¤tType)); + GLenum currentComponentType = readBuffer->getFormat().info->componentType; bool validFormatTypeCombination = @@ -5247,6 +5666,12 @@ bool ValidateReadPixelsBase(Context *context, context->handleError(InvalidOperation() << "Pixel pack buffer is mapped."); return false; } + if (context->getExtensions().webglCompatibility && pixelPackBuffer != nullptr && + pixelPackBuffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), PixelPackBufferBoundForTransformFeedback); + return false; + } // .. the data would be packed to the buffer object such that the memory writes required // would exceed the data store size. @@ -5254,7 +5679,7 @@ bool ValidateReadPixelsBase(Context *context, const gl::Extents size(width, height, 1); const auto &pack = context->getGLState().getPackState(); - auto endByteOrErr = formatInfo.computePackUnpackEndByte(size, pack, false); + auto endByteOrErr = formatInfo.computePackUnpackEndByte(type, size, pack, false); if (endByteOrErr.isError()) { context->handleError(endByteOrErr.getError()); @@ -5355,7 +5780,7 @@ bool ValidateReadPixelsBase(Context *context, template bool ValidateTexParameterBase(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const ParamType *params) @@ -5398,8 +5823,7 @@ bool ValidateTexParameterBase(Context *context, ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES3Required); return false; } - if (target == GL_TEXTURE_EXTERNAL_OES && - !context->getExtensions().eglImageExternalEssl3) + if (target == TextureType::External && !context->getExtensions().eglImageExternalEssl3) { context->handleError(InvalidEnum() << "ES3 texture parameters are not " "available without " @@ -5412,7 +5836,7 @@ bool ValidateTexParameterBase(Context *context, break; } - if (target == GL_TEXTURE_2D_MULTISAMPLE) + if (target == TextureType::_2DMultisample) { switch (pname) { @@ -5436,26 +5860,26 @@ bool ValidateTexParameterBase(Context *context, case GL_TEXTURE_WRAP_S: case GL_TEXTURE_WRAP_T: case GL_TEXTURE_WRAP_R: + { + bool restrictedWrapModes = + target == TextureType::External || target == TextureType::Rectangle; + if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes)) { - bool restrictedWrapModes = - target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE; - if (!ValidateTextureWrapModeValue(context, params, restrictedWrapModes)) - { - return false; - } + return false; } - break; + } + break; case GL_TEXTURE_MIN_FILTER: + { + bool restrictedMinFilter = + target == TextureType::External || target == TextureType::Rectangle; + if (!ValidateTextureMinFilterValue(context, params, restrictedMinFilter)) { - bool restrictedMinFilter = - target == GL_TEXTURE_EXTERNAL_OES || target == GL_TEXTURE_RECTANGLE_ANGLE; - if (!ValidateTextureMinFilterValue(context, params, restrictedMinFilter)) - { - return false; - } + return false; } - break; + } + break; case GL_TEXTURE_MAG_FILTER: if (!ValidateTextureMagFilterValue(context, params)) @@ -5484,15 +5908,15 @@ bool ValidateTexParameterBase(Context *context, break; case GL_TEXTURE_MAX_ANISOTROPY_EXT: + { + GLfloat paramValue = static_cast(params[0]); + if (!ValidateTextureMaxAnisotropyValue(context, paramValue)) { - GLfloat paramValue = static_cast(params[0]); - if (!ValidateTextureMaxAnisotropyValue(context, paramValue)) - { - return false; - } - ASSERT(static_cast(paramValue) == params[0]); + return false; } - break; + ASSERT(static_cast(paramValue) == params[0]); + } + break; case GL_TEXTURE_MIN_LOD: case GL_TEXTURE_MAX_LOD: @@ -5539,19 +5963,19 @@ bool ValidateTexParameterBase(Context *context, context->handleError(InvalidValue() << "Base level must be at least 0."); return false; } - if (target == GL_TEXTURE_EXTERNAL_OES && static_cast(params[0]) != 0) + if (target == TextureType::External && static_cast(params[0]) != 0) { context->handleError(InvalidOperation() << "Base level must be 0 for external textures."); return false; } - if (target == GL_TEXTURE_2D_MULTISAMPLE && static_cast(params[0]) != 0) + if (target == TextureType::_2DMultisample && static_cast(params[0]) != 0) { context->handleError(InvalidOperation() << "Base level must be 0 for multisampled textures."); return false; } - if (target == GL_TEXTURE_RECTANGLE_ANGLE && static_cast(params[0]) != 0) + if (target == TextureType::Rectangle && static_cast(params[0]) != 0) { context->handleError(InvalidOperation() << "Base level must be 0 for rectangle textures."); @@ -5600,10 +6024,10 @@ bool ValidateTexParameterBase(Context *context, return true; } -template bool ValidateTexParameterBase(Context *, GLenum, GLenum, GLsizei, const GLfloat *); -template bool ValidateTexParameterBase(Context *, GLenum, GLenum, GLsizei, const GLint *); +template bool ValidateTexParameterBase(Context *, TextureType, GLenum, GLsizei, const GLfloat *); +template bool ValidateTexParameterBase(Context *, TextureType, GLenum, GLsizei, const GLint *); -bool ValidateVertexAttribIndex(ValidationContext *context, GLuint index) +bool ValidateVertexAttribIndex(Context *context, GLuint index) { if (index >= MAX_VERTEX_ATTRIBS) { @@ -5912,4 +6336,48 @@ bool ValidateGetInternalFormativBase(Context *context, return true; } +// We should check with Khronos if returning INVALID_FRAMEBUFFER_OPERATION is OK when querying +// implementation format info for incomplete framebuffers. It seems like these queries are +// incongruent with the other errors. +bool ValidateFramebufferComplete(Context *context, Framebuffer *framebuffer, bool isFramebufferOp) +{ + bool complete = false; + ANGLE_VALIDATION_TRY(framebuffer->isComplete(context, &complete)); + if (!complete) + { + if (isFramebufferOp) + { + context->handleError(InvalidFramebufferOperation()); + } + else + { + context->handleError(InvalidOperation()); + } + return false; + } + return true; +} + +bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuffer) +{ + GLint samples = 0; + ANGLE_VALIDATION_TRY(framebuffer->getSamples(context, &samples)); + if (samples != 0) + { + context->handleError(InvalidOperation()); + return false; + } + return true; +} + +bool ValidateMultitextureUnit(Context *context, GLenum texture) +{ + if (texture < GL_TEXTURE0 || texture >= GL_TEXTURE0 + context->getCaps().maxMultitextureUnits) + { + ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMultitextureUnit); + return false; + } + return true; +} + } // namespace gl diff --git a/gfx/angle/checkout/src/libANGLE/validationES.h b/gfx/angle/checkout/src/libANGLE/validationES.h index 8e3e8720f868..25324553a73f 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES.h +++ b/gfx/angle/checkout/src/libANGLE/validationES.h @@ -26,34 +26,35 @@ namespace gl { class Context; struct Format; +class Framebuffer; struct LinkedUniform; class Program; class Shader; -class ValidationContext; +void SetRobustLengthParam(GLsizei *length, GLsizei value); bool IsETC2EACFormat(const GLenum format); -bool ValidTextureTarget(const ValidationContext *context, GLenum target); -bool ValidTexture2DTarget(const ValidationContext *context, GLenum target); -bool ValidTexture3DTarget(const ValidationContext *context, GLenum target); -bool ValidTextureExternalTarget(const ValidationContext *context, GLenum target); -bool ValidTexture2DDestinationTarget(const ValidationContext *context, GLenum target); -bool ValidTexture3DDestinationTarget(const ValidationContext *context, GLenum target); -bool ValidTexLevelDestinationTarget(const ValidationContext *context, GLenum target); -bool ValidFramebufferTarget(const ValidationContext *context, GLenum target); -bool ValidMipLevel(const ValidationContext *context, GLenum target, GLint level); -bool ValidImageSizeParameters(ValidationContext *context, - GLenum target, +bool ValidTextureTarget(const Context *context, TextureType type); +bool ValidTexture2DTarget(const Context *context, TextureType type); +bool ValidTexture3DTarget(const Context *context, TextureType target); +bool ValidTextureExternalTarget(const Context *context, TextureType target); +bool ValidTexture2DDestinationTarget(const Context *context, TextureTarget target); +bool ValidTexture3DDestinationTarget(const Context *context, TextureType target); +bool ValidTexLevelDestinationTarget(const Context *context, TextureType type); +bool ValidFramebufferTarget(const Context *context, GLenum target); +bool ValidMipLevel(const Context *context, TextureType type, GLint level); +bool ValidImageSizeParameters(Context *context, + TextureType target, GLint level, GLsizei width, GLsizei height, GLsizei depth, bool isSubImage); -bool ValidCompressedImageSize(const ValidationContext *context, +bool ValidCompressedImageSize(const Context *context, GLenum internalFormat, GLint level, GLsizei width, GLsizei height); -bool ValidCompressedSubImageSize(const ValidationContext *context, +bool ValidCompressedSubImageSize(const Context *context, GLenum internalFormat, GLint xoffset, GLint yoffset, @@ -61,8 +62,8 @@ bool ValidCompressedSubImageSize(const ValidationContext *context, GLsizei height, size_t textureWidth, size_t textureHeight); -bool ValidImageDataSize(ValidationContext *context, - GLenum textureTarget, +bool ValidImageDataSize(Context *context, + TextureType texType, GLsizei width, GLsizei height, GLsizei depth, @@ -73,7 +74,7 @@ bool ValidImageDataSize(ValidationContext *context, bool ValidQueryType(const Context *context, GLenum queryType); -bool ValidateWebGLVertexAttribPointer(ValidationContext *context, +bool ValidateWebGLVertexAttribPointer(Context *context, GLenum type, GLboolean normalized, GLsizei stride, @@ -83,15 +84,15 @@ bool ValidateWebGLVertexAttribPointer(ValidationContext *context, // Returns valid program if id is a valid program name // Errors INVALID_OPERATION if valid shader is given and returns NULL // Errors INVALID_VALUE otherwise and returns NULL -Program *GetValidProgram(ValidationContext *context, GLuint id); +Program *GetValidProgram(Context *context, GLuint id); // Returns valid shader if id is a valid shader name // Errors INVALID_OPERATION if valid program is given and returns NULL // Errors INVALID_VALUE otherwise and returns NULL -Shader *GetValidShader(ValidationContext *context, GLuint id); +Shader *GetValidShader(Context *context, GLuint id); bool ValidateAttachmentTarget(Context *context, GLenum attachment); -bool ValidateRenderbufferStorageParametersBase(ValidationContext *context, +bool ValidateRenderbufferStorageParametersBase(Context *context, GLenum target, GLsizei samples, GLenum internalformat, @@ -210,37 +211,55 @@ bool ValidateGetQueryObjectui64vRobustANGLE(Context *context, GLsizei *length, GLuint64 *params); -bool ValidateUniformCommonBase(ValidationContext *context, +bool ValidateUniformCommonBase(Context *context, gl::Program *program, GLint location, GLsizei count, const LinkedUniform **uniformOut); -bool ValidateUniform1ivValue(ValidationContext *context, +bool ValidateUniform1ivValue(Context *context, GLenum uniformType, GLsizei count, const GLint *value); -bool ValidateUniformValue(ValidationContext *context, GLenum valueType, GLenum uniformType); -bool ValidateUniformMatrixValue(ValidationContext *context, GLenum valueType, GLenum uniformType); -bool ValidateUniform(ValidationContext *context, GLenum uniformType, GLint location, GLsizei count); -bool ValidateUniformMatrix(ValidationContext *context, +bool ValidateUniformValue(Context *context, GLenum valueType, GLenum uniformType); +bool ValidateUniformMatrixValue(Context *context, GLenum valueType, GLenum uniformType); +bool ValidateUniform(Context *context, GLenum uniformType, GLint location, GLsizei count); +bool ValidateUniformMatrix(Context *context, GLenum matrixType, GLint location, GLsizei count, GLboolean transpose); - -bool ValidateStateQuery(ValidationContext *context, +bool ValidateGetBooleanvRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLboolean *params); +bool ValidateGetFloatvRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); +bool ValidateStateQuery(Context *context, GLenum pname, GLenum *nativeType, unsigned int *numParams); - -bool ValidateRobustStateQuery(ValidationContext *context, +bool ValidateGetIntegervRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *data); +bool ValidateGetInteger64vRobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *data); +bool ValidateRobustStateQuery(Context *context, GLenum pname, GLsizei bufSize, GLenum *nativeType, unsigned int *numParams); -bool ValidateCopyTexImageParametersBase(ValidationContext *context, - GLenum target, +bool ValidateCopyTexImageParametersBase(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -254,8 +273,8 @@ bool ValidateCopyTexImageParametersBase(ValidationContext *context, GLint border, Format *textureFormatOut); -bool ValidateDrawBase(ValidationContext *context, GLenum mode, GLsizei count); -bool ValidateDrawArraysCommon(ValidationContext *context, +bool ValidateDrawBase(Context *context, GLenum mode, GLsizei count); +bool ValidateDrawArraysCommon(Context *context, GLenum mode, GLint first, GLsizei count, @@ -271,15 +290,15 @@ bool ValidateDrawArraysInstancedANGLE(Context *context, GLsizei count, GLsizei primcount); -bool ValidateDrawElementsBase(ValidationContext *context, GLenum type); -bool ValidateDrawElementsCommon(ValidationContext *context, +bool ValidateDrawElementsBase(Context *context, GLenum type); +bool ValidateDrawElementsCommon(Context *context, GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -bool ValidateDrawElementsInstancedCommon(ValidationContext *context, +bool ValidateDrawElementsInstancedCommon(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -304,11 +323,29 @@ bool ValidateGetnUniformfvEXT(Context *context, GLint location, GLsizei bufSize, GLfloat *params); +bool ValidateGetnUniformfvRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); bool ValidateGetnUniformivEXT(Context *context, GLuint program, GLint location, GLsizei bufSize, GLint *params); +bool ValidateGetnUniformivRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params); +bool ValidateGetnUniformuivRobustANGLE(Context *context, + GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params); bool ValidateGetUniformfvRobustANGLE(Context *context, GLuint program, GLint location, @@ -337,7 +374,9 @@ bool ValidateDiscardFramebufferBase(Context *context, bool ValidateInsertEventMarkerEXT(Context *context, GLsizei length, const char *marker); bool ValidatePushGroupMarkerEXT(Context *context, GLsizei length, const char *marker); -bool ValidateEGLImageTargetTexture2DOES(Context *context, GLenum target, GLeglImageOES image); +bool ValidateEGLImageTargetTexture2DOES(Context *context, + gl::TextureType type, + GLeglImageOES image); bool ValidateEGLImageTargetRenderbufferStorageOES(Context *context, GLenum target, GLeglImageOES image); @@ -356,7 +395,7 @@ bool ValidateGetProgramBinaryBase(Context *context, GLenum *binaryFormat, void *binary); -bool ValidateDrawBuffersBase(ValidationContext *context, GLsizei n, const GLenum *bufs); +bool ValidateDrawBuffersBase(Context *context, GLsizei n, const GLenum *bufs); bool ValidateGetBufferPointervBase(Context *context, BufferBinding target, @@ -376,8 +415,8 @@ bool ValidateFlushMappedBufferRangeBase(Context *context, bool ValidateGenOrDelete(Context *context, GLint n); -bool ValidateRobustEntryPoint(ValidationContext *context, GLsizei bufSize); -bool ValidateRobustBufferSize(ValidationContext *context, GLsizei bufSize, GLsizei numParams); +bool ValidateRobustEntryPoint(Context *context, GLsizei bufSize); +bool ValidateRobustBufferSize(Context *context, GLsizei bufSize, GLsizei numParams); bool ValidateGetFramebufferAttachmentParameterivBase(Context *context, GLenum target, @@ -389,36 +428,35 @@ bool ValidateGetFramebufferAttachmentParameterivRobustANGLE(Context *context, GLenum attachment, GLenum pname, GLsizei bufSize, - GLsizei *numParams); + GLsizei *length, + GLint *params); -bool ValidateGetBufferParameterBase(ValidationContext *context, +bool ValidateGetBufferParameterBase(Context *context, BufferBinding target, GLenum pname, bool pointerVersion, GLsizei *numParams); -bool ValidateGetBufferParameterivRobustANGLE(ValidationContext *context, +bool ValidateGetBufferParameterivRobustANGLE(Context *context, BufferBinding target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params); -bool ValidateGetBufferParameteri64vRobustANGLE(ValidationContext *context, +bool ValidateGetBufferParameteri64vRobustANGLE(Context *context, BufferBinding target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint64 *params); -bool ValidateGetProgramivBase(ValidationContext *context, - GLuint program, - GLenum pname, - GLsizei *numParams); +bool ValidateGetProgramivBase(Context *context, GLuint program, GLenum pname, GLsizei *numParams); bool ValidateGetProgramivRobustANGLE(Context *context, GLuint program, GLenum pname, GLsizei bufSize, - GLsizei *numParams); + GLsizei *length, + GLint *params); bool ValidateGetRenderbufferParameterivBase(Context *context, GLenum target, @@ -439,36 +477,61 @@ bool ValidateGetShaderivRobustANGLE(Context *context, GLsizei *length, GLint *params); -bool ValidateGetTexParameterBase(Context *context, GLenum target, GLenum pname, GLsizei *length); +bool ValidateGetTexParameterBase(Context *context, + TextureType target, + GLenum pname, + GLsizei *length); bool ValidateGetTexParameterfvRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, GLsizei *length, GLfloat *params); bool ValidateGetTexParameterivRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params); +bool ValidateGetTexParameterIivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +bool ValidateGetTexParameterIuivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); template bool ValidateTexParameterBase(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const ParamType *params); bool ValidateTexParameterfvRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const GLfloat *params); bool ValidateTexParameterivRobustANGLE(Context *context, - GLenum target, + TextureType target, GLenum pname, GLsizei bufSize, const GLint *params); +bool ValidateTexParameterIivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + const GLint *params); +bool ValidateTexParameterIuivRobustANGLE(Context *context, + TextureType target, + GLenum pname, + GLsizei bufSize, + const GLuint *params); bool ValidateGetSamplerParameterfvRobustANGLE(Context *context, GLuint sampler, @@ -479,9 +542,21 @@ bool ValidateGetSamplerParameterfvRobustANGLE(Context *context, bool ValidateGetSamplerParameterivRobustANGLE(Context *context, GLuint sampler, GLenum pname, - GLuint bufSize, + GLsizei bufSize, GLsizei *length, GLint *params); +bool ValidateGetSamplerParameterIivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +bool ValidateGetSamplerParameterIuivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); bool ValidateSamplerParameterfvRobustANGLE(Context *context, GLuint sampler, @@ -493,6 +568,16 @@ bool ValidateSamplerParameterivRobustANGLE(Context *context, GLenum pname, GLsizei bufSize, const GLint *params); +bool ValidateSamplerParameterIivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param); +bool ValidateSamplerParameterIuivRobustANGLE(Context *context, + GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param); bool ValidateGetVertexAttribBase(Context *context, GLuint index, @@ -551,22 +636,20 @@ bool ValidateGetInternalFormativRobustANGLE(Context *context, GLsizei *length, GLint *params); -bool ValidateVertexFormatBase(ValidationContext *context, +bool ValidateVertexFormatBase(Context *context, GLuint attribIndex, GLint size, GLenum type, GLboolean pureInteger); -bool ValidateWebGLFramebufferAttachmentClearType(ValidationContext *context, +bool ValidateWebGLFramebufferAttachmentClearType(Context *context, GLint drawbuffer, const GLenum *validComponentTypes, size_t validComponentTypeCount); -bool ValidateRobustCompressedTexImageBase(ValidationContext *context, - GLsizei imageSize, - GLsizei dataSize); +bool ValidateRobustCompressedTexImageBase(Context *context, GLsizei imageSize, GLsizei dataSize); -bool ValidateVertexAttribIndex(ValidationContext *context, GLuint index); +bool ValidateVertexAttribIndex(Context *context, GLuint index); bool ValidateGetActiveUniformBlockivBase(Context *context, GLuint program, @@ -593,6 +676,17 @@ bool ValidateGetInternalFormativBase(Context *context, GLsizei bufSize, GLsizei *numParams); +bool ValidateFramebufferComplete(Context *context, Framebuffer *framebuffer, bool isFramebufferOp); +bool ValidateFramebufferNotMultisampled(Context *context, Framebuffer *framebuffer); + +bool ValidateMultitextureUnit(Context *context, GLenum texture); + +// Utility macro for handling implementation methods inside Validation. +#define ANGLE_HANDLE_VALIDATION_ERR(X) \ + context->handleError(X); \ + return false; +#define ANGLE_VALIDATION_TRY(EXPR) ANGLE_TRY_TEMPLATE(EXPR, ANGLE_HANDLE_VALIDATION_ERR); + } // namespace gl #endif // LIBANGLE_VALIDATION_ES_H_ diff --git a/gfx/angle/checkout/src/libANGLE/validationES1.cpp b/gfx/angle/checkout/src/libANGLE/validationES1.cpp index f713129f7804..160c31f7a5ca 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES1.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationES1.cpp @@ -9,20 +9,54 @@ #include "libANGLE/validationES1.h" #include "common/debug.h" +#include "libANGLE/Context.h" +#include "libANGLE/ErrorStrings.h" +#include "libANGLE/validationES.h" + +#define ANGLE_VALIDATE_IS_GLES1(context) \ + if (context->getClientMajorVersion() > 1) \ + { \ + ANGLE_VALIDATION_ERR(context, InvalidOperation(), GLES1Only); \ + return false; \ + } + +namespace +{ + +bool ValidateAlphaFuncCommon(gl::Context *context, gl::AlphaTestFunc func) +{ + switch (func) + { + case gl::AlphaTestFunc::AlwaysPass: + case gl::AlphaTestFunc::Equal: + case gl::AlphaTestFunc::Gequal: + case gl::AlphaTestFunc::Greater: + case gl::AlphaTestFunc::Lequal: + case gl::AlphaTestFunc::Less: + case gl::AlphaTestFunc::Never: + case gl::AlphaTestFunc::NotEqual: + return true; + default: + context->handleError(gl::InvalidEnum() << gl::kErrorEnumNotSupported); + return false; + } +} + +} // anonymous namespace namespace gl { -bool ValidateAlphaFunc(Context *context, GLenum func, GLfloat ref) +bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + return ValidateAlphaFuncCommon(context, func); } -bool ValidateAlphaFuncx(Context *context, GLenum func, GLfixed ref) +bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + return ValidateAlphaFuncCommon(context, func); } bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) @@ -39,8 +73,8 @@ bool ValidateClearDepthx(Context *context, GLfixed depth) bool ValidateClientActiveTexture(Context *context, GLenum texture) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + return ValidateMultitextureUnit(context, texture); } bool ValidateClipPlanef(Context *context, GLenum p, const GLfloat *eqn) @@ -57,19 +91,19 @@ bool ValidateClipPlanex(Context *context, GLenum plane, const GLfixed *equation) bool ValidateColor4f(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateColor4ub(Context *context, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateColor4x(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } @@ -227,7 +261,7 @@ bool ValidateGetTexEnvxv(Context *context, GLenum target, GLenum pname, GLfixed return true; } -bool ValidateGetTexParameterxv(Context *context, GLenum target, GLenum pname, GLfixed *params) +bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params) { UNIMPLEMENTED(); return true; @@ -289,19 +323,19 @@ bool ValidateLineWidthx(Context *context, GLfixed width) bool ValidateLoadIdentity(Context *context) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateLoadMatrixf(Context *context, const GLfloat *m) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateLoadMatrixx(Context *context, const GLfixed *m) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } @@ -335,21 +369,30 @@ bool ValidateMaterialxv(Context *context, GLenum face, GLenum pname, const GLfix return true; } -bool ValidateMatrixMode(Context *context, GLenum mode) +bool ValidateMatrixMode(Context *context, MatrixType mode) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + switch (mode) + { + case MatrixType::Projection: + case MatrixType::Modelview: + case MatrixType::Texture: + return true; + default: + ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidMatrixMode); + return false; + } } bool ValidateMultMatrixf(Context *context, const GLfloat *m) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateMultMatrixx(Context *context, const GLfixed *m) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } @@ -360,30 +403,30 @@ bool ValidateMultiTexCoord4f(Context *context, GLfloat r, GLfloat q) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + return ValidateMultitextureUnit(context, target); } bool ValidateMultiTexCoord4x(Context *context, - GLenum texture, + GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { - UNIMPLEMENTED(); - return true; + ANGLE_VALIDATE_IS_GLES1(context); + return ValidateMultitextureUnit(context, target); } bool ValidateNormal3f(Context *context, GLfloat nx, GLfloat ny, GLfloat nz) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } bool ValidateNormal3x(Context *context, GLfixed nx, GLfixed ny, GLfixed nz) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); return true; } @@ -461,13 +504,25 @@ bool ValidatePolygonOffsetx(Context *context, GLfixed factor, GLfixed units) bool ValidatePopMatrix(Context *context) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); + const auto &stack = context->getGLState().gles1().currentMatrixStack(); + if (stack.size() == 1) + { + ANGLE_VALIDATION_ERR(context, StackUnderflow(), MatrixStackUnderflow); + return false; + } return true; } bool ValidatePushMatrix(Context *context) { - UNIMPLEMENTED(); + ANGLE_VALIDATE_IS_GLES1(context); + const auto &stack = context->getGLState().gles1().currentMatrixStack(); + if (stack.size() == stack.max_size()) + { + ANGLE_VALIDATION_ERR(context, StackOverflow(), MatrixStackOverflow); + return false; + } return true; } @@ -553,13 +608,16 @@ bool ValidateTexEnvxv(Context *context, GLenum target, GLenum pname, const GLfix return true; } -bool ValidateTexParameterx(Context *context, GLenum target, GLenum pname, GLfixed param) +bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param) { UNIMPLEMENTED(); return true; } -bool ValidateTexParameterxv(Context *context, GLenum target, GLenum pname, const GLfixed *params) +bool ValidateTexParameterxv(Context *context, + TextureType target, + GLenum pname, + const GLfixed *params) { UNIMPLEMENTED(); return true; @@ -693,4 +751,170 @@ bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponen UNIMPLEMENTED(); return true; } + +bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateFramebufferRenderbufferOES(Context *context, + GLenum target, + GLenum attachment, + GLenum rbtarget, + GLuint renderbuffer) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateFramebufferTexture2DOES(Context *context, + GLenum target, + GLenum attachment, + TextureTarget textarget, + GLuint texture, + GLint level) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGenerateMipmapOES(Context *context, TextureType target) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGetFramebufferAttachmentParameterivOES(Context *context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGetRenderbufferParameterivOES(Context *context, + GLenum target, + GLenum pname, + GLint *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateRenderbufferStorageOES(Context *context, + GLenum target, + GLint internalformat, + GLsizei width, + GLsizei height) +{ + UNIMPLEMENTED(); + return true; +} + +// GL_OES_texture_cube_map + +bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *param) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLint *param) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param) +{ + UNIMPLEMENTED(); + return true; +} + +bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param) +{ + UNIMPLEMENTED(); + return true; +} } diff --git a/gfx/angle/checkout/src/libANGLE/validationES1.h b/gfx/angle/checkout/src/libANGLE/validationES1.h index baee0f29da7c..be871e7f0c2f 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES1.h +++ b/gfx/angle/checkout/src/libANGLE/validationES1.h @@ -18,8 +18,8 @@ namespace gl { class Context; -bool ValidateAlphaFunc(Context *context, GLenum func, GLfloat ref); -bool ValidateAlphaFuncx(Context *context, GLenum func, GLfixed ref); +bool ValidateAlphaFunc(Context *context, AlphaTestFunc func, GLfloat ref); +bool ValidateAlphaFuncx(Context *context, AlphaTestFunc func, GLfixed ref); bool ValidateClearColorx(Context *context, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); bool ValidateClearDepthx(Context *context, GLfixed depth); bool ValidateClientActiveTexture(Context *context, GLenum texture); @@ -67,7 +67,7 @@ bool ValidateGetPointerv(Context *context, GLenum pname, void **params); bool ValidateGetTexEnvfv(Context *context, GLenum target, GLenum pname, GLfloat *params); bool ValidateGetTexEnviv(Context *context, GLenum target, GLenum pname, GLint *params); bool ValidateGetTexEnvxv(Context *context, GLenum target, GLenum pname, GLfixed *params); -bool ValidateGetTexParameterxv(Context *context, GLenum target, GLenum pname, GLfixed *params); +bool ValidateGetTexParameterxv(Context *context, TextureType target, GLenum pname, GLfixed *params); bool ValidateLightModelf(Context *context, GLenum pname, GLfloat param); bool ValidateLightModelfv(Context *context, GLenum pname, const GLfloat *params); bool ValidateLightModelx(Context *context, GLenum pname, GLfixed param); @@ -85,7 +85,7 @@ bool ValidateMaterialf(Context *context, GLenum face, GLenum pname, GLfloat para bool ValidateMaterialfv(Context *context, GLenum face, GLenum pname, const GLfloat *params); bool ValidateMaterialx(Context *context, GLenum face, GLenum pname, GLfixed param); bool ValidateMaterialxv(Context *context, GLenum face, GLenum pname, const GLfixed *param); -bool ValidateMatrixMode(Context *context, GLenum mode); +bool ValidateMatrixMode(Context *context, MatrixType mode); bool ValidateMultMatrixf(Context *context, const GLfloat *m); bool ValidateMultMatrixx(Context *context, const GLfixed *m); bool ValidateMultiTexCoord4f(Context *context, @@ -143,8 +143,11 @@ bool ValidateTexEnvi(Context *context, GLenum target, GLenum pname, GLint param) bool ValidateTexEnviv(Context *context, GLenum target, GLenum pname, const GLint *params); bool ValidateTexEnvx(Context *context, GLenum target, GLenum pname, GLfixed param); bool ValidateTexEnvxv(Context *context, GLenum target, GLenum pname, const GLfixed *params); -bool ValidateTexParameterx(Context *context, GLenum target, GLenum pname, GLfixed param); -bool ValidateTexParameterxv(Context *context, GLenum target, GLenum pname, const GLfixed *params); +bool ValidateTexParameterx(Context *context, TextureType target, GLenum pname, GLfixed param); +bool ValidateTexParameterxv(Context *context, + TextureType target, + GLenum pname, + const GLfixed *params); bool ValidateTranslatef(Context *context, GLfloat x, GLfloat y, GLfloat z); bool ValidateTranslatex(Context *context, GLfixed x, GLfixed y, GLfixed z); bool ValidateVertexPointer(Context *context, @@ -200,6 +203,64 @@ bool ValidatePointSizePointerOES(Context *context, // GL_OES_query_matrix bool ValidateQueryMatrixxOES(Context *context, GLfixed *mantissa, GLint *exponent); -} + +// GL_OES_framebuffer_object +bool ValidateGenFramebuffersOES(Context *context, GLsizei n, GLuint *framebuffers); +bool ValidateDeleteFramebuffersOES(Context *context, GLsizei n, const GLuint *framebuffers); + +bool ValidateGenRenderbuffersOES(Context *context, GLsizei n, GLuint *renderbuffers); +bool ValidateDeleteRenderbuffersOES(Context *context, GLsizei n, const GLuint *renderbuffers); + +bool ValidateBindFramebufferOES(Context *context, GLenum target, GLuint framebuffer); +bool ValidateBindRenderbufferOES(Context *context, GLenum target, GLuint renderbuffer); +bool ValidateCheckFramebufferStatusOES(Context *context, GLenum target); +bool ValidateFramebufferRenderbufferOES(Context *context, + GLenum target, + GLenum attachment, + GLenum rbtarget, + GLuint renderbuffer); +bool ValidateFramebufferTexture2DOES(Context *context, + GLenum target, + GLenum attachment, + TextureTarget textarget, + GLuint texture, + GLint level); + +bool ValidateGenerateMipmapOES(Context *context, TextureType target); + +bool ValidateGetFramebufferAttachmentParameterivOES(Context *context, + GLenum target, + GLenum attachment, + GLenum pname, + GLint *params); + +bool ValidateGetRenderbufferParameterivOES(Context *context, + GLenum target, + GLenum pname, + GLint *params); + +bool ValidateIsFramebufferOES(Context *context, GLuint framebuffer); +bool ValidateIsRenderbufferOES(Context *context, GLuint renderbuffer); + +bool ValidateRenderbufferStorageOES(Context *context, + GLenum target, + GLint internalformat, + GLsizei width, + GLsizei height); + +// GL_OES_texture_cube_map +bool ValidateGetTexGenfvOES(Context *context, GLenum coord, GLenum pname, GLfloat *params); +bool ValidateGetTexGenivOES(Context *context, GLenum coord, GLenum pname, int *params); +bool ValidateGetTexGenxvOES(Context *context, GLenum coord, GLenum pname, GLfixed *params); + +bool ValidateTexGenfvOES(Context *context, GLenum coord, GLenum pname, const GLfloat *params); +bool ValidateTexGenivOES(Context *context, GLenum coord, GLenum pname, const GLint *params); +bool ValidateTexGenxvOES(Context *context, GLenum coord, GLenum pname, const GLfixed *params); + +bool ValidateTexGenfOES(Context *context, GLenum coord, GLenum pname, GLfloat param); +bool ValidateTexGeniOES(Context *context, GLenum coord, GLenum pname, GLint param); +bool ValidateTexGenxOES(Context *context, GLenum coord, GLenum pname, GLfixed param); + +} // namespace gl #endif // LIBANGLE_VALIDATION_ES1_H_ diff --git a/gfx/angle/checkout/src/libANGLE/validationES2.cpp b/gfx/angle/checkout/src/libANGLE/validationES2.cpp index 4bb3b9783420..bb164ef5cc19 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES2.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationES2.cpp @@ -75,7 +75,7 @@ bool ValidatePathInstances(gl::Context *context, for (GLsizei i = 0; i < numPaths; ++i) { const GLuint pathName = array[i] + pathBase; - if (context->hasPath(pathName) && !context->hasPathData(pathName)) + if (context->isPathGenerated(pathName) && !context->isPath(pathName)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -307,20 +307,20 @@ bool IsValidCopyTextureDestinationFormatType(Context *context, GLint internalFor return true; } -bool IsValidCopyTextureDestinationTargetEnum(Context *context, GLenum target) +bool IsValidCopyTextureDestinationTargetEnum(Context *context, TextureTarget target) { switch (target) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureTarget::_2D: + case TextureTarget::CubeMapNegativeX: + case TextureTarget::CubeMapNegativeY: + case TextureTarget::CubeMapNegativeZ: + case TextureTarget::CubeMapPositiveX: + case TextureTarget::CubeMapPositiveY: + case TextureTarget::CubeMapPositiveZ: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureTarget::Rectangle: return context->getExtensions().textureRectangle; default: @@ -328,25 +328,20 @@ bool IsValidCopyTextureDestinationTargetEnum(Context *context, GLenum target) } } -bool IsValidCopyTextureDestinationTarget(Context *context, GLenum textureType, GLenum target) +bool IsValidCopyTextureDestinationTarget(Context *context, + TextureType textureType, + TextureTarget target) { - if (IsCubeMapTextureTarget(target)) - { - return textureType == GL_TEXTURE_CUBE_MAP; - } - else - { - return textureType == target; - } + return TextureTargetToType(target) == textureType; } -bool IsValidCopyTextureSourceTarget(Context *context, GLenum target) +bool IsValidCopyTextureSourceTarget(Context *context, TextureType type) { - switch (target) + switch (type) { - case GL_TEXTURE_2D: + case TextureType::_2D: return true; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: return context->getExtensions().textureRectangle; // TODO(geofflang): accept GL_TEXTURE_EXTERNAL_OES if the texture_external extension is @@ -357,9 +352,9 @@ bool IsValidCopyTextureSourceTarget(Context *context, GLenum target) } } -bool IsValidCopyTextureSourceLevel(Context *context, GLenum target, GLint level) +bool IsValidCopyTextureSourceLevel(Context *context, TextureType type, GLint level) { - if (!ValidMipLevel(context, target, level)) + if (!ValidMipLevel(context, type, level)) { return false; } @@ -373,44 +368,39 @@ bool IsValidCopyTextureSourceLevel(Context *context, GLenum target, GLint level) } bool IsValidCopyTextureDestinationLevel(Context *context, - GLenum target, + TextureType type, GLint level, GLsizei width, - GLsizei height) + GLsizei height, + bool isSubImage) { - if (!ValidMipLevel(context, target, level)) + if (!ValidMipLevel(context, type, level)) + { + return false; + } + + if (!ValidImageSizeParameters(context, type, level, width, height, 1, isSubImage)) { return false; } const Caps &caps = context->getCaps(); - if (target == GL_TEXTURE_2D) + switch (type) { - if (static_cast(width) > (caps.max2DTextureSize >> level) || - static_cast(height) > (caps.max2DTextureSize >> level)) - { - return false; - } - } - else if (target == GL_TEXTURE_RECTANGLE_ANGLE) - { - ASSERT(level == 0); - if (static_cast(width) > caps.maxRectangleTextureSize || - static_cast(height) > caps.maxRectangleTextureSize) - { - return false; - } - } - else if (IsCubeMapTextureTarget(target)) - { - if (static_cast(width) > (caps.maxCubeMapTextureSize >> level) || - static_cast(height) > (caps.maxCubeMapTextureSize >> level)) - { - return false; - } - } + case TextureType::_2D: + return static_cast(width) <= (caps.max2DTextureSize >> level) && + static_cast(height) <= (caps.max2DTextureSize >> level); + case TextureType::Rectangle: + ASSERT(level == 0); + return static_cast(width) <= (caps.max2DTextureSize >> level) && + static_cast(height) <= (caps.max2DTextureSize >> level); - return true; + case TextureType::CubeMap: + return static_cast(width) <= (caps.maxCubeMapTextureSize >> level) && + static_cast(height) <= (caps.maxCubeMapTextureSize >> level); + default: + return true; + } } bool IsValidStencilFunc(GLenum func) @@ -465,8 +455,8 @@ bool IsValidStencilOp(GLenum op) } } -bool ValidateES2CopyTexImageParameters(ValidationContext *context, - GLenum target, +bool ValidateES2CopyTexImageParameters(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -484,7 +474,8 @@ bool ValidateES2CopyTexImageParameters(ValidationContext *context, return false; } - if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage)) + TextureType texType = TextureTargetToType(target); + if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage)) { context->handleError(InvalidValue() << "Invalid texture dimensions."); return false; @@ -801,6 +792,10 @@ bool ValidCap(const Context *context, GLenum cap, bool queryOnly) case GL_ROBUST_RESOURCE_INITIALIZATION_ANGLE: return queryOnly && context->getExtensions().robustResourceInitialization; + // GLES1 emulation: GLES1-specific caps + case GL_ALPHA_TEST: + return context->getClientVersion() < Version(2, 0); + default: return false; } @@ -963,7 +958,7 @@ bool IsValidESSLShaderSourceString(const char *str, size_t len, bool lineContinu return true; } -bool ValidateWebGLNamePrefix(ValidationContext *context, const GLchar *name) +bool ValidateWebGLNamePrefix(Context *context, const GLchar *name) { ASSERT(context->isWebGL()); @@ -978,7 +973,7 @@ bool ValidateWebGLNamePrefix(ValidationContext *context, const GLchar *name) return true; } -bool ValidateWebGLNameLength(ValidationContext *context, size_t length) +bool ValidateWebGLNameLength(Context *context, size_t length) { ASSERT(context->isWebGL()); @@ -1020,7 +1015,7 @@ bool ValidateMatrixMode(Context *context, GLenum matrixMode) } // anonymous namespace bool ValidateES2TexImageParameters(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, bool isCompressed, @@ -1041,13 +1036,14 @@ bool ValidateES2TexImageParameters(Context *context, return false; } - if (!ValidImageSizeParameters(context, target, level, width, height, 1, isSubImage)) + TextureType texType = TextureTargetToType(target); + if (!ValidImageSizeParameters(context, texType, level, width, height, 1, isSubImage)) { context->handleError(InvalidValue()); return false; } - if (!ValidMipLevel(context, target, level)) + if (!ValidMipLevel(context, texType, level)) { ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); return false; @@ -1077,54 +1073,54 @@ bool ValidateES2TexImageParameters(Context *context, const gl::Caps &caps = context->getCaps(); - if (target == GL_TEXTURE_2D) + switch (texType) { - if (static_cast(width) > (caps.max2DTextureSize >> level) || - static_cast(height) > (caps.max2DTextureSize >> level)) - { - context->handleError(InvalidValue()); - return false; - } - } - else if (target == GL_TEXTURE_RECTANGLE_ANGLE) - { - ASSERT(level == 0); - if (static_cast(width) > caps.maxRectangleTextureSize || - static_cast(height) > caps.maxRectangleTextureSize) - { - context->handleError(InvalidValue()); - return false; - } - if (isCompressed) - { - context->handleError(InvalidEnum() - << "Rectangle texture cannot have a compressed format."); - return false; - } - } - else if (IsCubeMapTextureTarget(target)) - { - if (!isSubImage && width != height) - { - ANGLE_VALIDATION_ERR(context, InvalidValue(), CubemapFacesEqualDimensions); - return false; - } + case TextureType::_2D: + if (static_cast(width) > (caps.max2DTextureSize >> level) || + static_cast(height) > (caps.max2DTextureSize >> level)) + { + context->handleError(InvalidValue()); + return false; + } + break; - if (static_cast(width) > (caps.maxCubeMapTextureSize >> level) || - static_cast(height) > (caps.maxCubeMapTextureSize >> level)) - { - context->handleError(InvalidValue()); + case TextureType::Rectangle: + ASSERT(level == 0); + if (static_cast(width) > caps.maxRectangleTextureSize || + static_cast(height) > caps.maxRectangleTextureSize) + { + context->handleError(InvalidValue()); + return false; + } + if (isCompressed) + { + context->handleError(InvalidEnum() + << "Rectangle texture cannot have a compressed format."); + return false; + } + break; + + case TextureType::CubeMap: + if (!isSubImage && width != height) + { + ANGLE_VALIDATION_ERR(context, InvalidValue(), CubemapFacesEqualDimensions); + return false; + } + + if (static_cast(width) > (caps.maxCubeMapTextureSize >> level) || + static_cast(height) > (caps.maxCubeMapTextureSize >> level)) + { + context->handleError(InvalidValue()); + return false; + } + break; + + default: + context->handleError(InvalidEnum()); return false; - } - } - else - { - context->handleError(InvalidEnum()); - return false; } - gl::Texture *texture = - context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + gl::Texture *texture = context->getTargetTexture(texType); if (!texture) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferNotBound); @@ -1158,7 +1154,7 @@ bool ValidateES2TexImageParameters(Context *context, } if (width > 0 && height > 0 && pixels == nullptr && - context->getGLState().getTargetBuffer(gl::BufferBinding::PixelUnpack) == nullptr) + context->getGLState().getTargetBuffer(BufferBinding::PixelUnpack) == nullptr) { ANGLE_VALIDATION_ERR(context, InvalidValue(), PixelDataNull); return false; @@ -1501,7 +1497,7 @@ bool ValidateES2TexImageParameters(Context *context, context->handleError(InvalidValue()); return false; } - if (target != GL_TEXTURE_2D) + if (target != TextureTarget::_2D) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), MismatchedTargetAndFormat); return false; @@ -1591,7 +1587,7 @@ bool ValidateES2TexImageParameters(Context *context, } GLenum sizeCheckFormat = isSubImage ? format : internalformat; - if (!ValidImageDataSize(context, target, width, height, 1, sizeCheckFormat, type, pixels, + if (!ValidImageDataSize(context, texType, width, height, 1, sizeCheckFormat, type, pixels, imageSize)) { return false; @@ -1601,14 +1597,14 @@ bool ValidateES2TexImageParameters(Context *context, } bool ValidateES2TexStorageParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { - if (target != GL_TEXTURE_2D && target != GL_TEXTURE_CUBE_MAP && - target != GL_TEXTURE_RECTANGLE_ANGLE) + if (target != TextureType::_2D && target != TextureType::CubeMap && + target != TextureType::Rectangle) { context->handleError(InvalidEnum()); return false; @@ -1620,7 +1616,7 @@ bool ValidateES2TexStorageParameters(Context *context, return false; } - if (target == GL_TEXTURE_CUBE_MAP && width != height) + if (target == TextureType::CubeMap && width != height) { context->handleError(InvalidValue()); return false; @@ -1643,7 +1639,7 @@ bool ValidateES2TexStorageParameters(Context *context, switch (target) { - case GL_TEXTURE_2D: + case TextureType::_2D: if (static_cast(width) > caps.max2DTextureSize || static_cast(height) > caps.max2DTextureSize) { @@ -1651,7 +1647,7 @@ bool ValidateES2TexStorageParameters(Context *context, return false; } break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: if (static_cast(width) > caps.maxRectangleTextureSize || static_cast(height) > caps.maxRectangleTextureSize || levels != 1) { @@ -1665,7 +1661,7 @@ bool ValidateES2TexStorageParameters(Context *context, return false; } break; - case GL_TEXTURE_CUBE_MAP: + case TextureType::CubeMap: if (static_cast(width) > caps.maxCubeMapTextureSize || static_cast(height) > caps.maxCubeMapTextureSize) { @@ -1784,7 +1780,7 @@ bool ValidateES2TexStorageParameters(Context *context, context->handleError(InvalidEnum()); return false; } - if (target != GL_TEXTURE_2D) + if (target != TextureType::_2D) { context->handleError(InvalidOperation()); return false; @@ -2423,6 +2419,16 @@ bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params) return true; } +bool ValidateGetPointervRobustANGLERobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateBlitFramebufferANGLE(Context *context, GLint srcX0, GLint srcY0, @@ -2467,7 +2473,7 @@ bool ValidateBlitFramebufferANGLE(Context *context, if (readColorAttachment && drawColorAttachment) { if (!(readColorAttachment->type() == GL_TEXTURE && - readColorAttachment->getTextureImageIndex().type == GL_TEXTURE_2D) && + readColorAttachment->getTextureImageIndex().type == TextureType::_2D) && readColorAttachment->type() != GL_RENDERBUFFER && readColorAttachment->type() != GL_FRAMEBUFFER_DEFAULT) { @@ -2483,7 +2489,7 @@ bool ValidateBlitFramebufferANGLE(Context *context, if (attachment) { if (!(attachment->type() == GL_TEXTURE && - attachment->getTextureImageIndex().type == GL_TEXTURE_2D) && + attachment->getTextureImageIndex().type == TextureType::_2D) && attachment->type() != GL_RENDERBUFFER && attachment->type() != GL_FRAMEBUFFER_DEFAULT) { @@ -2501,7 +2507,9 @@ bool ValidateBlitFramebufferANGLE(Context *context, } } - if (readFramebuffer->getSamples(context) != 0 && + GLint samples = 0; + ANGLE_VALIDATION_TRY(readFramebuffer->getSamples(context, &samples)); + if (samples != 0 && IsPartialBlit(context, readColorAttachment, drawColorAttachment, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1)) { @@ -2547,12 +2555,12 @@ bool ValidateBlitFramebufferANGLE(Context *context, dstX1, dstY1, mask, filter); } -bool ValidateClear(ValidationContext *context, GLbitfield mask) +bool ValidateClear(Context *context, GLbitfield mask) { Framebuffer *fbo = context->getGLState().getDrawFramebuffer(); - if (fbo->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + + if (!ValidateFramebufferComplete(context, fbo, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } @@ -2581,7 +2589,7 @@ bool ValidateClear(ValidationContext *context, GLbitfield mask) return true; } -bool ValidateDrawBuffersEXT(ValidationContext *context, GLsizei n, const GLenum *bufs) +bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs) { if (!context->getExtensions().drawBuffers) { @@ -2593,7 +2601,7 @@ bool ValidateDrawBuffersEXT(ValidationContext *context, GLsizei n, const GLenum } bool ValidateTexImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -2616,7 +2624,7 @@ bool ValidateTexImage2D(Context *context, } bool ValidateTexImage2DRobust(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -2646,7 +2654,7 @@ bool ValidateTexImage2DRobust(Context *context, } bool ValidateTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -2670,7 +2678,7 @@ bool ValidateTexSubImage2D(Context *context, } bool ValidateTexSubImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -2700,7 +2708,7 @@ bool ValidateTexSubImage2DRobustANGLE(Context *context, } bool ValidateCompressedTexImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -2742,7 +2750,7 @@ bool ValidateCompressedTexImage2D(Context *context, return false; } - if (target == GL_TEXTURE_RECTANGLE_ANGLE) + if (target == TextureTarget::Rectangle) { context->handleError(InvalidEnum() << "Rectangle texture cannot have a compressed format."); return false; @@ -2752,7 +2760,7 @@ bool ValidateCompressedTexImage2D(Context *context, } bool ValidateCompressedTexImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -2770,8 +2778,9 @@ bool ValidateCompressedTexImage2DRobustANGLE(Context *context, return ValidateCompressedTexImage2D(context, target, level, internalformat, width, height, border, imageSize, data); } + bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -2792,7 +2801,7 @@ bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context, } bool ValidateCompressedTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -2930,6 +2939,13 @@ bool ValidateMapBufferBase(Context *context, BufferBinding target) } } + if (context->getExtensions().webglCompatibility && + buffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback); + return false; + } + return true; } @@ -2947,10 +2963,10 @@ bool ValidateFlushMappedBufferRangeEXT(Context *context, return ValidateFlushMappedBufferRangeBase(context, target, offset, length); } -bool ValidateBindTexture(Context *context, GLenum target, GLuint texture) +bool ValidateBindTexture(Context *context, TextureType target, GLuint texture) { Texture *textureObject = context->getTexture(texture); - if (textureObject && textureObject->getTarget() != target && texture != 0) + if (textureObject && textureObject->getType() != target && texture != 0) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), TypeMismatch); return false; @@ -2965,11 +2981,11 @@ bool ValidateBindTexture(Context *context, GLenum target, GLuint texture) switch (target) { - case GL_TEXTURE_2D: - case GL_TEXTURE_CUBE_MAP: + case TextureType::_2D: + case TextureType::CubeMap: break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: if (!context->getExtensions().textureRectangle) { context->handleError(InvalidEnum() @@ -2978,8 +2994,8 @@ bool ValidateBindTexture(Context *context, GLenum target, GLuint texture) } break; - case GL_TEXTURE_3D: - case GL_TEXTURE_2D_ARRAY: + case TextureType::_3D: + case TextureType::_2DArray: if (context->getClientMajorVersion() < 3) { ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES3Required); @@ -2987,7 +3003,7 @@ bool ValidateBindTexture(Context *context, GLenum target, GLuint texture) } break; - case GL_TEXTURE_2D_MULTISAMPLE: + case TextureType::_2DMultisample: if (context->getClientVersion() < Version(3, 1)) { ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required); @@ -2995,7 +3011,7 @@ bool ValidateBindTexture(Context *context, GLenum target, GLuint texture) } break; - case GL_TEXTURE_EXTERNAL_OES: + case TextureType::External: if (!context->getExtensions().eglImageExternal && !context->getExtensions().eglStreamConsumerExternal) { @@ -3175,7 +3191,7 @@ bool ValidatePathCommandsCHROMIUM(Context *context, context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available."); return false; } - if (!context->hasPath(path)) + if (!context->isPathGenerated(path)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -3290,7 +3306,7 @@ bool ValidatePathParameterfCHROMIUM(Context *context, GLuint path, GLenum pname, context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available."); return false; } - if (!context->hasPath(path)) + if (!context->isPathGenerated(path)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -3362,7 +3378,7 @@ bool ValidateGetPathParameterfvCHROMIUM(Context *context, GLuint path, GLenum pn return false; } - if (!context->hasPath(path)) + if (!context->isPathGenerated(path)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -3436,7 +3452,7 @@ bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillM context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available."); return false; } - if (context->hasPath(path) && !context->hasPathData(path)) + if (context->isPathGenerated(path) && !context->isPath(path)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -3468,7 +3484,7 @@ bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint refe context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available."); return false; } - if (context->hasPath(path) && !context->hasPathData(path)) + if (context->isPathGenerated(path) && !context->isPath(path)) { context->handleError(InvalidOperation() << "No such path or path has no data."); return false; @@ -3477,6 +3493,16 @@ bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint refe return true; } +bool ValidateCoverFillPathCHROMIUM(Context *context, GLuint path, GLenum coverMode) +{ + return ValidateCoverPathCHROMIUM(context, path, coverMode); +} + +bool ValidateCoverStrokePathCHROMIUM(Context *context, GLuint path, GLenum coverMode) +{ + return ValidateCoverPathCHROMIUM(context, path, coverMode); +} + bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode) { if (!context->getExtensions().pathRendering) @@ -3484,7 +3510,7 @@ bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode) context->handleError(InvalidOperation() << "GL_CHROMIUM_path_rendering is not available."); return false; } - if (context->hasPath(path) && !context->hasPathData(path)) + if (context->isPathGenerated(path) && !context->isPath(path)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoSuchPath); return false; @@ -3522,7 +3548,7 @@ bool ValidateStencilThenCoverStrokePathCHROMIUM(Context *context, ValidateCoverPathCHROMIUM(context, path, coverMode); } -bool ValidateIsPathCHROMIUM(Context *context) +bool ValidateIsPathCHROMIUM(Context *context, GLuint path) { if (!context->getExtensions().pathRendering) { @@ -3854,7 +3880,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, bool ValidateCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint internalFormat, @@ -3877,16 +3903,17 @@ bool ValidateCopyTextureCHROMIUM(Context *context, return false; } - if (!IsValidCopyTextureSourceTarget(context, source->getTarget())) + if (!IsValidCopyTextureSourceTarget(context, source->getType())) { context->handleError(InvalidValue() << "Source texture a valid texture type."); return false; } - GLenum sourceTarget = source->getTarget(); - ASSERT(sourceTarget != GL_TEXTURE_CUBE_MAP); + TextureType sourceType = source->getType(); + ASSERT(sourceType != TextureType::CubeMap); + TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType); - if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel)) + if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel)) { context->handleError(InvalidValue() << "Source texture level is not valid."); return false; @@ -3921,14 +3948,14 @@ bool ValidateCopyTextureCHROMIUM(Context *context, return false; } - if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget)) + if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) { context->handleError(InvalidValue() << "Destination texture a valid texture type."); return false; } - if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, sourceWidth, - sourceHeight)) + if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, sourceWidth, + sourceHeight, false)) { ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); return false; @@ -3940,7 +3967,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context, return false; } - if (IsCubeMapTextureTarget(destTarget) && sourceWidth != sourceHeight) + if (dest->getType() == TextureType::CubeMap && sourceWidth != sourceHeight) { context->handleError( InvalidValue() << "Destination width and height must be equal for cube map textures."); @@ -3959,7 +3986,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context, bool ValidateCopySubTextureCHROMIUM(Context *context, GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint xoffset, @@ -3986,16 +4013,17 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, return false; } - if (!IsValidCopyTextureSourceTarget(context, source->getTarget())) + if (!IsValidCopyTextureSourceTarget(context, source->getType())) { context->handleError(InvalidValue() << "Source texture a valid texture type."); return false; } - GLenum sourceTarget = source->getTarget(); - ASSERT(sourceTarget != GL_TEXTURE_CUBE_MAP); + TextureType sourceType = source->getType(); + ASSERT(sourceType != TextureType::CubeMap); + TextureTarget sourceTarget = NonCubeTextureTypeToTarget(sourceType); - if (!IsValidCopyTextureSourceLevel(context, source->getTarget(), sourceLevel)) + if (!IsValidCopyTextureSourceLevel(context, sourceType, sourceLevel)) { ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); return false; @@ -4049,13 +4077,14 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, return false; } - if (!IsValidCopyTextureDestinationTarget(context, dest->getTarget(), destTarget)) + if (!IsValidCopyTextureDestinationTarget(context, dest->getType(), destTarget)) { context->handleError(InvalidValue() << "Destination texture a valid texture type."); return false; } - if (!IsValidCopyTextureDestinationLevel(context, destTarget, destLevel, width, height)) + if (!IsValidCopyTextureDestinationLevel(context, dest->getType(), destLevel, width, height, + true)) { context->handleError(InvalidValue() << "Destination texture level is not valid."); return false; @@ -4109,19 +4138,20 @@ bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GL return false; } - if (source->getTarget() != GL_TEXTURE_2D) + if (source->getType() != TextureType::_2D) { context->handleError(InvalidValue() << "Source texture must be of type GL_TEXTURE_2D."); return false; } - if (source->getWidth(GL_TEXTURE_2D, 0) == 0 || source->getHeight(GL_TEXTURE_2D, 0) == 0) + if (source->getWidth(TextureTarget::_2D, 0) == 0 || + source->getHeight(TextureTarget::_2D, 0) == 0) { context->handleError(InvalidValue() << "Source texture must level 0 defined."); return false; } - const gl::Format &sourceFormat = source->getFormat(GL_TEXTURE_2D, 0); + const gl::Format &sourceFormat = source->getFormat(TextureTarget::_2D, 0); if (!sourceFormat.info->compressed) { context->handleError(InvalidOperation() @@ -4137,7 +4167,7 @@ bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GL return false; } - if (dest->getTarget() != GL_TEXTURE_2D) + if (dest->getType() != TextureType::_2D) { context->handleError(InvalidValue() << "Destination texture must be of type GL_TEXTURE_2D."); @@ -4153,15 +4183,15 @@ bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GL return true; } -bool ValidateCreateShader(Context *context, GLenum type) +bool ValidateCreateShader(Context *context, ShaderType type) { switch (type) { - case GL_VERTEX_SHADER: - case GL_FRAGMENT_SHADER: + case ShaderType::Vertex: + case ShaderType::Fragment: break; - case GL_COMPUTE_SHADER: + case ShaderType::Compute: if (context->getClientVersion() < Version(3, 1)) { ANGLE_VALIDATION_ERR(context, InvalidEnum(), ES31Required); @@ -4169,7 +4199,7 @@ bool ValidateCreateShader(Context *context, GLenum type) } break; - case GL_GEOMETRY_SHADER_EXT: + case ShaderType::Geometry: if (!context->getExtensions().geometryShader) { ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidShaderType); @@ -4184,7 +4214,7 @@ bool ValidateCreateShader(Context *context, GLenum type) return true; } -bool ValidateBufferData(ValidationContext *context, +bool ValidateBufferData(Context *context, BufferBinding target, GLsizeiptr size, const void *data, @@ -4235,10 +4265,17 @@ bool ValidateBufferData(ValidationContext *context, return false; } + if (context->getExtensions().webglCompatibility && + buffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback); + return false; + } + return true; } -bool ValidateBufferSubData(ValidationContext *context, +bool ValidateBufferSubData(Context *context, BufferBinding target, GLintptr offset, GLsizeiptr size, @@ -4276,6 +4313,13 @@ bool ValidateBufferSubData(ValidationContext *context, return false; } + if (context->getExtensions().webglCompatibility && + buffer->isBoundForTransformFeedbackAndOtherUse()) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback); + return false; + } + // Check for possible overflow of size + offset angle::CheckedNumeric checkedSize(size); checkedSize += offset; @@ -4311,19 +4355,24 @@ bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name) return true; } -bool ValidateActiveTexture(ValidationContext *context, GLenum texture) +bool ValidateActiveTexture(Context *context, GLenum texture) { + if (context->getClientMajorVersion() < 2) + { + return ValidateMultitextureUnit(context, texture); + } + if (texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + context->getCaps().maxCombinedTextureImageUnits - 1) { - context->handleError(InvalidEnum()); + ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidCombinedImageUnit); return false; } return true; } -bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader) +bool ValidateAttachShader(Context *context, GLuint program, GLuint shader) { Program *programObject = GetValidProgram(context, program); if (!programObject) @@ -4337,56 +4386,16 @@ bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint sha return false; } - switch (shaderObject->getType()) + if (programObject->getAttachedShader(shaderObject->getType())) { - case GL_VERTEX_SHADER: - { - if (programObject->getAttachedVertexShader()) - { - ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader); - return false; - } - break; - } - case GL_FRAGMENT_SHADER: - { - if (programObject->getAttachedFragmentShader()) - { - ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader); - return false; - } - break; - } - case GL_COMPUTE_SHADER: - { - if (programObject->getAttachedComputeShader()) - { - ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader); - return false; - } - break; - } - case GL_GEOMETRY_SHADER_EXT: - { - if (programObject->getAttachedGeometryShader()) - { - ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader); - return false; - } - break; - } - default: - UNREACHABLE(); - break; + ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderAttachmentHasShader); + return false; } return true; } -bool ValidateBindAttribLocation(ValidationContext *context, - GLuint program, - GLuint index, - const GLchar *name) +bool ValidateBindAttribLocation(Context *context, GLuint program, GLuint index, const GLchar *name) { if (index >= MAX_VERTEX_ATTRIBS) { @@ -4421,7 +4430,7 @@ bool ValidateBindAttribLocation(ValidationContext *context, return GetValidProgram(context, program) != nullptr; } -bool ValidateBindBuffer(ValidationContext *context, BufferBinding target, GLuint buffer) +bool ValidateBindBuffer(Context *context, BufferBinding target, GLuint buffer) { if (!context->isValidBufferBinding(target)) { @@ -4439,7 +4448,7 @@ bool ValidateBindBuffer(ValidationContext *context, BufferBinding target, GLuint return true; } -bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer) +bool ValidateBindFramebuffer(Context *context, GLenum target, GLuint framebuffer) { if (!ValidFramebufferTarget(context, target)) { @@ -4457,7 +4466,7 @@ bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint f return true; } -bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer) +bool ValidateBindRenderbuffer(Context *context, GLenum target, GLuint renderbuffer) { if (target != GL_RENDERBUFFER) { @@ -4475,7 +4484,7 @@ bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint return true; } -static bool ValidBlendEquationMode(const ValidationContext *context, GLenum mode) +static bool ValidBlendEquationMode(const Context *context, GLenum mode) { switch (mode) { @@ -4493,16 +4502,12 @@ static bool ValidBlendEquationMode(const ValidationContext *context, GLenum mode } } -bool ValidateBlendColor(ValidationContext *context, - GLfloat red, - GLfloat green, - GLfloat blue, - GLfloat alpha) +bool ValidateBlendColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { return true; } -bool ValidateBlendEquation(ValidationContext *context, GLenum mode) +bool ValidateBlendEquation(Context *context, GLenum mode) { if (!ValidBlendEquationMode(context, mode)) { @@ -4513,7 +4518,7 @@ bool ValidateBlendEquation(ValidationContext *context, GLenum mode) return true; } -bool ValidateBlendEquationSeparate(ValidationContext *context, GLenum modeRGB, GLenum modeAlpha) +bool ValidateBlendEquationSeparate(Context *context, GLenum modeRGB, GLenum modeAlpha) { if (!ValidBlendEquationMode(context, modeRGB)) { @@ -4530,7 +4535,7 @@ bool ValidateBlendEquationSeparate(ValidationContext *context, GLenum modeRGB, G return true; } -bool ValidateBlendFunc(ValidationContext *context, GLenum sfactor, GLenum dfactor) +bool ValidateBlendFunc(Context *context, GLenum sfactor, GLenum dfactor) { return ValidateBlendFuncSeparate(context, sfactor, dfactor, sfactor, dfactor); } @@ -4589,7 +4594,7 @@ static bool ValidDstBlendFunc(GLenum dstBlend, GLint contextMajorVersion) } } -bool ValidateBlendFuncSeparate(ValidationContext *context, +bool ValidateBlendFuncSeparate(Context *context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, @@ -4680,7 +4685,7 @@ bool ValidateGetString(Context *context, GLenum name) return true; } -bool ValidateLineWidth(ValidationContext *context, GLfloat width) +bool ValidateLineWidth(Context *context, GLfloat width) { if (width <= 0.0f || isNaN(width)) { @@ -4691,7 +4696,7 @@ bool ValidateLineWidth(ValidationContext *context, GLfloat width) return true; } -bool ValidateVertexAttribPointer(ValidationContext *context, +bool ValidateVertexAttribPointer(Context *context, GLuint index, GLint size, GLenum type, @@ -4762,7 +4767,7 @@ bool ValidateVertexAttribPointer(ValidationContext *context, return true; } -bool ValidateDepthRangef(ValidationContext *context, GLfloat zNear, GLfloat zFar) +bool ValidateDepthRangef(Context *context, GLfloat zNear, GLfloat zFar) { if (context->getExtensions().webglCompatibility && zNear > zFar) { @@ -4773,7 +4778,7 @@ bool ValidateDepthRangef(ValidationContext *context, GLfloat zNear, GLfloat zFar return true; } -bool ValidateRenderbufferStorage(ValidationContext *context, +bool ValidateRenderbufferStorage(Context *context, GLenum target, GLenum internalformat, GLsizei width, @@ -4783,7 +4788,7 @@ bool ValidateRenderbufferStorage(ValidationContext *context, height); } -bool ValidateRenderbufferStorageMultisampleANGLE(ValidationContext *context, +bool ValidateRenderbufferStorageMultisampleANGLE(Context *context, GLenum target, GLsizei samples, GLenum internalformat, @@ -4824,7 +4829,7 @@ bool ValidateRenderbufferStorageMultisampleANGLE(ValidationContext *context, width, height); } -bool ValidateCheckFramebufferStatus(ValidationContext *context, GLenum target) +bool ValidateCheckFramebufferStatus(Context *context, GLenum target) { if (!ValidFramebufferTarget(context, target)) { @@ -4835,26 +4840,22 @@ bool ValidateCheckFramebufferStatus(ValidationContext *context, GLenum target) return true; } -bool ValidateClearColor(ValidationContext *context, - GLfloat red, - GLfloat green, - GLfloat blue, - GLfloat alpha) +bool ValidateClearColor(Context *context, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { return true; } -bool ValidateClearDepthf(ValidationContext *context, GLfloat depth) +bool ValidateClearDepthf(Context *context, GLfloat depth) { return true; } -bool ValidateClearStencil(ValidationContext *context, GLint s) +bool ValidateClearStencil(Context *context, GLint s) { return true; } -bool ValidateColorMask(ValidationContext *context, +bool ValidateColorMask(Context *context, GLboolean red, GLboolean green, GLboolean blue, @@ -4863,17 +4864,17 @@ bool ValidateColorMask(ValidationContext *context, return true; } -bool ValidateCompileShader(ValidationContext *context, GLuint shader) +bool ValidateCompileShader(Context *context, GLuint shader) { return true; } -bool ValidateCreateProgram(ValidationContext *context) +bool ValidateCreateProgram(Context *context) { return true; } -bool ValidateCullFace(ValidationContext *context, CullFaceMode mode) +bool ValidateCullFace(Context *context, CullFaceMode mode) { switch (mode) { @@ -4890,7 +4891,7 @@ bool ValidateCullFace(ValidationContext *context, CullFaceMode mode) return true; } -bool ValidateDeleteProgram(ValidationContext *context, GLuint program) +bool ValidateDeleteProgram(Context *context, GLuint program) { if (program == 0) { @@ -4914,7 +4915,7 @@ bool ValidateDeleteProgram(ValidationContext *context, GLuint program) return true; } -bool ValidateDeleteShader(ValidationContext *context, GLuint shader) +bool ValidateDeleteShader(Context *context, GLuint shader) { if (shader == 0) { @@ -4938,7 +4939,7 @@ bool ValidateDeleteShader(ValidationContext *context, GLuint shader) return true; } -bool ValidateDepthFunc(ValidationContext *context, GLenum func) +bool ValidateDepthFunc(Context *context, GLenum func) { switch (func) { @@ -4960,12 +4961,12 @@ bool ValidateDepthFunc(ValidationContext *context, GLenum func) return true; } -bool ValidateDepthMask(ValidationContext *context, GLboolean flag) +bool ValidateDepthMask(Context *context, GLboolean flag) { return true; } -bool ValidateDetachShader(ValidationContext *context, GLuint program, GLuint shader) +bool ValidateDetachShader(Context *context, GLuint program, GLuint shader) { Program *programObject = GetValidProgram(context, program); if (!programObject) @@ -4979,35 +4980,7 @@ bool ValidateDetachShader(ValidationContext *context, GLuint program, GLuint sha return false; } - const Shader *attachedShader = nullptr; - - switch (shaderObject->getType()) - { - case GL_VERTEX_SHADER: - { - attachedShader = programObject->getAttachedVertexShader(); - break; - } - case GL_FRAGMENT_SHADER: - { - attachedShader = programObject->getAttachedFragmentShader(); - break; - } - case GL_COMPUTE_SHADER: - { - attachedShader = programObject->getAttachedComputeShader(); - break; - } - case GL_GEOMETRY_SHADER_EXT: - { - attachedShader = programObject->getAttachedGeometryShader(); - break; - } - default: - UNREACHABLE(); - return false; - } - + const Shader *attachedShader = programObject->getAttachedShader(shaderObject->getType()); if (attachedShader != shaderObject) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), ShaderToDetachMustBeAttached); @@ -5017,7 +4990,7 @@ bool ValidateDetachShader(ValidationContext *context, GLuint program, GLuint sha return true; } -bool ValidateDisableVertexAttribArray(ValidationContext *context, GLuint index) +bool ValidateDisableVertexAttribArray(Context *context, GLuint index) { if (index >= MAX_VERTEX_ATTRIBS) { @@ -5028,7 +5001,7 @@ bool ValidateDisableVertexAttribArray(ValidationContext *context, GLuint index) return true; } -bool ValidateEnableVertexAttribArray(ValidationContext *context, GLuint index) +bool ValidateEnableVertexAttribArray(Context *context, GLuint index) { if (index >= MAX_VERTEX_ATTRIBS) { @@ -5039,17 +5012,17 @@ bool ValidateEnableVertexAttribArray(ValidationContext *context, GLuint index) return true; } -bool ValidateFinish(ValidationContext *context) +bool ValidateFinish(Context *context) { return true; } -bool ValidateFlush(ValidationContext *context) +bool ValidateFlush(Context *context) { return true; } -bool ValidateFrontFace(ValidationContext *context, GLenum mode) +bool ValidateFrontFace(Context *context, GLenum mode) { switch (mode) { @@ -5064,7 +5037,7 @@ bool ValidateFrontFace(ValidationContext *context, GLenum mode) return true; } -bool ValidateGetActiveAttrib(ValidationContext *context, +bool ValidateGetActiveAttrib(Context *context, GLuint program, GLuint index, GLsizei bufsize, @@ -5095,7 +5068,7 @@ bool ValidateGetActiveAttrib(ValidationContext *context, return true; } -bool ValidateGetActiveUniform(ValidationContext *context, +bool ValidateGetActiveUniform(Context *context, GLuint program, GLuint index, GLsizei bufsize, @@ -5126,7 +5099,7 @@ bool ValidateGetActiveUniform(ValidationContext *context, return true; } -bool ValidateGetAttachedShaders(ValidationContext *context, +bool ValidateGetAttachedShaders(Context *context, GLuint program, GLsizei maxcount, GLsizei *count, @@ -5148,7 +5121,7 @@ bool ValidateGetAttachedShaders(ValidationContext *context, return true; } -bool ValidateGetAttribLocation(ValidationContext *context, GLuint program, const GLchar *name) +bool ValidateGetAttribLocation(Context *context, GLuint program, const GLchar *name) { // The WebGL spec (section 6.20) disallows strings containing invalid ESSL characters for // shader-related entry points @@ -5175,33 +5148,33 @@ bool ValidateGetAttribLocation(ValidationContext *context, GLuint program, const return true; } -bool ValidateGetBooleanv(ValidationContext *context, GLenum pname, GLboolean *params) +bool ValidateGetBooleanv(Context *context, GLenum pname, GLboolean *params) { GLenum nativeType; unsigned int numParams = 0; return ValidateStateQuery(context, pname, &nativeType, &numParams); } -bool ValidateGetError(ValidationContext *context) +bool ValidateGetError(Context *context) { return true; } -bool ValidateGetFloatv(ValidationContext *context, GLenum pname, GLfloat *params) +bool ValidateGetFloatv(Context *context, GLenum pname, GLfloat *params) { GLenum nativeType; unsigned int numParams = 0; return ValidateStateQuery(context, pname, &nativeType, &numParams); } -bool ValidateGetIntegerv(ValidationContext *context, GLenum pname, GLint *params) +bool ValidateGetIntegerv(Context *context, GLenum pname, GLint *params) { GLenum nativeType; unsigned int numParams = 0; return ValidateStateQuery(context, pname, &nativeType, &numParams); } -bool ValidateGetProgramInfoLog(ValidationContext *context, +bool ValidateGetProgramInfoLog(Context *context, GLuint program, GLsizei bufsize, GLsizei *length, @@ -5222,7 +5195,7 @@ bool ValidateGetProgramInfoLog(ValidationContext *context, return true; } -bool ValidateGetShaderInfoLog(ValidationContext *context, +bool ValidateGetShaderInfoLog(Context *context, GLuint shader, GLsizei bufsize, GLsizei *length, @@ -5243,7 +5216,7 @@ bool ValidateGetShaderInfoLog(ValidationContext *context, return true; } -bool ValidateGetShaderPrecisionFormat(ValidationContext *context, +bool ValidateGetShaderPrecisionFormat(Context *context, GLenum shadertype, GLenum precisiontype, GLint *range, @@ -5281,7 +5254,7 @@ bool ValidateGetShaderPrecisionFormat(ValidationContext *context, return true; } -bool ValidateGetShaderSource(ValidationContext *context, +bool ValidateGetShaderSource(Context *context, GLuint shader, GLsizei bufsize, GLsizei *length, @@ -5302,7 +5275,7 @@ bool ValidateGetShaderSource(ValidationContext *context, return true; } -bool ValidateGetUniformLocation(ValidationContext *context, GLuint program, const GLchar *name) +bool ValidateGetUniformLocation(Context *context, GLuint program, const GLchar *name) { if (strstr(name, "gl_") == name) { @@ -5333,7 +5306,7 @@ bool ValidateGetUniformLocation(ValidationContext *context, GLuint program, cons return true; } -bool ValidateHint(ValidationContext *context, GLenum target, GLenum mode) +bool ValidateHint(Context *context, GLenum target, GLenum mode) { switch (mode) { @@ -5369,37 +5342,37 @@ bool ValidateHint(ValidationContext *context, GLenum target, GLenum mode) return true; } -bool ValidateIsBuffer(ValidationContext *context, GLuint buffer) +bool ValidateIsBuffer(Context *context, GLuint buffer) { return true; } -bool ValidateIsFramebuffer(ValidationContext *context, GLuint framebuffer) +bool ValidateIsFramebuffer(Context *context, GLuint framebuffer) { return true; } -bool ValidateIsProgram(ValidationContext *context, GLuint program) +bool ValidateIsProgram(Context *context, GLuint program) { return true; } -bool ValidateIsRenderbuffer(ValidationContext *context, GLuint renderbuffer) +bool ValidateIsRenderbuffer(Context *context, GLuint renderbuffer) { return true; } -bool ValidateIsShader(ValidationContext *context, GLuint shader) +bool ValidateIsShader(Context *context, GLuint shader) { return true; } -bool ValidateIsTexture(ValidationContext *context, GLuint texture) +bool ValidateIsTexture(Context *context, GLuint texture) { return true; } -bool ValidatePixelStorei(ValidationContext *context, GLenum pname, GLint param) +bool ValidatePixelStorei(Context *context, GLenum pname, GLint param) { if (context->getClientMajorVersion() < 3) { @@ -5481,22 +5454,22 @@ bool ValidatePixelStorei(ValidationContext *context, GLenum pname, GLint param) return true; } -bool ValidatePolygonOffset(ValidationContext *context, GLfloat factor, GLfloat units) +bool ValidatePolygonOffset(Context *context, GLfloat factor, GLfloat units) { return true; } -bool ValidateReleaseShaderCompiler(ValidationContext *context) +bool ValidateReleaseShaderCompiler(Context *context) { return true; } -bool ValidateSampleCoverage(ValidationContext *context, GLfloat value, GLboolean invert) +bool ValidateSampleCoverage(Context *context, GLfloat value, GLboolean invert) { return true; } -bool ValidateScissor(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height) +bool ValidateScissor(Context *context, GLint x, GLint y, GLsizei width, GLsizei height) { if (width < 0 || height < 0) { @@ -5507,7 +5480,7 @@ bool ValidateScissor(ValidationContext *context, GLint x, GLint y, GLsizei width return true; } -bool ValidateShaderBinary(ValidationContext *context, +bool ValidateShaderBinary(Context *context, GLsizei n, const GLuint *shaders, GLenum binaryformat, @@ -5525,7 +5498,7 @@ bool ValidateShaderBinary(ValidationContext *context, return true; } -bool ValidateShaderSource(ValidationContext *context, +bool ValidateShaderSource(Context *context, GLuint shader, GLsizei count, const GLchar *const *string, @@ -5565,7 +5538,7 @@ bool ValidateShaderSource(ValidationContext *context, return true; } -bool ValidateStencilFunc(ValidationContext *context, GLenum func, GLint ref, GLuint mask) +bool ValidateStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask) { if (!IsValidStencilFunc(func)) { @@ -5576,11 +5549,7 @@ bool ValidateStencilFunc(ValidationContext *context, GLenum func, GLint ref, GLu return true; } -bool ValidateStencilFuncSeparate(ValidationContext *context, - GLenum face, - GLenum func, - GLint ref, - GLuint mask) +bool ValidateStencilFuncSeparate(Context *context, GLenum face, GLenum func, GLint ref, GLuint mask) { if (!IsValidStencilFace(face)) { @@ -5597,12 +5566,12 @@ bool ValidateStencilFuncSeparate(ValidationContext *context, return true; } -bool ValidateStencilMask(ValidationContext *context, GLuint mask) +bool ValidateStencilMask(Context *context, GLuint mask) { return true; } -bool ValidateStencilMaskSeparate(ValidationContext *context, GLenum face, GLuint mask) +bool ValidateStencilMaskSeparate(Context *context, GLenum face, GLuint mask) { if (!IsValidStencilFace(face)) { @@ -5613,7 +5582,7 @@ bool ValidateStencilMaskSeparate(ValidationContext *context, GLenum face, GLuint return true; } -bool ValidateStencilOp(ValidationContext *context, GLenum fail, GLenum zfail, GLenum zpass) +bool ValidateStencilOp(Context *context, GLenum fail, GLenum zfail, GLenum zpass) { if (!IsValidStencilOp(fail)) { @@ -5636,7 +5605,7 @@ bool ValidateStencilOp(ValidationContext *context, GLenum fail, GLenum zfail, GL return true; } -bool ValidateStencilOpSeparate(ValidationContext *context, +bool ValidateStencilOpSeparate(Context *context, GLenum face, GLenum fail, GLenum zfail, @@ -5651,92 +5620,82 @@ bool ValidateStencilOpSeparate(ValidationContext *context, return ValidateStencilOp(context, fail, zfail, zpass); } -bool ValidateUniform1f(ValidationContext *context, GLint location, GLfloat x) +bool ValidateUniform1f(Context *context, GLint location, GLfloat x) { return ValidateUniform(context, GL_FLOAT, location, 1); } -bool ValidateUniform1fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v) +bool ValidateUniform1fv(Context *context, GLint location, GLsizei count, const GLfloat *v) { return ValidateUniform(context, GL_FLOAT, location, count); } -bool ValidateUniform1i(ValidationContext *context, GLint location, GLint x) +bool ValidateUniform1i(Context *context, GLint location, GLint x) { return ValidateUniform1iv(context, location, 1, &x); } -bool ValidateUniform2f(ValidationContext *context, GLint location, GLfloat x, GLfloat y) +bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y) { return ValidateUniform(context, GL_FLOAT_VEC2, location, 1); } -bool ValidateUniform2fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v) +bool ValidateUniform2fv(Context *context, GLint location, GLsizei count, const GLfloat *v) { return ValidateUniform(context, GL_FLOAT_VEC2, location, count); } -bool ValidateUniform2i(ValidationContext *context, GLint location, GLint x, GLint y) +bool ValidateUniform2i(Context *context, GLint location, GLint x, GLint y) { return ValidateUniform(context, GL_INT_VEC2, location, 1); } -bool ValidateUniform2iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v) +bool ValidateUniform2iv(Context *context, GLint location, GLsizei count, const GLint *v) { return ValidateUniform(context, GL_INT_VEC2, location, count); } -bool ValidateUniform3f(ValidationContext *context, GLint location, GLfloat x, GLfloat y, GLfloat z) +bool ValidateUniform3f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z) { return ValidateUniform(context, GL_FLOAT_VEC3, location, 1); } -bool ValidateUniform3fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v) +bool ValidateUniform3fv(Context *context, GLint location, GLsizei count, const GLfloat *v) { return ValidateUniform(context, GL_FLOAT_VEC3, location, count); } -bool ValidateUniform3i(ValidationContext *context, GLint location, GLint x, GLint y, GLint z) +bool ValidateUniform3i(Context *context, GLint location, GLint x, GLint y, GLint z) { return ValidateUniform(context, GL_INT_VEC3, location, 1); } -bool ValidateUniform3iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v) +bool ValidateUniform3iv(Context *context, GLint location, GLsizei count, const GLint *v) { return ValidateUniform(context, GL_INT_VEC3, location, count); } -bool ValidateUniform4f(ValidationContext *context, - GLint location, - GLfloat x, - GLfloat y, - GLfloat z, - GLfloat w) +bool ValidateUniform4f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { return ValidateUniform(context, GL_FLOAT_VEC4, location, 1); } -bool ValidateUniform4fv(ValidationContext *context, GLint location, GLsizei count, const GLfloat *v) +bool ValidateUniform4fv(Context *context, GLint location, GLsizei count, const GLfloat *v) { return ValidateUniform(context, GL_FLOAT_VEC4, location, count); } -bool ValidateUniform4i(ValidationContext *context, - GLint location, - GLint x, - GLint y, - GLint z, - GLint w) +bool ValidateUniform4i(Context *context, GLint location, GLint x, GLint y, GLint z, GLint w) { return ValidateUniform(context, GL_INT_VEC4, location, 1); } -bool ValidateUniform4iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v) +bool ValidateUniform4iv(Context *context, GLint location, GLsizei count, const GLint *v) { return ValidateUniform(context, GL_INT_VEC4, location, count); } -bool ValidateUniformMatrix2fv(ValidationContext *context, +bool ValidateUniformMatrix2fv(Context *context, GLint location, GLsizei count, GLboolean transpose, @@ -5745,7 +5704,7 @@ bool ValidateUniformMatrix2fv(ValidationContext *context, return ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose); } -bool ValidateUniformMatrix3fv(ValidationContext *context, +bool ValidateUniformMatrix3fv(Context *context, GLint location, GLsizei count, GLboolean transpose, @@ -5754,7 +5713,7 @@ bool ValidateUniformMatrix3fv(ValidationContext *context, return ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose); } -bool ValidateUniformMatrix4fv(ValidationContext *context, +bool ValidateUniformMatrix4fv(Context *context, GLint location, GLsizei count, GLboolean transpose, @@ -5763,7 +5722,7 @@ bool ValidateUniformMatrix4fv(ValidationContext *context, return ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose); } -bool ValidateValidateProgram(ValidationContext *context, GLuint program) +bool ValidateValidateProgram(Context *context, GLuint program) { Program *programObject = GetValidProgram(context, program); @@ -5775,41 +5734,37 @@ bool ValidateValidateProgram(ValidationContext *context, GLuint program) return true; } -bool ValidateVertexAttrib1f(ValidationContext *context, GLuint index, GLfloat x) +bool ValidateVertexAttrib1f(Context *context, GLuint index, GLfloat x) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib1fv(ValidationContext *context, GLuint index, const GLfloat *values) +bool ValidateVertexAttrib1fv(Context *context, GLuint index, const GLfloat *values) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib2f(ValidationContext *context, GLuint index, GLfloat x, GLfloat y) +bool ValidateVertexAttrib2f(Context *context, GLuint index, GLfloat x, GLfloat y) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib2fv(ValidationContext *context, GLuint index, const GLfloat *values) +bool ValidateVertexAttrib2fv(Context *context, GLuint index, const GLfloat *values) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib3f(ValidationContext *context, - GLuint index, - GLfloat x, - GLfloat y, - GLfloat z) +bool ValidateVertexAttrib3f(Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib3fv(ValidationContext *context, GLuint index, const GLfloat *values) +bool ValidateVertexAttrib3fv(Context *context, GLuint index, const GLfloat *values) { return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib4f(ValidationContext *context, +bool ValidateVertexAttrib4f(Context *context, GLuint index, GLfloat x, GLfloat y, @@ -5819,12 +5774,12 @@ bool ValidateVertexAttrib4f(ValidationContext *context, return ValidateVertexAttribIndex(context, index); } -bool ValidateVertexAttrib4fv(ValidationContext *context, GLuint index, const GLfloat *values) +bool ValidateVertexAttrib4fv(Context *context, GLuint index, const GLfloat *values) { return ValidateVertexAttribIndex(context, index); } -bool ValidateViewport(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height) +bool ValidateViewport(Context *context, GLint x, GLint y, GLsizei width, GLsizei height) { if (width < 0 || height < 0) { @@ -5835,12 +5790,12 @@ bool ValidateViewport(ValidationContext *context, GLint x, GLint y, GLsizei widt return true; } -bool ValidateDrawArrays(ValidationContext *context, GLenum mode, GLint first, GLsizei count) +bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count) { return ValidateDrawArraysCommon(context, mode, first, count, 1); } -bool ValidateDrawElements(ValidationContext *context, +bool ValidateDrawElements(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -5859,13 +5814,13 @@ bool ValidateGetFramebufferAttachmentParameteriv(Context *context, nullptr); } -bool ValidateGetProgramiv(ValidationContext *context, GLuint program, GLenum pname, GLint *params) +bool ValidateGetProgramiv(Context *context, GLuint program, GLenum pname, GLint *params) { return ValidateGetProgramivBase(context, program, pname, nullptr); } -bool ValidateCopyTexImage2D(ValidationContext *context, - GLenum target, +bool ValidateCopyTexImage2D(Context *context, + TextureTarget target, GLint level, GLenum internalformat, GLint x, @@ -5886,7 +5841,7 @@ bool ValidateCopyTexImage2D(ValidationContext *context, } bool ValidateCopyTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -5984,7 +5939,7 @@ bool ValidateFramebufferRenderbuffer(Context *context, bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment, - GLenum textarget, + TextureTarget textarget, GLuint texture, GLint level) { @@ -6011,14 +5966,14 @@ bool ValidateFramebufferTexture2D(Context *context, switch (textarget) { - case GL_TEXTURE_2D: + case TextureTarget::_2D: { if (level > gl::log2(caps.max2DTextureSize)) { context->handleError(InvalidValue()); return false; } - if (tex->getTarget() != GL_TEXTURE_2D) + if (tex->getType() != TextureType::_2D) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), InvalidTextureTarget); return false; @@ -6026,14 +5981,14 @@ bool ValidateFramebufferTexture2D(Context *context, } break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureTarget::Rectangle: { if (level != 0) { context->handleError(InvalidValue()); return false; } - if (tex->getTarget() != GL_TEXTURE_RECTANGLE_ANGLE) + if (tex->getType() != TextureType::Rectangle) { context->handleError(InvalidOperation() << "Textarget must match the texture target type."); @@ -6042,19 +5997,19 @@ bool ValidateFramebufferTexture2D(Context *context, } break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureTarget::CubeMapNegativeX: + case TextureTarget::CubeMapNegativeY: + case TextureTarget::CubeMapNegativeZ: + case TextureTarget::CubeMapPositiveX: + case TextureTarget::CubeMapPositiveY: + case TextureTarget::CubeMapPositiveZ: { if (level > gl::log2(caps.maxCubeMapTextureSize)) { context->handleError(InvalidValue()); return false; } - if (tex->getTarget() != GL_TEXTURE_CUBE_MAP) + if (tex->getType() != TextureType::CubeMap) { context->handleError(InvalidOperation() << "Textarget must match the texture target type."); @@ -6063,7 +6018,7 @@ bool ValidateFramebufferTexture2D(Context *context, } break; - case GL_TEXTURE_2D_MULTISAMPLE: + case TextureTarget::_2DMultisample: { if (context->getClientVersion() < ES_3_1) { @@ -6076,7 +6031,7 @@ bool ValidateFramebufferTexture2D(Context *context, ANGLE_VALIDATION_ERR(context, InvalidValue(), LevelNotZero); return false; } - if (tex->getTarget() != GL_TEXTURE_2D_MULTISAMPLE) + if (tex->getType() != TextureType::_2DMultisample) { context->handleError(InvalidOperation() << "Textarget must match the texture target type."); @@ -6121,7 +6076,7 @@ bool ValidateGenTextures(Context *context, GLint n, GLuint *) return ValidateGenOrDelete(context, n); } -bool ValidateGenerateMipmap(Context *context, GLenum target) +bool ValidateGenerateMipmap(Context *context, TextureType target) { if (!ValidTextureTarget(context, target)) { @@ -6147,7 +6102,9 @@ bool ValidateGenerateMipmap(Context *context, GLenum target) return false; } - GLenum baseTarget = (target == GL_TEXTURE_CUBE_MAP) ? GL_TEXTURE_CUBE_MAP_POSITIVE_X : target; + TextureTarget baseTarget = (target == TextureType::CubeMap) + ? TextureTarget::CubeMapPositiveX + : NonCubeTextureTypeToTarget(target); const auto &format = *(texture->getFormat(baseTarget, effectiveBaseLevel).info); if (format.sizedInternalFormat == GL_NONE || format.compressed || format.depthBits > 0 || format.stencilBits > 0) @@ -6190,14 +6147,14 @@ bool ValidateGenerateMipmap(Context *context, GLenum target) (!isPow2(static_cast(texture->getWidth(baseTarget, 0))) || !isPow2(static_cast(texture->getHeight(baseTarget, 0))))) { - ASSERT(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ANGLE || - target == GL_TEXTURE_CUBE_MAP); + ASSERT(target == TextureType::_2D || target == TextureType::Rectangle || + target == TextureType::CubeMap); ANGLE_VALIDATION_ERR(context, InvalidOperation(), TextureNotPow2); return false; } // Cube completeness check - if (target == GL_TEXTURE_CUBE_MAP && !texture->getTextureState().isCubeComplete()) + if (target == TextureType::CubeMap && !texture->getTextureState().isCubeComplete()) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), CubemapIncomplete); return false; @@ -6206,7 +6163,7 @@ bool ValidateGenerateMipmap(Context *context, GLenum target) return true; } -bool ValidateGetBufferParameteriv(ValidationContext *context, +bool ValidateGetBufferParameteriv(Context *context, BufferBinding target, GLenum pname, GLint *params) @@ -6227,12 +6184,12 @@ bool ValidateGetShaderiv(Context *context, GLuint shader, GLenum pname, GLint *p return ValidateGetShaderivBase(context, shader, pname, nullptr); } -bool ValidateGetTexParameterfv(Context *context, GLenum target, GLenum pname, GLfloat *params) +bool ValidateGetTexParameterfv(Context *context, TextureType target, GLenum pname, GLfloat *params) { return ValidateGetTexParameterBase(context, target, pname, nullptr); } -bool ValidateGetTexParameteriv(Context *context, GLenum target, GLenum pname, GLint *params) +bool ValidateGetTexParameteriv(Context *context, TextureType target, GLenum pname, GLint *params) { return ValidateGetTexParameterBase(context, target, pname, nullptr); } @@ -6306,22 +6263,25 @@ bool ValidateReadPixels(Context *context, nullptr, pixels); } -bool ValidateTexParameterf(Context *context, GLenum target, GLenum pname, GLfloat param) +bool ValidateTexParameterf(Context *context, TextureType target, GLenum pname, GLfloat param) { return ValidateTexParameterBase(context, target, pname, -1, ¶m); } -bool ValidateTexParameterfv(Context *context, GLenum target, GLenum pname, const GLfloat *params) +bool ValidateTexParameterfv(Context *context, + TextureType target, + GLenum pname, + const GLfloat *params) { return ValidateTexParameterBase(context, target, pname, -1, params); } -bool ValidateTexParameteri(Context *context, GLenum target, GLenum pname, GLint param) +bool ValidateTexParameteri(Context *context, TextureType target, GLenum pname, GLint param) { return ValidateTexParameterBase(context, target, pname, -1, ¶m); } -bool ValidateTexParameteriv(Context *context, GLenum target, GLenum pname, const GLint *params) +bool ValidateTexParameteriv(Context *context, TextureType target, GLenum pname, const GLint *params) { return ValidateTexParameterBase(context, target, pname, -1, params); } @@ -6560,7 +6520,7 @@ bool ValidateTestFenceNV(Context *context, GLuint fence) } bool ValidateTexStorage2DEXT(Context *context, - GLenum target, + TextureType type, GLsizei levels, GLenum internalformat, GLsizei width, @@ -6574,12 +6534,12 @@ bool ValidateTexStorage2DEXT(Context *context, if (context->getClientMajorVersion() < 3) { - return ValidateES2TexStorageParameters(context, target, levels, internalformat, width, + return ValidateES2TexStorageParameters(context, type, levels, internalformat, width, height); } ASSERT(context->getClientMajorVersion() >= 3); - return ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, height, + return ValidateES3TexStorage2DParameters(context, type, levels, internalformat, width, height, 1); } @@ -6659,7 +6619,7 @@ bool ValidateTexStorage1DEXT(Context *context, } bool ValidateTexStorage3DEXT(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, diff --git a/gfx/angle/checkout/src/libANGLE/validationES2.h b/gfx/angle/checkout/src/libANGLE/validationES2.h index db534f7119ef..52bedfbc8ecd 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES2.h +++ b/gfx/angle/checkout/src/libANGLE/validationES2.h @@ -17,7 +17,6 @@ namespace gl { class Context; -class ValidationContext; bool ValidateES2TexStorageParameters(Context *context, GLenum target, @@ -31,7 +30,7 @@ bool ValidateDiscardFramebufferEXT(Context *context, GLsizei numAttachments, const GLenum *attachments); -bool ValidateDrawBuffersEXT(ValidationContext *context, GLsizei n, const GLenum *bufs); +bool ValidateDrawBuffersEXT(Context *context, GLsizei n, const GLenum *bufs); bool ValidateBindVertexArrayOES(Context *context, GLuint array); bool ValidateDeleteVertexArraysOES(Context *context, GLsizei n, const GLuint *arrays); @@ -104,6 +103,11 @@ bool ValidateGetObjectPtrLabelKHR(Context *context, GLsizei *length, GLchar *label); bool ValidateGetPointervKHR(Context *context, GLenum pname, void **params); +bool ValidateGetPointervRobustANGLERobustANGLE(Context *context, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params); bool ValidateBlitFramebufferANGLE(Context *context, GLint srcX0, GLint srcY0, @@ -116,9 +120,9 @@ bool ValidateBlitFramebufferANGLE(Context *context, GLbitfield mask, GLenum filter); -bool ValidateClear(ValidationContext *context, GLbitfield mask); +bool ValidateClear(Context *context, GLbitfield mask); bool ValidateTexImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -128,7 +132,7 @@ bool ValidateTexImage2D(Context *context, GLenum type, const void *pixels); bool ValidateTexImage2DRobust(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint internalformat, GLsizei width, @@ -139,7 +143,7 @@ bool ValidateTexImage2DRobust(Context *context, GLsizei bufSize, const void *pixels); bool ValidateTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -149,7 +153,7 @@ bool ValidateTexSubImage2D(Context *context, GLenum type, const void *pixels); bool ValidateTexSubImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -160,7 +164,7 @@ bool ValidateTexSubImage2DRobustANGLE(Context *context, GLsizei bufSize, const void *pixels); bool ValidateCompressedTexImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -169,7 +173,7 @@ bool ValidateCompressedTexImage2D(Context *context, GLsizei imageSize, const void *data); bool ValidateCompressedTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -179,7 +183,7 @@ bool ValidateCompressedTexSubImage2D(Context *context, GLsizei imageSize, const void *data); bool ValidateCompressedTexImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, GLsizei width, @@ -189,7 +193,7 @@ bool ValidateCompressedTexImage2DRobustANGLE(Context *context, GLsizei dataSize, const void *data); bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -200,7 +204,7 @@ bool ValidateCompressedTexSubImage2DRobustANGLE(Context *context, GLsizei dataSize, const void *data); -bool ValidateBindTexture(Context *context, GLenum target, GLuint texture); +bool ValidateBindTexture(Context *context, TextureType target, GLuint texture); bool ValidateGetBufferPointervOES(Context *context, BufferBinding target, @@ -248,6 +252,8 @@ bool ValidateGetPathParameterivCHROMIUM(Context *context, GLuint path, GLenum pn bool ValidatePathStencilFuncCHROMIUM(Context *context, GLenum func, GLint ref, GLuint mask); bool ValidateStencilFillPathCHROMIUM(Context *context, GLuint path, GLenum fillMode, GLuint mask); bool ValidateStencilStrokePathCHROMIUM(Context *context, GLuint path, GLint reference, GLuint mask); +bool ValidateCoverFillPathCHROMIUM(Context *context, GLuint path, GLenum coverMode); +bool ValidateCoverStrokePathCHROMIUM(Context *context, GLuint path, GLenum coverMode); bool ValidateCoverPathCHROMIUM(Context *context, GLuint path, GLenum coverMode); bool ValidateStencilThenCoverFillPathCHROMIUM(Context *context, GLuint path, @@ -259,7 +265,7 @@ bool ValidateStencilThenCoverStrokePathCHROMIUM(Context *context, GLint reference, GLuint mask, GLenum coverMode); -bool ValidateIsPathCHROMIUM(Context *context); +bool ValidateIsPathCHROMIUM(Context *context, GLuint path); bool ValidateCoverFillPathInstancedCHROMIUM(Context *context, GLsizei numPaths, GLenum pathNameType, @@ -328,7 +334,7 @@ bool ValidateProgramPathFragmentInputGenCHROMIUM(Context *context, bool ValidateCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint internalFormat, @@ -339,7 +345,7 @@ bool ValidateCopyTextureCHROMIUM(Context *context, bool ValidateCopySubTextureCHROMIUM(Context *context, GLuint sourceId, GLint sourceLevel, - GLenum destTarget, + TextureTarget destTarget, GLuint destId, GLint destLevel, GLint xoffset, @@ -353,13 +359,13 @@ bool ValidateCopySubTextureCHROMIUM(Context *context, GLboolean unpackUnmultiplyAlpha); bool ValidateCompressedCopyTextureCHROMIUM(Context *context, GLuint sourceId, GLuint destId); -bool ValidateCreateShader(Context *context, GLenum type); -bool ValidateBufferData(ValidationContext *context, +bool ValidateCreateShader(Context *context, ShaderType type); +bool ValidateBufferData(Context *context, BufferBinding target, GLsizeiptr size, const void *data, BufferUsage usage); -bool ValidateBufferSubData(ValidationContext *context, +bool ValidateBufferSubData(Context *context, BufferBinding target, GLintptr offset, GLsizeiptr size, @@ -367,32 +373,29 @@ bool ValidateBufferSubData(ValidationContext *context, bool ValidateRequestExtensionANGLE(Context *context, const GLchar *name); -bool ValidateActiveTexture(ValidationContext *context, GLenum texture); -bool ValidateAttachShader(ValidationContext *context, GLuint program, GLuint shader); -bool ValidateBindAttribLocation(ValidationContext *context, - GLuint program, - GLuint index, - const GLchar *name); -bool ValidateBindBuffer(ValidationContext *context, BufferBinding target, GLuint buffer); -bool ValidateBindFramebuffer(ValidationContext *context, GLenum target, GLuint framebuffer); -bool ValidateBindRenderbuffer(ValidationContext *context, GLenum target, GLuint renderbuffer); -bool ValidateBlendColor(ValidationContext *context, +bool ValidateActiveTexture(Context *context, GLenum texture); +bool ValidateAttachShader(Context *context, GLuint program, GLuint shader); +bool ValidateBindAttribLocation(Context *context, GLuint program, GLuint index, const GLchar *name); +bool ValidateBindBuffer(Context *context, BufferBinding target, GLuint buffer); +bool ValidateBindFramebuffer(Context *context, GLenum target, GLuint framebuffer); +bool ValidateBindRenderbuffer(Context *context, GLenum target, GLuint renderbuffer); +bool ValidateBlendColor(Context *context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -bool ValidateBlendEquation(ValidationContext *context, GLenum mode); -bool ValidateBlendEquationSeparate(ValidationContext *context, GLenum modeRGB, GLenum modeAlpha); -bool ValidateBlendFunc(ValidationContext *context, GLenum sfactor, GLenum dfactor); -bool ValidateBlendFuncSeparate(ValidationContext *context, +bool ValidateBlendEquation(Context *context, GLenum mode); +bool ValidateBlendEquationSeparate(Context *context, GLenum modeRGB, GLenum modeAlpha); +bool ValidateBlendFunc(Context *context, GLenum sfactor, GLenum dfactor); +bool ValidateBlendFuncSeparate(Context *context, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); bool ValidateGetString(Context *context, GLenum name); -bool ValidateLineWidth(ValidationContext *context, GLfloat width); -bool ValidateVertexAttribPointer(ValidationContext *context, +bool ValidateLineWidth(Context *context, GLfloat width); +bool ValidateVertexAttribPointer(Context *context, GLuint index, GLint size, GLenum type, @@ -400,46 +403,46 @@ bool ValidateVertexAttribPointer(ValidationContext *context, GLsizei stride, const void *ptr); -bool ValidateDepthRangef(ValidationContext *context, GLclampf zNear, GLclampf zFar); -bool ValidateRenderbufferStorage(ValidationContext *context, +bool ValidateDepthRangef(Context *context, GLclampf zNear, GLclampf zFar); +bool ValidateRenderbufferStorage(Context *context, GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -bool ValidateRenderbufferStorageMultisampleANGLE(ValidationContext *context, +bool ValidateRenderbufferStorageMultisampleANGLE(Context *context, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -bool ValidateCheckFramebufferStatus(ValidationContext *context, GLenum target); -bool ValidateClearColor(ValidationContext *context, +bool ValidateCheckFramebufferStatus(Context *context, GLenum target); +bool ValidateClearColor(Context *context, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); -bool ValidateClearDepthf(ValidationContext *context, GLclampf depth); -bool ValidateClearStencil(ValidationContext *context, GLint s); -bool ValidateColorMask(ValidationContext *context, +bool ValidateClearDepthf(Context *context, GLclampf depth); +bool ValidateClearStencil(Context *context, GLint s); +bool ValidateColorMask(Context *context, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -bool ValidateCompileShader(ValidationContext *context, GLuint shader); -bool ValidateCreateProgram(ValidationContext *context); -bool ValidateCullFace(ValidationContext *context, CullFaceMode mode); -bool ValidateDeleteProgram(ValidationContext *context, GLuint program); -bool ValidateDeleteShader(ValidationContext *context, GLuint shader); -bool ValidateDepthFunc(ValidationContext *context, GLenum func); -bool ValidateDepthMask(ValidationContext *context, GLboolean flag); -bool ValidateDetachShader(ValidationContext *context, GLuint program, GLuint shader); -bool ValidateDisableVertexAttribArray(ValidationContext *context, GLuint index); -bool ValidateEnableVertexAttribArray(ValidationContext *context, GLuint index); -bool ValidateFinish(ValidationContext *context); -bool ValidateFlush(ValidationContext *context); -bool ValidateFrontFace(ValidationContext *context, GLenum mode); -bool ValidateGetActiveAttrib(ValidationContext *context, +bool ValidateCompileShader(Context *context, GLuint shader); +bool ValidateCreateProgram(Context *context); +bool ValidateCullFace(Context *context, CullFaceMode mode); +bool ValidateDeleteProgram(Context *context, GLuint program); +bool ValidateDeleteShader(Context *context, GLuint shader); +bool ValidateDepthFunc(Context *context, GLenum func); +bool ValidateDepthMask(Context *context, GLboolean flag); +bool ValidateDetachShader(Context *context, GLuint program, GLuint shader); +bool ValidateDisableVertexAttribArray(Context *context, GLuint index); +bool ValidateEnableVertexAttribArray(Context *context, GLuint index); +bool ValidateFinish(Context *context); +bool ValidateFlush(Context *context); +bool ValidateFrontFace(Context *context, GLenum mode); +bool ValidateGetActiveAttrib(Context *context, GLuint program, GLuint index, GLsizei bufsize, @@ -447,7 +450,7 @@ bool ValidateGetActiveAttrib(ValidationContext *context, GLint *size, GLenum *type, GLchar *name); -bool ValidateGetActiveUniform(ValidationContext *context, +bool ValidateGetActiveUniform(Context *context, GLuint program, GLuint index, GLsizei bufsize, @@ -455,162 +458,141 @@ bool ValidateGetActiveUniform(ValidationContext *context, GLint *size, GLenum *type, GLchar *name); -bool ValidateGetAttachedShaders(ValidationContext *context, +bool ValidateGetAttachedShaders(Context *context, GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders); -bool ValidateGetAttribLocation(ValidationContext *context, GLuint program, const GLchar *name); -bool ValidateGetBooleanv(ValidationContext *context, GLenum pname, GLboolean *params); -bool ValidateGetError(ValidationContext *context); -bool ValidateGetFloatv(ValidationContext *context, GLenum pname, GLfloat *params); -bool ValidateGetIntegerv(ValidationContext *context, GLenum pname, GLint *params); -bool ValidateGetProgramInfoLog(ValidationContext *context, +bool ValidateGetAttribLocation(Context *context, GLuint program, const GLchar *name); +bool ValidateGetBooleanv(Context *context, GLenum pname, GLboolean *params); +bool ValidateGetError(Context *context); +bool ValidateGetFloatv(Context *context, GLenum pname, GLfloat *params); +bool ValidateGetIntegerv(Context *context, GLenum pname, GLint *params); +bool ValidateGetProgramInfoLog(Context *context, GLuint program, GLsizei bufsize, GLsizei *length, GLchar *infolog); -bool ValidateGetShaderInfoLog(ValidationContext *context, +bool ValidateGetShaderInfoLog(Context *context, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *infolog); -bool ValidateGetShaderPrecisionFormat(ValidationContext *context, +bool ValidateGetShaderPrecisionFormat(Context *context, GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -bool ValidateGetShaderSource(ValidationContext *context, +bool ValidateGetShaderSource(Context *context, GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -bool ValidateGetUniformLocation(ValidationContext *context, GLuint program, const GLchar *name); -bool ValidateHint(ValidationContext *context, GLenum target, GLenum mode); -bool ValidateIsBuffer(ValidationContext *context, GLuint buffer); -bool ValidateIsFramebuffer(ValidationContext *context, GLuint framebuffer); -bool ValidateIsProgram(ValidationContext *context, GLuint program); -bool ValidateIsRenderbuffer(ValidationContext *context, GLuint renderbuffer); -bool ValidateIsShader(ValidationContext *context, GLuint shader); -bool ValidateIsTexture(ValidationContext *context, GLuint texture); -bool ValidatePixelStorei(ValidationContext *context, GLenum pname, GLint param); -bool ValidatePolygonOffset(ValidationContext *context, GLfloat factor, GLfloat units); -bool ValidateReleaseShaderCompiler(ValidationContext *context); -bool ValidateSampleCoverage(ValidationContext *context, GLclampf value, GLboolean invert); -bool ValidateScissor(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height); -bool ValidateShaderBinary(ValidationContext *context, +bool ValidateGetUniformLocation(Context *context, GLuint program, const GLchar *name); +bool ValidateHint(Context *context, GLenum target, GLenum mode); +bool ValidateIsBuffer(Context *context, GLuint buffer); +bool ValidateIsFramebuffer(Context *context, GLuint framebuffer); +bool ValidateIsProgram(Context *context, GLuint program); +bool ValidateIsRenderbuffer(Context *context, GLuint renderbuffer); +bool ValidateIsShader(Context *context, GLuint shader); +bool ValidateIsTexture(Context *context, GLuint texture); +bool ValidatePixelStorei(Context *context, GLenum pname, GLint param); +bool ValidatePolygonOffset(Context *context, GLfloat factor, GLfloat units); +bool ValidateReleaseShaderCompiler(Context *context); +bool ValidateSampleCoverage(Context *context, GLclampf value, GLboolean invert); +bool ValidateScissor(Context *context, GLint x, GLint y, GLsizei width, GLsizei height); +bool ValidateShaderBinary(Context *context, GLsizei n, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -bool ValidateShaderSource(ValidationContext *context, +bool ValidateShaderSource(Context *context, GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length); -bool ValidateStencilFunc(ValidationContext *context, GLenum func, GLint ref, GLuint mask); -bool ValidateStencilFuncSeparate(ValidationContext *context, +bool ValidateStencilFunc(Context *context, GLenum func, GLint ref, GLuint mask); +bool ValidateStencilFuncSeparate(Context *context, GLenum face, GLenum func, GLint ref, GLuint mask); -bool ValidateStencilMask(ValidationContext *context, GLuint mask); -bool ValidateStencilMaskSeparate(ValidationContext *context, GLenum face, GLuint mask); -bool ValidateStencilOp(ValidationContext *context, GLenum fail, GLenum zfail, GLenum zpass); -bool ValidateStencilOpSeparate(ValidationContext *context, +bool ValidateStencilMask(Context *context, GLuint mask); +bool ValidateStencilMaskSeparate(Context *context, GLenum face, GLuint mask); +bool ValidateStencilOp(Context *context, GLenum fail, GLenum zfail, GLenum zpass); +bool ValidateStencilOpSeparate(Context *context, GLenum face, GLenum fail, GLenum zfail, GLenum zpass); -bool ValidateUniform1f(ValidationContext *context, GLint location, GLfloat x); -bool ValidateUniform1fv(ValidationContext *context, - GLint location, - GLsizei count, - const GLfloat *v); -bool ValidateUniform1i(ValidationContext *context, GLint location, GLint x); -bool ValidateUniform2f(ValidationContext *context, GLint location, GLfloat x, GLfloat y); -bool ValidateUniform2fv(ValidationContext *context, - GLint location, - GLsizei count, - const GLfloat *v); -bool ValidateUniform2i(ValidationContext *context, GLint location, GLint x, GLint y); -bool ValidateUniform2iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v); -bool ValidateUniform3f(ValidationContext *context, GLint location, GLfloat x, GLfloat y, GLfloat z); -bool ValidateUniform3fv(ValidationContext *context, - GLint location, - GLsizei count, - const GLfloat *v); -bool ValidateUniform3i(ValidationContext *context, GLint location, GLint x, GLint y, GLint z); -bool ValidateUniform3iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v); -bool ValidateUniform4f(ValidationContext *context, +bool ValidateUniform1f(Context *context, GLint location, GLfloat x); +bool ValidateUniform1fv(Context *context, GLint location, GLsizei count, const GLfloat *v); +bool ValidateUniform1i(Context *context, GLint location, GLint x); +bool ValidateUniform2f(Context *context, GLint location, GLfloat x, GLfloat y); +bool ValidateUniform2fv(Context *context, GLint location, GLsizei count, const GLfloat *v); +bool ValidateUniform2i(Context *context, GLint location, GLint x, GLint y); +bool ValidateUniform2iv(Context *context, GLint location, GLsizei count, const GLint *v); +bool ValidateUniform3f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z); +bool ValidateUniform3fv(Context *context, GLint location, GLsizei count, const GLfloat *v); +bool ValidateUniform3i(Context *context, GLint location, GLint x, GLint y, GLint z); +bool ValidateUniform3iv(Context *context, GLint location, GLsizei count, const GLint *v); +bool ValidateUniform4f(Context *context, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -bool ValidateUniform4fv(ValidationContext *context, - GLint location, - GLsizei count, - const GLfloat *v); -bool ValidateUniform4i(ValidationContext *context, - GLint location, - GLint x, - GLint y, - GLint z, - GLint w); -bool ValidateUniform4iv(ValidationContext *context, GLint location, GLsizei count, const GLint *v); -bool ValidateUniformMatrix2fv(ValidationContext *context, +bool ValidateUniform4fv(Context *context, GLint location, GLsizei count, const GLfloat *v); +bool ValidateUniform4i(Context *context, GLint location, GLint x, GLint y, GLint z, GLint w); +bool ValidateUniform4iv(Context *context, GLint location, GLsizei count, const GLint *v); +bool ValidateUniformMatrix2fv(Context *context, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -bool ValidateUniformMatrix3fv(ValidationContext *context, +bool ValidateUniformMatrix3fv(Context *context, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -bool ValidateUniformMatrix4fv(ValidationContext *context, +bool ValidateUniformMatrix4fv(Context *context, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -bool ValidateValidateProgram(ValidationContext *context, GLuint program); -bool ValidateVertexAttrib1f(ValidationContext *context, GLuint index, GLfloat x); -bool ValidateVertexAttrib1fv(ValidationContext *context, GLuint index, const GLfloat *values); -bool ValidateVertexAttrib2f(ValidationContext *context, GLuint index, GLfloat x, GLfloat y); -bool ValidateVertexAttrib2fv(ValidationContext *context, GLuint index, const GLfloat *values); -bool ValidateVertexAttrib3f(ValidationContext *context, - GLuint index, - GLfloat x, - GLfloat y, - GLfloat z); -bool ValidateVertexAttrib3fv(ValidationContext *context, GLuint index, const GLfloat *values); -bool ValidateVertexAttrib4f(ValidationContext *context, +bool ValidateValidateProgram(Context *context, GLuint program); +bool ValidateVertexAttrib1f(Context *context, GLuint index, GLfloat x); +bool ValidateVertexAttrib1fv(Context *context, GLuint index, const GLfloat *values); +bool ValidateVertexAttrib2f(Context *context, GLuint index, GLfloat x, GLfloat y); +bool ValidateVertexAttrib2fv(Context *context, GLuint index, const GLfloat *values); +bool ValidateVertexAttrib3f(Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z); +bool ValidateVertexAttrib3fv(Context *context, GLuint index, const GLfloat *values); +bool ValidateVertexAttrib4f(Context *context, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -bool ValidateVertexAttrib4fv(ValidationContext *context, GLuint index, const GLfloat *values); -bool ValidateViewport(ValidationContext *context, GLint x, GLint y, GLsizei width, GLsizei height); -bool ValidateDrawElements(ValidationContext *context, +bool ValidateVertexAttrib4fv(Context *context, GLuint index, const GLfloat *values); +bool ValidateViewport(Context *context, GLint x, GLint y, GLsizei width, GLsizei height); +bool ValidateDrawElements(Context *context, GLenum mode, GLsizei count, GLenum type, const void *indices); -bool ValidateDrawArrays(ValidationContext *context, GLenum mode, GLint first, GLsizei count); +bool ValidateDrawArrays(Context *context, GLenum mode, GLint first, GLsizei count); bool ValidateGetFramebufferAttachmentParameteriv(Context *context, GLenum target, GLenum attachment, GLenum pname, GLint *params); -bool ValidateGetProgramiv(ValidationContext *context, GLuint program, GLenum pname, GLint *params); +bool ValidateGetProgramiv(Context *context, GLuint program, GLenum pname, GLint *params); -bool ValidateCopyTexImage2D(ValidationContext *context, - GLenum target, +bool ValidateCopyTexImage2D(Context *context, + TextureTarget target, GLint level, GLenum internalformat, GLint x, @@ -620,7 +602,7 @@ bool ValidateCopyTexImage2D(ValidationContext *context, GLint border); bool ValidateCopyTexSubImage2D(Context *context, - GLenum target, + TextureTarget target, GLint level, GLint xoffset, GLint yoffset, @@ -643,15 +625,15 @@ bool ValidateFramebufferRenderbuffer(Context *context, bool ValidateFramebufferTexture2D(Context *context, GLenum target, GLenum attachment, - GLenum textarget, + TextureTarget textarget, GLuint texture, GLint level); bool ValidateGenBuffers(Context *context, GLint n, GLuint *buffers); -bool ValidateGenerateMipmap(Context *context, GLenum target); +bool ValidateGenerateMipmap(Context *context, TextureType target); bool ValidateGenFramebuffers(Context *context, GLint n, GLuint *framebuffers); bool ValidateGenRenderbuffers(Context *context, GLint n, GLuint *renderbuffers); bool ValidateGenTextures(Context *context, GLint n, GLuint *textures); -bool ValidateGetBufferParameteriv(ValidationContext *context, +bool ValidateGetBufferParameteriv(Context *context, BufferBinding target, GLenum pname, GLint *params); @@ -660,8 +642,8 @@ bool ValidateGetRenderbufferParameteriv(Context *context, GLenum pname, GLint *params); bool ValidateGetShaderiv(Context *context, GLuint shader, GLenum pname, GLint *params); -bool ValidateGetTexParameterfv(Context *context, GLenum target, GLenum pname, GLfloat *params); -bool ValidateGetTexParameteriv(Context *context, GLenum target, GLenum pname, GLint *params); +bool ValidateGetTexParameterfv(Context *context, TextureType target, GLenum pname, GLfloat *params); +bool ValidateGetTexParameteriv(Context *context, TextureType target, GLenum pname, GLint *params); bool ValidateGetUniformfv(Context *context, GLuint program, GLint location, GLfloat *params); bool ValidateGetUniformiv(Context *context, GLuint program, GLint location, GLint *params); bool ValidateGetVertexAttribfv(Context *context, GLuint index, GLenum pname, GLfloat *params); @@ -677,14 +659,17 @@ bool ValidateReadPixels(Context *context, GLenum format, GLenum type, void *pixels); -bool ValidateTexParameterf(Context *context, GLenum target, GLenum pname, GLfloat param); -bool ValidateTexParameterfv(Context *context, GLenum target, GLenum pname, const GLfloat *params); -bool ValidateTexParameteri(Context *context, GLenum target, GLenum pname, GLint param); -bool ValidateTexParameteriv(Context *context, GLenum target, GLenum pname, const GLint *params); -bool ValidateUniform1iv(ValidationContext *context, - GLint location, - GLsizei count, - const GLint *value); +bool ValidateTexParameterf(Context *context, TextureType target, GLenum pname, GLfloat param); +bool ValidateTexParameterfv(Context *context, + TextureType target, + GLenum pname, + const GLfloat *params); +bool ValidateTexParameteri(Context *context, TextureType target, GLenum pname, GLint param); +bool ValidateTexParameteriv(Context *context, + TextureType target, + GLenum pname, + const GLint *params); +bool ValidateUniform1iv(Context *context, GLint location, GLsizei count, const GLint *value); bool ValidateUseProgram(Context *context, GLuint program); // Extension validation @@ -702,7 +687,7 @@ bool ValidateIsFenceNV(Context *context, GLuint fence); bool ValidateSetFenceNV(Context *context, GLuint fence, GLenum condition); bool ValidateTestFenceNV(Context *context, GLuint fence); bool ValidateTexStorage2DEXT(Context *context, - GLenum target, + TextureType type, GLsizei levels, GLenum internalformat, GLsizei width, @@ -726,7 +711,7 @@ bool ValidateTexStorage1DEXT(Context *context, GLenum internalformat, GLsizei width); bool ValidateTexStorage3DEXT(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, diff --git a/gfx/angle/checkout/src/libANGLE/validationES3.cpp b/gfx/angle/checkout/src/libANGLE/validationES3.cpp index a08ae78274c6..42f9df640480 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES3.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationES3.cpp @@ -66,14 +66,14 @@ bool ValidateFramebufferTextureMultiviewLevelAndFormat(Context *context, Texture *texture, GLint level) { - GLenum texTarget = texture->getTarget(); - if (!ValidMipLevel(context, texTarget, level)) + TextureType type = texture->getType(); + if (!ValidMipLevel(context, type, level)) { ANGLE_VALIDATION_ERR(context, InvalidValue(), InvalidMipLevel); return false; } - const auto &format = texture->getFormat(texTarget, level); + const auto &format = texture->getFormat(NonCubeTextureTypeToTarget(type), level); if (format.info->compressed) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), CompressedTexturesNotAttachable); @@ -137,7 +137,7 @@ bool ValidateGenOrDeleteCountES3(Context *context, GLint count) } // anonymous namespace static bool ValidateTexImageFormatCombination(gl::Context *context, - GLenum target, + TextureType target, GLenum internalFormat, GLenum format, GLenum type) @@ -171,7 +171,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, // texture image specification commands only if target is TEXTURE_2D, TEXTURE_2D_ARRAY, or // TEXTURE_CUBE_MAP.Using these formats in conjunction with any other target will result in an // INVALID_OPERATION error. - if (target == GL_TEXTURE_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL)) + if (target == TextureType::_3D && (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL)) { context->handleError(InvalidOperation() << "Format cannot be GL_DEPTH_COMPONENT or " "GL_DEPTH_STENCIL if target is " @@ -198,7 +198,7 @@ static bool ValidateTexImageFormatCombination(gl::Context *context, } bool ValidateES3TexImageParametersBase(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, bool isCompressed, @@ -215,8 +215,10 @@ bool ValidateES3TexImageParametersBase(Context *context, GLsizei imageSize, const void *pixels) { + TextureType texType = TextureTargetToType(target); + // Validate image size - if (!ValidImageSizeParameters(context, target, level, width, height, depth, isSubImage)) + if (!ValidImageSizeParameters(context, texType, level, width, height, depth, isSubImage)) { context->handleError(InvalidValue()); return false; @@ -240,9 +242,9 @@ bool ValidateES3TexImageParametersBase(Context *context, const gl::Caps &caps = context->getCaps(); - switch (target) + switch (texType) { - case GL_TEXTURE_2D: + case TextureType::_2D: if (static_cast(width) > (caps.max2DTextureSize >> level) || static_cast(height) > (caps.max2DTextureSize >> level)) { @@ -251,7 +253,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: ASSERT(level == 0); if (static_cast(width) > caps.maxRectangleTextureSize || static_cast(height) > caps.maxRectangleTextureSize) @@ -267,12 +269,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } break; - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: + case TextureType::CubeMap: if (!isSubImage && width != height) { context->handleError(InvalidValue()); @@ -286,7 +283,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } break; - case GL_TEXTURE_3D: + case TextureType::_3D: if (static_cast(width) > (caps.max3DTextureSize >> level) || static_cast(height) > (caps.max3DTextureSize >> level) || static_cast(depth) > (caps.max3DTextureSize >> level)) @@ -296,7 +293,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } break; - case GL_TEXTURE_2D_ARRAY: + case TextureType::_2DArray: if (static_cast(width) > (caps.max2DTextureSize >> level) || static_cast(height) > (caps.max2DTextureSize >> level) || static_cast(depth) > caps.maxArrayTextureLayers) @@ -311,8 +308,7 @@ bool ValidateES3TexImageParametersBase(Context *context, return false; } - gl::Texture *texture = - context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target); + gl::Texture *texture = context->getTargetTexture(texType); if (!texture) { context->handleError(InvalidOperation()); @@ -384,7 +380,7 @@ bool ValidateES3TexImageParametersBase(Context *context, return false; } - if (target == GL_TEXTURE_3D) + if (texType == TextureType::_3D) { context->handleError(InvalidOperation()); return false; @@ -392,7 +388,8 @@ bool ValidateES3TexImageParametersBase(Context *context, } else { - if (!ValidateTexImageFormatCombination(context, target, actualInternalFormat, format, type)) + if (!ValidateTexImageFormatCombination(context, texType, actualInternalFormat, format, + type)) { return false; } @@ -438,7 +435,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } GLenum sizeCheckFormat = isSubImage ? format : internalformat; - if (!ValidImageDataSize(context, target, width, height, depth, sizeCheckFormat, type, pixels, + if (!ValidImageDataSize(context, texType, width, height, depth, sizeCheckFormat, type, pixels, imageSize)) { return false; @@ -477,7 +474,7 @@ bool ValidateES3TexImageParametersBase(Context *context, } bool ValidateES3TexImage2DParameters(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, bool isCompressed, @@ -506,7 +503,7 @@ bool ValidateES3TexImage2DParameters(Context *context, } bool ValidateES3TexImage3DParameters(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, bool isCompressed, @@ -529,16 +526,17 @@ bool ValidateES3TexImage3DParameters(Context *context, return false; } - if (IsETC2EACFormat(format) && target != GL_TEXTURE_2D_ARRAY) + if (IsETC2EACFormat(format) && target != TextureType::_2DArray) { // ES 3.1, Section 8.7, page 169. ANGLE_VALIDATION_ERR(context, InvalidOperation(), InternalFormatRequiresTexture2DArray); return false; } - return ValidateES3TexImageParametersBase(context, target, level, internalformat, isCompressed, - isSubImage, xoffset, yoffset, zoffset, width, height, - depth, border, format, type, bufSize, pixels); + return ValidateES3TexImageParametersBase(context, NonCubeTextureTypeToTarget(target), level, + internalformat, isCompressed, isSubImage, xoffset, + yoffset, zoffset, width, height, depth, border, format, + type, bufSize, pixels); } struct EffectiveInternalFormatInfo @@ -783,8 +781,8 @@ static bool IsValidES3CopyTexImageCombination(const InternalFormat &textureForma // conversion between these formats. } -bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, - GLenum target, +bool ValidateES3CopyTexImageParametersBase(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -810,15 +808,13 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, gl::Framebuffer *framebuffer = state.getReadFramebuffer(); GLuint readFramebufferID = framebuffer->id(); - if (framebuffer->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, framebuffer, true)) { - context->handleError(InvalidFramebufferOperation()); return false; } - if (readFramebufferID != 0 && framebuffer->getSamples(context) != 0) + if (readFramebufferID != 0 && !ValidateFramebufferNotMultisampled(context, framebuffer)) { - context->handleError(InvalidOperation()); return false; } @@ -849,8 +845,8 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, return (width > 0 && height > 0); } -bool ValidateES3CopyTexImage2DParameters(ValidationContext *context, - GLenum target, +bool ValidateES3CopyTexImage2DParameters(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -874,8 +870,8 @@ bool ValidateES3CopyTexImage2DParameters(ValidationContext *context, border); } -bool ValidateES3CopyTexImage3DParameters(ValidationContext *context, - GLenum target, +bool ValidateES3CopyTexImage3DParameters(Context *context, + TextureType target, GLint level, GLenum internalformat, bool isSubImage, @@ -894,13 +890,13 @@ bool ValidateES3CopyTexImage3DParameters(ValidationContext *context, return false; } - return ValidateES3CopyTexImageParametersBase(context, target, level, internalformat, isSubImage, - xoffset, yoffset, zoffset, x, y, width, height, - border); + return ValidateES3CopyTexImageParametersBase(context, NonCubeTextureTypeToTarget(target), level, + internalformat, isSubImage, xoffset, yoffset, + zoffset, x, y, width, height, border); } bool ValidateES3TexStorageParametersBase(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -914,7 +910,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } GLsizei maxDim = std::max(width, height); - if (target != GL_TEXTURE_2D_ARRAY) + if (target != TextureType::_2DArray) { maxDim = std::max(maxDim, depth); } @@ -929,7 +925,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, switch (target) { - case GL_TEXTURE_2D: + case TextureType::_2D: { if (static_cast(width) > caps.max2DTextureSize || static_cast(height) > caps.max2DTextureSize) @@ -940,7 +936,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } break; - case GL_TEXTURE_RECTANGLE_ANGLE: + case TextureType::Rectangle: { if (static_cast(width) > caps.maxRectangleTextureSize || static_cast(height) > caps.maxRectangleTextureSize || levels != 1) @@ -951,7 +947,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } break; - case GL_TEXTURE_CUBE_MAP: + case TextureType::CubeMap: { if (width != height) { @@ -967,7 +963,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } break; - case GL_TEXTURE_3D: + case TextureType::_3D: { if (static_cast(width) > caps.max3DTextureSize || static_cast(height) > caps.max3DTextureSize || @@ -979,7 +975,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } break; - case GL_TEXTURE_2D_ARRAY: + case TextureType::_2DArray: { if (static_cast(width) > caps.max2DTextureSize || static_cast(height) > caps.max2DTextureSize || @@ -1022,7 +1018,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, return false; } - if (formatInfo.compressed && target == GL_TEXTURE_RECTANGLE_ANGLE) + if (formatInfo.compressed && target == TextureType::Rectangle) { context->handleError(InvalidEnum() << "Rectangle texture cannot have a compressed format."); return false; @@ -1032,7 +1028,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, } bool ValidateES3TexStorage2DParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -1050,7 +1046,7 @@ bool ValidateES3TexStorage2DParameters(Context *context, } bool ValidateES3TexStorage3DParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -1141,9 +1137,9 @@ bool ValidateFramebufferTextureLayer(Context *context, gl::Texture *tex = context->getTexture(texture); ASSERT(tex); - switch (tex->getTarget()) + switch (tex->getType()) { - case GL_TEXTURE_2D_ARRAY: + case TextureType::_2DArray: { if (level > gl::log2(caps.max2DTextureSize)) { @@ -1159,7 +1155,7 @@ bool ValidateFramebufferTextureLayer(Context *context, } break; - case GL_TEXTURE_3D: + case TextureType::_3D: { if (level > gl::log2(caps.max3DTextureSize)) { @@ -1180,7 +1176,7 @@ bool ValidateFramebufferTextureLayer(Context *context, return false; } - const auto &format = tex->getFormat(tex->getTarget(), level); + const auto &format = tex->getFormat(NonCubeTextureTypeToTarget(tex->getType()), level); if (format.info->compressed) { context->handleError(InvalidOperation()); @@ -1240,7 +1236,7 @@ bool ValidateInvalidateSubFramebuffer(Context *context, return ValidateInvalidateFramebuffer(context, target, numAttachments, attachments); } -bool ValidateClearBuffer(ValidationContext *context) +bool ValidateClearBuffer(Context *context) { if (context->getClientMajorVersion() < 3) { @@ -1248,9 +1244,8 @@ bool ValidateClearBuffer(ValidationContext *context) return false; } - if (context->getGLState().getDrawFramebuffer()->checkStatus(context) != GL_FRAMEBUFFER_COMPLETE) + if (!ValidateFramebufferComplete(context, context->getGLState().getDrawFramebuffer(), true)) { - context->handleError(InvalidFramebufferOperation()); return false; } @@ -1289,15 +1284,12 @@ bool ValidateDrawRangeElements(Context *context, } // Use the parameter buffer to retrieve and cache the index range. - const auto ¶ms = context->getParams(); - const auto &indexRangeOpt = params.getIndexRange(); - if (!indexRangeOpt.valid()) - { - // Unexpected error. - return false; - } + const DrawCallParams ¶ms = context->getParams(); + ANGLE_VALIDATION_TRY(params.ensureIndexRangeResolved(context)); - if (indexRangeOpt.value().end > end || indexRangeOpt.value().start < start) + const IndexRange &indexRange = params.getIndexRange(); + + if (indexRange.end > end || indexRange.start < start) { // GL spec says that behavior in this case is undefined - generating an error is fine. context->handleError(InvalidOperation() << "Indices are out of the start, end range."); @@ -1369,7 +1361,7 @@ bool ValidateReadBuffer(Context *context, GLenum src) } bool ValidateCompressedTexImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -1418,7 +1410,7 @@ bool ValidateCompressedTexImage3D(Context *context, } // 3D texture target validation - if (target != GL_TEXTURE_3D && target != GL_TEXTURE_2D_ARRAY) + if (target != TextureType::_3D && target != TextureType::_2DArray) { context->handleError(InvalidEnum() << "Must specify a valid 3D texture destination target"); return false; @@ -1436,7 +1428,7 @@ bool ValidateCompressedTexImage3D(Context *context, } bool ValidateCompressedTexImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -1729,10 +1721,7 @@ bool ValidateBlitFramebuffer(Context *context, dstX1, dstY1, mask, filter); } -bool ValidateClearBufferiv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLint *value) +bool ValidateClearBufferiv(Context *context, GLenum buffer, GLint drawbuffer, const GLint *value) { switch (buffer) { @@ -1770,10 +1759,7 @@ bool ValidateClearBufferiv(ValidationContext *context, return ValidateClearBuffer(context); } -bool ValidateClearBufferuiv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLuint *value) +bool ValidateClearBufferuiv(Context *context, GLenum buffer, GLint drawbuffer, const GLuint *value) { switch (buffer) { @@ -1803,10 +1789,7 @@ bool ValidateClearBufferuiv(ValidationContext *context, return ValidateClearBuffer(context); } -bool ValidateClearBufferfv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLfloat *value) +bool ValidateClearBufferfv(Context *context, GLenum buffer, GLint drawbuffer, const GLfloat *value) { switch (buffer) { @@ -1845,7 +1828,7 @@ bool ValidateClearBufferfv(ValidationContext *context, return ValidateClearBuffer(context); } -bool ValidateClearBufferfi(ValidationContext *context, +bool ValidateClearBufferfi(Context *context, GLenum buffer, GLint drawbuffer, GLfloat depth, @@ -1869,7 +1852,7 @@ bool ValidateClearBufferfi(ValidationContext *context, return ValidateClearBuffer(context); } -bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bufs) +bool ValidateDrawBuffers(Context *context, GLsizei n, const GLenum *bufs) { if (context->getClientMajorVersion() < 3) { @@ -1881,7 +1864,7 @@ bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bu } bool ValidateCopyTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -1902,7 +1885,7 @@ bool ValidateCopyTexSubImage3D(Context *context, } bool ValidateTexImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -1925,7 +1908,7 @@ bool ValidateTexImage3D(Context *context, } bool ValidateTexImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -1954,7 +1937,7 @@ bool ValidateTexImage3DRobustANGLE(Context *context, } bool ValidateTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -1978,7 +1961,7 @@ bool ValidateTexSubImage3D(Context *context, } bool ValidateTexSubImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -2008,7 +1991,7 @@ bool ValidateTexSubImage3DRobustANGLE(Context *context, } bool ValidateCompressedTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -2062,7 +2045,7 @@ bool ValidateCompressedTexSubImage3D(Context *context, } bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -2211,16 +2194,20 @@ bool ValidateGetBufferPointervRobustANGLE(Context *context, return false; } - if (!ValidateGetBufferPointervBase(context, target, pname, length, params)) + GLsizei numParams = 0; + + if (!ValidateGetBufferPointervBase(context, target, pname, &numParams, params)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } @@ -2264,10 +2251,7 @@ bool ValidateFlushMappedBufferRange(Context *context, return ValidateFlushMappedBufferRangeBase(context, target, offset, length); } -bool ValidateIndexedStateQuery(ValidationContext *context, - GLenum pname, - GLuint index, - GLsizei *length) +bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLsizei *length) { if (length) { @@ -2413,7 +2397,7 @@ bool ValidateIndexedStateQuery(ValidationContext *context, return true; } -bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data) +bool ValidateGetIntegeri_v(Context *context, GLenum target, GLuint index, GLint *data) { if (context->getClientVersion() < ES_3_0) { @@ -2423,7 +2407,7 @@ bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint ind return ValidateIndexedStateQuery(context, target, index, nullptr); } -bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context, +bool ValidateGetIntegeri_vRobustANGLE(Context *context, GLenum target, GLuint index, GLsizei bufSize, @@ -2441,20 +2425,24 @@ bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context, return false; } - if (!ValidateIndexedStateQuery(context, target, index, length)) + GLsizei numParams = 0; + + if (!ValidateIndexedStateQuery(context, target, index, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint index, GLint64 *data) +bool ValidateGetInteger64i_v(Context *context, GLenum target, GLuint index, GLint64 *data) { if (context->getClientVersion() < ES_3_0) { @@ -2464,7 +2452,7 @@ bool ValidateGetInteger64i_v(ValidationContext *context, GLenum target, GLuint i return ValidateIndexedStateQuery(context, target, index, nullptr); } -bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context, +bool ValidateGetInteger64i_vRobustANGLE(Context *context, GLenum target, GLuint index, GLsizei bufSize, @@ -2482,20 +2470,24 @@ bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context, return false; } - if (!ValidateIndexedStateQuery(context, target, index, length)) + GLsizei numParams = 0; + + if (!ValidateIndexedStateQuery(context, target, index, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); + return true; } -bool ValidateCopyBufferSubData(ValidationContext *context, +bool ValidateCopyBufferSubData(Context *context, BufferBinding readTarget, BufferBinding writeTarget, GLintptr readOffset, @@ -2531,6 +2523,14 @@ bool ValidateCopyBufferSubData(ValidationContext *context, return false; } + if (context->getExtensions().webglCompatibility && + (readBuffer->isBoundForTransformFeedbackAndOtherUse() || + writeBuffer->isBoundForTransformFeedbackAndOtherUse())) + { + ANGLE_VALIDATION_ERR(context, InvalidOperation(), BufferBoundForTransformFeedback); + return false; + } + CheckedNumeric checkedReadOffset(readOffset); CheckedNumeric checkedWriteOffset(writeOffset); CheckedNumeric checkedSize(size); @@ -2624,7 +2624,7 @@ bool ValidateGetStringi(Context *context, GLenum name, GLuint index) return true; } -bool ValidateRenderbufferStorageMultisample(ValidationContext *context, +bool ValidateRenderbufferStorageMultisample(Context *context, GLenum target, GLsizei samples, GLenum internalformat, @@ -2670,7 +2670,7 @@ bool ValidateRenderbufferStorageMultisample(ValidationContext *context, return true; } -bool ValidateVertexAttribIPointer(ValidationContext *context, +bool ValidateVertexAttribIPointer(Context *context, GLuint index, GLint size, GLenum type, @@ -2781,7 +2781,7 @@ bool ValidateGetSynciv(Context *context, return true; } -bool ValidateDrawElementsInstanced(ValidationContext *context, +bool ValidateDrawElementsInstanced(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -2823,9 +2823,9 @@ bool ValidateFramebufferTextureMultiviewLayeredANGLE(Context *context, Texture *tex = context->getTexture(texture); ASSERT(tex); - switch (tex->getTarget()) + switch (tex->getType()) { - case GL_TEXTURE_2D_ARRAY: + case TextureType::_2DArray: { const Caps &caps = context->getCaps(); if (static_cast(baseViewIndex + numViews) > caps.maxArrayTextureLayers) @@ -2882,9 +2882,9 @@ bool ValidateFramebufferTextureMultiviewSideBySideANGLE(Context *context, Texture *tex = context->getTexture(texture); ASSERT(tex); - switch (tex->getTarget()) + switch (tex->getType()) { - case GL_TEXTURE_2D: + case TextureType::_2D: break; default: context->handleError(InvalidOperation() @@ -3639,7 +3639,7 @@ bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor) } bool ValidateTexStorage2D(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -3661,7 +3661,7 @@ bool ValidateTexStorage2D(Context *context, } bool ValidateTexStorage3D(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -3683,7 +3683,7 @@ bool ValidateTexStorage3D(Context *context, return true; } -bool ValidateGetBufferParameteri64v(ValidationContext *context, +bool ValidateGetBufferParameteri64v(Context *context, BufferBinding target, GLenum pname, GLint64 *params) diff --git a/gfx/angle/checkout/src/libANGLE/validationES3.h b/gfx/angle/checkout/src/libANGLE/validationES3.h index 631b1ca43a19..e61d96f6754d 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES3.h +++ b/gfx/angle/checkout/src/libANGLE/validationES3.h @@ -17,9 +17,8 @@ namespace gl { class Context; struct IndexRange; -class ValidationContext; -bool ValidateES3TexImageParametersBase(ValidationContext *context, +bool ValidateES3TexImageParametersBase(Context *context, GLenum target, GLint level, GLenum internalformat, @@ -38,7 +37,7 @@ bool ValidateES3TexImageParametersBase(ValidationContext *context, const void *pixels); bool ValidateES3TexStorageParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -46,7 +45,7 @@ bool ValidateES3TexStorageParameters(Context *context, GLsizei depth); bool ValidateES3TexImage2DParameters(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum internalformat, bool isCompressed, @@ -64,7 +63,7 @@ bool ValidateES3TexImage2DParameters(Context *context, const void *pixels); bool ValidateES3TexImage3DParameters(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, bool isCompressed, @@ -81,7 +80,7 @@ bool ValidateES3TexImage3DParameters(Context *context, GLsizei bufSize, const void *pixels); -bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, +bool ValidateES3CopyTexImageParametersBase(Context *context, GLenum target, GLint level, GLenum internalformat, @@ -95,8 +94,8 @@ bool ValidateES3CopyTexImageParametersBase(ValidationContext *context, GLsizei height, GLint border); -bool ValidateES3CopyTexImage2DParameters(ValidationContext *context, - GLenum target, +bool ValidateES3CopyTexImage2DParameters(Context *context, + TextureTarget target, GLint level, GLenum internalformat, bool isSubImage, @@ -109,8 +108,8 @@ bool ValidateES3CopyTexImage2DParameters(ValidationContext *context, GLsizei height, GLint border); -bool ValidateES3CopyTexImage3DParameters(ValidationContext *context, - GLenum target, +bool ValidateES3CopyTexImage3DParameters(Context *context, + TextureType target, GLint level, GLenum internalformat, bool isSubImage, @@ -124,7 +123,7 @@ bool ValidateES3CopyTexImage3DParameters(ValidationContext *context, GLint border); bool ValidateES3TexStorageParametersBase(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -132,7 +131,7 @@ bool ValidateES3TexStorageParametersBase(Context *context, GLsizei depth); bool ValidateES3TexStorage2DParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -140,7 +139,7 @@ bool ValidateES3TexStorage2DParameters(Context *context, GLsizei depth); bool ValidateES3TexStorage3DParameters(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -176,7 +175,7 @@ bool ValidateInvalidateSubFramebuffer(Context *context, GLsizei width, GLsizei height); -bool ValidateClearBuffer(ValidationContext *context); +bool ValidateClearBuffer(Context *context); bool ValidateDrawRangeElements(Context *context, GLenum mode, @@ -191,7 +190,7 @@ bool ValidateGetUniformuiv(Context *context, GLuint program, GLint location, GLu bool ValidateReadBuffer(Context *context, GLenum mode); bool ValidateCompressedTexImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -201,7 +200,7 @@ bool ValidateCompressedTexImage3D(Context *context, GLsizei imageSize, const void *data); bool ValidateCompressedTexImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLenum internalformat, GLsizei width, @@ -246,26 +245,17 @@ bool ValidateBlitFramebuffer(Context *context, GLint dstY1, GLbitfield mask, GLenum filter); -bool ValidateClearBufferiv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLint *value); -bool ValidateClearBufferuiv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLuint *value); -bool ValidateClearBufferfv(ValidationContext *context, - GLenum buffer, - GLint drawbuffer, - const GLfloat *value); -bool ValidateClearBufferfi(ValidationContext *context, +bool ValidateClearBufferiv(Context *context, GLenum buffer, GLint drawbuffer, const GLint *value); +bool ValidateClearBufferuiv(Context *context, GLenum buffer, GLint drawbuffer, const GLuint *value); +bool ValidateClearBufferfv(Context *context, GLenum buffer, GLint drawbuffer, const GLfloat *value); +bool ValidateClearBufferfi(Context *context, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -bool ValidateDrawBuffers(ValidationContext *context, GLsizei n, const GLenum *bufs); +bool ValidateDrawBuffers(Context *context, GLsizei n, const GLenum *bufs); bool ValidateCopyTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -275,7 +265,7 @@ bool ValidateCopyTexSubImage3D(Context *context, GLsizei width, GLsizei height); bool ValidateTexImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -286,7 +276,7 @@ bool ValidateTexImage3D(Context *context, GLenum type, const void *pixels); bool ValidateTexImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint internalformat, GLsizei width, @@ -298,7 +288,7 @@ bool ValidateTexImage3DRobustANGLE(Context *context, GLsizei bufSize, const void *pixels); bool ValidateTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -310,7 +300,7 @@ bool ValidateTexSubImage3D(Context *context, GLenum type, const void *pixels); bool ValidateTexSubImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -323,7 +313,7 @@ bool ValidateTexSubImage3DRobustANGLE(Context *context, GLsizei bufSize, const void *pixels); bool ValidateCompressedTexSubImage3D(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -335,7 +325,7 @@ bool ValidateCompressedTexSubImage3D(Context *context, GLsizei imageSize, const void *data); bool ValidateCompressedTexSubImage3DRobustANGLE(Context *context, - GLenum target, + TextureType target, GLint level, GLint xoffset, GLint yoffset, @@ -377,29 +367,23 @@ bool ValidateFlushMappedBufferRange(Context *context, GLintptr offset, GLsizeiptr length); -bool ValidateIndexedStateQuery(ValidationContext *context, - GLenum pname, - GLuint index, - GLsizei *length); -bool ValidateGetIntegeri_v(ValidationContext *context, GLenum target, GLuint index, GLint *data); -bool ValidateGetIntegeri_vRobustANGLE(ValidationContext *context, +bool ValidateIndexedStateQuery(Context *context, GLenum pname, GLuint index, GLsizei *length); +bool ValidateGetIntegeri_v(Context *context, GLenum target, GLuint index, GLint *data); +bool ValidateGetIntegeri_vRobustANGLE(Context *context, GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data); -bool ValidateGetInteger64i_v(ValidationContext *context, - GLenum target, - GLuint index, - GLint64 *data); -bool ValidateGetInteger64i_vRobustANGLE(ValidationContext *context, +bool ValidateGetInteger64i_v(Context *context, GLenum target, GLuint index, GLint64 *data); +bool ValidateGetInteger64i_vRobustANGLE(Context *context, GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint64 *data); -bool ValidateCopyBufferSubData(ValidationContext *context, +bool ValidateCopyBufferSubData(Context *context, BufferBinding readTarget, BufferBinding writeTarget, GLintptr readOffset, @@ -407,14 +391,14 @@ bool ValidateCopyBufferSubData(ValidationContext *context, GLsizeiptr size); bool ValidateGetStringi(Context *context, GLenum name, GLuint index); -bool ValidateRenderbufferStorageMultisample(ValidationContext *context, +bool ValidateRenderbufferStorageMultisample(Context *context, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -bool ValidateVertexAttribIPointer(ValidationContext *context, +bool ValidateVertexAttribIPointer(Context *context, GLuint index, GLint size, GLenum type, @@ -428,7 +412,7 @@ bool ValidateGetSynciv(Context *context, GLsizei *length, GLint *values); -bool ValidateDrawElementsInstanced(ValidationContext *context, +bool ValidateDrawElementsInstanced(Context *context, GLenum mode, GLsizei count, GLenum type, @@ -571,13 +555,13 @@ bool ValidateIsSampler(Context *context, GLuint sampler); bool ValidateBindSampler(Context *context, GLuint unit, GLuint sampler); bool ValidateVertexAttribDivisor(Context *context, GLuint index, GLuint divisor); bool ValidateTexStorage2D(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); bool ValidateTexStorage3D(Context *context, - GLenum target, + TextureType target, GLsizei levels, GLenum internalformat, GLsizei width, @@ -586,7 +570,7 @@ bool ValidateTexStorage3D(Context *context, bool ValidateGetVertexAttribIiv(Context *context, GLuint index, GLenum pname, GLint *params); bool ValidateGetVertexAttribIuiv(Context *context, GLuint index, GLenum pname, GLuint *params); -bool ValidateGetBufferParameteri64v(ValidationContext *context, +bool ValidateGetBufferParameteri64v(Context *context, BufferBinding target, GLenum pname, GLint64 *params); diff --git a/gfx/angle/checkout/src/libANGLE/validationES31.cpp b/gfx/angle/checkout/src/libANGLE/validationES31.cpp index a7e008348e90..097e4638e04e 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES31.cpp +++ b/gfx/angle/checkout/src/libANGLE/validationES31.cpp @@ -281,7 +281,7 @@ bool ValidateProgramResourceIndex(const Program *programObject, } } -bool ValidateProgramUniform(gl::Context *context, +bool ValidateProgramUniform(Context *context, GLenum valueType, GLuint program, GLint location, @@ -295,12 +295,12 @@ bool ValidateProgramUniform(gl::Context *context, } const LinkedUniform *uniform = nullptr; - gl::Program *programObject = GetValidProgram(context, program); + Program *programObject = GetValidProgram(context, program); return ValidateUniformCommonBase(context, programObject, location, count, &uniform) && ValidateUniformValue(context, valueType, uniform->type); } -bool ValidateProgramUniformMatrix(gl::Context *context, +bool ValidateProgramUniformMatrix(Context *context, GLenum valueType, GLuint program, GLint location, @@ -315,12 +315,12 @@ bool ValidateProgramUniformMatrix(gl::Context *context, } const LinkedUniform *uniform = nullptr; - gl::Program *programObject = GetValidProgram(context, program); + Program *programObject = GetValidProgram(context, program); return ValidateUniformCommonBase(context, programObject, location, count, &uniform) && ValidateUniformMatrixValue(context, valueType, uniform->type); } -bool ValidateVertexAttribFormatCommon(ValidationContext *context, +bool ValidateVertexAttribFormatCommon(Context *context, GLuint attribIndex, GLint size, GLenum type, @@ -389,16 +389,19 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context, return false; } - if (!ValidateIndexedStateQuery(context, target, index, length)) + GLsizei numParams = 0; + + if (!ValidateIndexedStateQuery(context, target, index, &numParams)) { return false; } - if (!ValidateRobustBufferSize(context, bufSize, *length)) + if (!ValidateRobustBufferSize(context, bufSize, numParams)) { return false; } + SetRobustLengthParam(length, numParams); return true; } @@ -426,7 +429,7 @@ bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirec return false; } - gl::Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); + Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); if (!drawIndirectBuffer) { context->handleError(InvalidOperation() << "zero is bound to DRAW_INDIRECT_BUFFER"); @@ -463,7 +466,7 @@ bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirec bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect) { const State &state = context->getGLState(); - gl::TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback(); + TransformFeedback *curTransformFeedback = state.getCurrentTransformFeedback(); if (curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused()) { @@ -475,7 +478,7 @@ bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indir if (!ValidateDrawIndirectBase(context, mode, indirect)) return false; - gl::Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); + Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); CheckedNumeric checkedOffset(reinterpret_cast(indirect)); // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawArraysIndirectCommand // which's size is 4 * sizeof(uint). @@ -499,7 +502,7 @@ bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, co const State &state = context->getGLState(); const VertexArray *vao = state.getVertexArray(); - gl::Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); + Buffer *elementArrayBuffer = vao->getElementArrayBuffer().get(); if (!elementArrayBuffer) { context->handleError(InvalidOperation() << "zero is bound to ELEMENT_ARRAY_BUFFER"); @@ -509,7 +512,7 @@ bool ValidateDrawElementsIndirect(Context *context, GLenum mode, GLenum type, co if (!ValidateDrawIndirectBase(context, mode, indirect)) return false; - gl::Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); + Buffer *drawIndirectBuffer = state.getTargetBuffer(BufferBinding::DrawIndirect); CheckedNumeric checkedOffset(reinterpret_cast(indirect)); // In OpenGL ES3.1 spec, session 10.5, it defines the struct of DrawElementsIndirectCommand // which's size is 5 * sizeof(uint). @@ -650,7 +653,7 @@ bool ValidateProgramUniform1iv(Context *context, } const LinkedUniform *uniform = nullptr; - gl::Program *programObject = GetValidProgram(context, program); + Program *programObject = GetValidProgram(context, program); return ValidateUniformCommonBase(context, programObject, location, count, &uniform) && ValidateUniform1ivValue(context, uniform->type, count, value); } @@ -854,7 +857,7 @@ bool ValidateProgramUniformMatrix4x3fv(Context *context, } bool ValidateGetTexLevelParameterBase(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLsizei *length) @@ -870,20 +873,21 @@ bool ValidateGetTexLevelParameterBase(Context *context, *length = 0; } - if (!ValidTexLevelDestinationTarget(context, target)) + TextureType type = TextureTargetToType(target); + + if (!ValidTexLevelDestinationTarget(context, type)) { ANGLE_VALIDATION_ERR(context, InvalidEnum(), InvalidTextureTarget); return false; } - if (context->getTargetTexture(IsCubeMapTextureTarget(target) ? GL_TEXTURE_CUBE_MAP : target) == - nullptr) + if (context->getTargetTexture(type) == nullptr) { context->handleError(InvalidEnum() << "No texture bound."); return false; } - if (!ValidMipLevel(context, target, level)) + if (!ValidMipLevel(context, type, level)) { context->handleError(InvalidValue()); return false; @@ -928,7 +932,7 @@ bool ValidateGetTexLevelParameterBase(Context *context, } bool ValidateGetTexLevelParameterfv(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLfloat *params) @@ -936,8 +940,20 @@ bool ValidateGetTexLevelParameterfv(Context *context, return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr); } +bool ValidateGetTexLevelParameterfvRobustANGLE(Context *context, + TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetTexLevelParameteriv(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLint *params) @@ -945,8 +961,20 @@ bool ValidateGetTexLevelParameteriv(Context *context, return ValidateGetTexLevelParameterBase(context, target, level, pname, nullptr); } +bool ValidateGetTexLevelParameterivRobustANGLE(Context *context, + TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateTexStorage2DMultisample(Context *context, - GLenum target, + TextureType target, GLsizei samples, GLint internalFormat, GLsizei width, @@ -959,7 +987,7 @@ bool ValidateTexStorage2DMultisample(Context *context, return false; } - if (target != GL_TEXTURE_2D_MULTISAMPLE) + if (target != TextureType::_2DMultisample) { context->handleError(InvalidEnum() << "Target must be TEXTURE_2D_MULTISAMPLE."); return false; @@ -1047,8 +1075,10 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl } Framebuffer *framebuffer = context->getGLState().getDrawFramebuffer(); + GLint samples = 0; + ANGLE_VALIDATION_TRY(framebuffer->getSamples(context, &samples)); - if (index >= static_cast(framebuffer->getSamples(context))) + if (index >= static_cast(samples)) { context->handleError(InvalidValue() << "Index must be less than the value of SAMPLES."); return false; @@ -1057,6 +1087,17 @@ bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfl return true; } +bool ValidateGetMultisamplefvRobustANGLE(Context *context, + GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateFramebufferParameteri(Context *context, GLenum target, GLenum pname, GLint param) { if (context->getClientVersion() < ES_3_1) @@ -1167,6 +1208,17 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum p return true; } +bool ValidateGetFramebufferParameterivRobustANGLE(Context *context, + GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + bool ValidateGetProgramResourceIndex(Context *context, GLuint program, GLenum programInterface, @@ -1194,7 +1246,7 @@ bool ValidateGetProgramResourceIndex(Context *context, return true; } -bool ValidateBindVertexBuffer(ValidationContext *context, +bool ValidateBindVertexBuffer(Context *context, GLuint bindingIndex, GLuint buffer, GLintptr offset, @@ -1244,7 +1296,7 @@ bool ValidateBindVertexBuffer(ValidationContext *context, return true; } -bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingIndex, GLuint divisor) +bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint divisor) { if (context->getClientVersion() < ES_3_1) { @@ -1271,7 +1323,7 @@ bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingInde return true; } -bool ValidateVertexAttribFormat(ValidationContext *context, +bool ValidateVertexAttribFormat(Context *context, GLuint attribindex, GLint size, GLenum type, @@ -1282,7 +1334,7 @@ bool ValidateVertexAttribFormat(ValidationContext *context, false); } -bool ValidateVertexAttribIFormat(ValidationContext *context, +bool ValidateVertexAttribIFormat(Context *context, GLuint attribindex, GLint size, GLenum type, @@ -1291,9 +1343,7 @@ bool ValidateVertexAttribIFormat(ValidationContext *context, return ValidateVertexAttribFormatCommon(context, attribindex, size, type, relativeoffset, true); } -bool ValidateVertexAttribBinding(ValidationContext *context, - GLuint attribIndex, - GLuint bindingIndex) +bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bindingIndex) { if (context->getClientVersion() < ES_3_1) { @@ -1382,7 +1432,7 @@ bool ValidateDispatchCompute(Context *context, const State &state = context->getGLState(); Program *program = state.getProgram(); - if (program == nullptr || !program->hasLinkedComputeShader()) + if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveProgramWithComputeShader); return false; @@ -1425,7 +1475,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect) const State &state = context->getGLState(); Program *program = state.getProgram(); - if (program == nullptr || !program->hasLinkedComputeShader()) + if (program == nullptr || !program->hasLinkedShaderStage(ShaderType::Compute)) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), NoActiveProgramWithComputeShader); return false; @@ -1443,7 +1493,7 @@ bool ValidateDispatchComputeIndirect(Context *context, GLintptr indirect) return false; } - gl::Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect); + Buffer *dispatchIndirectBuffer = state.getTargetBuffer(BufferBinding::DispatchIndirect); if (!dispatchIndirectBuffer) { ANGLE_VALIDATION_ERR(context, InvalidOperation(), DispatchIndirectBufferNotBound); @@ -1693,6 +1743,18 @@ bool ValidateGetProgramInterfaceiv(Context *context, return true; } +bool ValidateGetProgramInterfaceivRobustANGLE(Context *context, + GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + UNIMPLEMENTED(); + return false; +} + static bool ValidateGenOrDeleteES31(Context *context, GLint n) { if (context->getClientVersion() < ES_3_1) @@ -1755,7 +1817,7 @@ bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint progr } bool ValidateCreateShaderProgramv(Context *context, - GLenum type, + ShaderType type, GLsizei count, const GLchar *const *strings) { diff --git a/gfx/angle/checkout/src/libANGLE/validationES31.h b/gfx/angle/checkout/src/libANGLE/validationES31.h index a0b76a5bcb16..e24f6d9855f8 100644 --- a/gfx/angle/checkout/src/libANGLE/validationES31.h +++ b/gfx/angle/checkout/src/libANGLE/validationES31.h @@ -9,12 +9,13 @@ #ifndef LIBANGLE_VALIDATION_ES31_H_ #define LIBANGLE_VALIDATION_ES31_H_ +#include "libANGLE/PackedGLEnums.h" + #include namespace gl { class Context; -class ValidationContext; bool ValidateGetBooleani_v(Context *context, GLenum target, GLuint index, GLboolean *data); bool ValidateGetBooleani_vRobustANGLE(Context *context, @@ -25,24 +26,44 @@ bool ValidateGetBooleani_vRobustANGLE(Context *context, GLboolean *data); bool ValidateGetTexLevelParameterfv(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLfloat *params); +bool ValidateGetTexLevelParameterfvRobustANGLE(Context *context, + TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); bool ValidateGetTexLevelParameteriv(Context *context, - GLenum target, + TextureTarget target, GLint level, GLenum pname, GLint *param); +bool ValidateGetTexLevelParameterivRobustANGLE(Context *context, + TextureTarget target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); bool ValidateTexStorage2DMultisample(Context *context, - GLenum target, + TextureType target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations); bool ValidateGetMultisamplefv(Context *context, GLenum pname, GLuint index, GLfloat *val); +bool ValidateGetMultisamplefvRobustANGLE(Context *context, + GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val); bool ValidateDrawIndirectBase(Context *context, GLenum mode, const void *indirect); bool ValidateDrawArraysIndirect(Context *context, GLenum mode, const void *indirect); @@ -228,6 +249,12 @@ bool ValidateGetFramebufferParameteriv(Context *context, GLenum target, GLenum pname, GLint *params); +bool ValidateGetFramebufferParameterivRobustANGLE(Context *context, + GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); bool ValidateGetProgramResourceIndex(Context *context, GLuint program, @@ -261,26 +288,31 @@ bool ValidateGetProgramInterfaceiv(Context *context, GLenum pname, GLint *params); -bool ValidateBindVertexBuffer(ValidationContext *context, +bool ValidateGetProgramInterfaceivRobustANGLE(Context *context, + GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +bool ValidateBindVertexBuffer(Context *context, GLuint bindingIndex, GLuint buffer, GLintptr offset, GLsizei stride); -bool ValidateVertexAttribFormat(ValidationContext *context, +bool ValidateVertexAttribFormat(Context *context, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -bool ValidateVertexAttribIFormat(ValidationContext *context, +bool ValidateVertexAttribIFormat(Context *context, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -bool ValidateVertexAttribBinding(ValidationContext *context, - GLuint attribIndex, - GLuint bindingIndex); -bool ValidateVertexBindingDivisor(ValidationContext *context, GLuint bindingIndex, GLuint divisor); +bool ValidateVertexAttribBinding(Context *context, GLuint attribIndex, GLuint bindingIndex); +bool ValidateVertexBindingDivisor(Context *context, GLuint bindingIndex, GLuint divisor); bool ValidateDispatchCompute(Context *context, GLuint numGroupsX, @@ -304,7 +336,7 @@ bool ValidateIsProgramPipeline(Context *context, GLuint pipeline); bool ValidateUseProgramStages(Context *context, GLuint pipeline, GLbitfield stages, GLuint program); bool ValidateActiveShaderProgram(Context *context, GLuint pipeline, GLuint program); bool ValidateCreateShaderProgramv(Context *context, - GLenum type, + ShaderType type, GLsizei count, const GLchar *const *strings); bool ValidateGetProgramPipelineiv(Context *context, GLuint pipeline, GLenum pname, GLint *params); diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp index db5afce1300d..2afbe07a8890 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_egl.cpp @@ -761,8 +761,9 @@ EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint b gl::Context *context = thread->getContext(); if (context) { - GLenum target = egl_gl::EGLTextureTargetToGLTextureTarget(eglSurface->getTextureTarget()); - gl::Texture *textureObject = context->getTargetTexture(target); + gl::TextureType type = + egl_gl::EGLTextureTargetToTextureType(eglSurface->getTextureTarget()); + gl::Texture *textureObject = context->getTargetTexture(type); ASSERT(textureObject != nullptr); if (textureObject->getImmutableFormat()) diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp index ebee629cc26c..beada99b95fa 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.cpp @@ -16,22 +16,6 @@ namespace gl { -void GL_APIENTRY ActiveTexture(GLenum texture) -{ - EVENT("(GLenum texture = 0x%X)", texture); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(texture); - - if (context->skipValidation() || ValidateActiveTexture(context, texture)) - { - context->activeTexture(texture); - } - } -} - void GL_APIENTRY AlphaFunc(GLenum func, GLfloat ref) { EVENT("(GLenum func = 0x%X, GLfloat ref = %f)", func, ref); @@ -39,11 +23,12 @@ void GL_APIENTRY AlphaFunc(GLenum func, GLfloat ref) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(func, ref); + AlphaTestFunc funcPacked = FromGLenum(func); + context->gatherParams(funcPacked, ref); - if (context->skipValidation() || ValidateAlphaFunc(context, func, ref)) + if (context->skipValidation() || ValidateAlphaFunc(context, funcPacked, ref)) { - context->alphaFunc(func, ref); + context->alphaFunc(funcPacked, ref); } } } @@ -55,136 +40,12 @@ void GL_APIENTRY AlphaFuncx(GLenum func, GLfixed ref) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(func, ref); + AlphaTestFunc funcPacked = FromGLenum(func); + context->gatherParams(funcPacked, ref); - if (context->skipValidation() || ValidateAlphaFuncx(context, func, ref)) + if (context->skipValidation() || ValidateAlphaFuncx(context, funcPacked, ref)) { - context->alphaFuncx(func, ref); - } - } -} - -void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer) -{ - EVENT("(GLenum target = 0x%X, GLuint buffer = %u)", target, buffer); - - Context *context = GetValidGlobalContext(); - if (context) - { - BufferBinding targetPacked = FromGLenum(target); - context->gatherParams(targetPacked, buffer); - - if (context->skipValidation() || ValidateBindBuffer(context, targetPacked, buffer)) - { - context->bindBuffer(targetPacked, buffer); - } - } -} - -void GL_APIENTRY BindTexture(GLenum target, GLuint texture) -{ - EVENT("(GLenum target = 0x%X, GLuint texture = %u)", target, texture); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, texture); - - if (context->skipValidation() || ValidateBindTexture(context, target, texture)) - { - context->bindTexture(target, texture); - } - } -} - -void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor) -{ - EVENT("(GLenum sfactor = 0x%X, GLenum dfactor = 0x%X)", sfactor, dfactor); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(sfactor, dfactor); - - if (context->skipValidation() || ValidateBlendFunc(context, sfactor, dfactor)) - { - context->blendFunc(sfactor, dfactor); - } - } -} - -void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) -{ - EVENT( - "(GLenum target = 0x%X, GLsizeiptr size = %d, const void *data = 0x%0.8p, GLenum usage = " - "0x%X)", - target, size, data, usage); - - Context *context = GetValidGlobalContext(); - if (context) - { - BufferBinding targetPacked = FromGLenum(target); - BufferUsage usagePacked = FromGLenum(usage); - context->gatherParams(targetPacked, size, data, usagePacked); - - if (context->skipValidation() || - ValidateBufferData(context, targetPacked, size, data, usagePacked)) - { - context->bufferData(targetPacked, size, data, usagePacked); - } - } -} - -void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data) -{ - EVENT( - "(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const void *data = " - "0x%0.8p)", - target, offset, size, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - BufferBinding targetPacked = FromGLenum(target); - context->gatherParams(targetPacked, offset, size, data); - - if (context->skipValidation() || - ValidateBufferSubData(context, targetPacked, offset, size, data)) - { - context->bufferSubData(targetPacked, offset, size, data); - } - } -} - -void GL_APIENTRY Clear(GLbitfield mask) -{ - EVENT("(GLbitfield mask = 0x%X)", mask); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(mask); - - if (context->skipValidation() || ValidateClear(context, mask)) - { - context->clear(mask); - } - } -} - -void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -{ - EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red, - green, blue, alpha); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(red, green, blue, alpha); - - if (context->skipValidation() || ValidateClearColor(context, red, green, blue, alpha)) - { - context->clearColor(red, green, blue, alpha); + context->alphaFuncx(funcPacked, ref); } } } @@ -206,22 +67,6 @@ void GL_APIENTRY ClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed a } } -void GL_APIENTRY ClearDepthf(GLfloat d) -{ - EVENT("(GLfloat d = %f)", d); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(d); - - if (context->skipValidation() || ValidateClearDepthf(context, d)) - { - context->clearDepthf(d); - } - } -} - void GL_APIENTRY ClearDepthx(GLfixed depth) { EVENT("(GLfixed depth = 0x%X)", depth); @@ -238,22 +83,6 @@ void GL_APIENTRY ClearDepthx(GLfixed depth) } } -void GL_APIENTRY ClearStencil(GLint s) -{ - EVENT("(GLint s = %d)", s); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(s); - - if (context->skipValidation() || ValidateClearStencil(context, s)) - { - context->clearStencil(s); - } - } -} - void GL_APIENTRY ClientActiveTexture(GLenum texture) { EVENT("(GLenum texture = 0x%X)", texture); @@ -353,23 +182,6 @@ void GL_APIENTRY Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha } } -void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -{ - EVENT("(GLboolean red = %u, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)", - red, green, blue, alpha); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(red, green, blue, alpha); - - if (context->skipValidation() || ValidateColorMask(context, red, green, blue, alpha)) - { - context->colorMask(red, green, blue, alpha); - } - } -} - void GL_APIENTRY ColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { EVENT( @@ -388,223 +200,6 @@ void GL_APIENTRY ColorPointer(GLint size, GLenum type, GLsizei stride, const voi } } -void GL_APIENTRY CompressedTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const void *data) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = " - "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const void *data = " - "0x%0.8p)", - target, level, internalformat, width, height, border, imageSize, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams( - target, level, internalformat, width, height, border, imageSize, data); - - if (context->skipValidation() || - ValidateCompressedTexImage2D(context, target, level, internalformat, width, height, - border, imageSize, data)) - { - context->compressedTexImage2D(target, level, internalformat, width, height, border, - imageSize, data); - } - } -} - -void GL_APIENTRY CompressedTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLsizei imageSize, - const void *data) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei " - "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, const void " - "*data = 0x%0.8p)", - target, level, xoffset, yoffset, width, height, format, imageSize, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams( - target, level, xoffset, yoffset, width, height, format, imageSize, data); - - if (context->skipValidation() || - ValidateCompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, height, - format, imageSize, data)) - { - context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, - imageSize, data); - } - } -} - -void GL_APIENTRY CopyTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLint x = %d, " - "GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)", - target, level, internalformat, x, y, width, height, border); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, level, internalformat, x, y, - width, height, border); - - if (context->skipValidation() || - ValidateCopyTexImage2D(context, target, level, internalformat, x, y, width, height, - border)) - { - context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); - } - } -} - -void GL_APIENTRY CopyTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x " - "= %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", - target, level, xoffset, yoffset, x, y, width, height); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, level, xoffset, yoffset, x, y, - width, height); - - if (context->skipValidation() || ValidateCopyTexSubImage2D(context, target, level, xoffset, - yoffset, x, y, width, height)) - { - context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); - } - } -} - -void GL_APIENTRY CullFace(GLenum mode) -{ - EVENT("(GLenum mode = 0x%X)", mode); - - Context *context = GetValidGlobalContext(); - if (context) - { - CullFaceMode modePacked = FromGLenum(mode); - context->gatherParams(modePacked); - - if (context->skipValidation() || ValidateCullFace(context, modePacked)) - { - context->cullFace(modePacked); - } - } -} - -void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers) -{ - EVENT("(GLsizei n = %d, const GLuint *buffers = 0x%0.8p)", n, buffers); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(n, buffers); - - if (context->skipValidation() || ValidateDeleteBuffers(context, n, buffers)) - { - context->deleteBuffers(n, buffers); - } - } -} - -void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures) -{ - EVENT("(GLsizei n = %d, const GLuint *textures = 0x%0.8p)", n, textures); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(n, textures); - - if (context->skipValidation() || ValidateDeleteTextures(context, n, textures)) - { - context->deleteTextures(n, textures); - } - } -} - -void GL_APIENTRY DepthFunc(GLenum func) -{ - EVENT("(GLenum func = 0x%X)", func); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(func); - - if (context->skipValidation() || ValidateDepthFunc(context, func)) - { - context->depthFunc(func); - } - } -} - -void GL_APIENTRY DepthMask(GLboolean flag) -{ - EVENT("(GLboolean flag = %u)", flag); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(flag); - - if (context->skipValidation() || ValidateDepthMask(context, flag)) - { - context->depthMask(flag); - } - } -} - -void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f) -{ - EVENT("(GLfloat n = %f, GLfloat f = %f)", n, f); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(n, f); - - if (context->skipValidation() || ValidateDepthRangef(context, n, f)) - { - context->depthRangef(n, f); - } - } -} - void GL_APIENTRY DepthRangex(GLfixed n, GLfixed f) { EVENT("(GLfixed n = 0x%X, GLfixed f = 0x%X)", n, f); @@ -621,22 +216,6 @@ void GL_APIENTRY DepthRangex(GLfixed n, GLfixed f) } } -void GL_APIENTRY Disable(GLenum cap) -{ - EVENT("(GLenum cap = 0x%X)", cap); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(cap); - - if (context->skipValidation() || ValidateDisable(context, cap)) - { - context->disable(cap); - } - } -} - void GL_APIENTRY DisableClientState(GLenum array) { EVENT("(GLenum array = 0x%X)", array); @@ -653,57 +232,6 @@ void GL_APIENTRY DisableClientState(GLenum array) } } -void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count) -{ - EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(mode, first, count); - - if (context->skipValidation() || ValidateDrawArrays(context, mode, first, count)) - { - context->drawArrays(mode, first, count); - } - } -} - -void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) -{ - EVENT( - "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = " - "0x%0.8p)", - mode, count, type, indices); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(mode, count, type, indices); - - if (context->skipValidation() || ValidateDrawElements(context, mode, count, type, indices)) - { - context->drawElements(mode, count, type, indices); - } - } -} - -void GL_APIENTRY Enable(GLenum cap) -{ - EVENT("(GLenum cap = 0x%X)", cap); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(cap); - - if (context->skipValidation() || ValidateEnable(context, cap)) - { - context->enable(cap); - } - } -} - void GL_APIENTRY EnableClientState(GLenum array) { EVENT("(GLenum array = 0x%X)", array); @@ -720,38 +248,6 @@ void GL_APIENTRY EnableClientState(GLenum array) } } -void GL_APIENTRY Finish() -{ - EVENT("()"); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(); - - if (context->skipValidation() || ValidateFinish(context)) - { - context->finish(); - } - } -} - -void GL_APIENTRY Flush() -{ - EVENT("()"); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(); - - if (context->skipValidation() || ValidateFlush(context)) - { - context->flush(); - } - } -} - void GL_APIENTRY Fogf(GLenum pname, GLfloat param) { EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param); @@ -816,22 +312,6 @@ void GL_APIENTRY Fogxv(GLenum pname, const GLfixed *param) } } -void GL_APIENTRY FrontFace(GLenum mode) -{ - EVENT("(GLenum mode = 0x%X)", mode); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(mode); - - if (context->skipValidation() || ValidateFrontFace(context, mode)) - { - context->frontFace(mode); - } - } -} - void GL_APIENTRY Frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { EVENT( @@ -870,73 +350,6 @@ void GL_APIENTRY Frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, } } -void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers) -{ - EVENT("(GLsizei n = %d, GLuint *buffers = 0x%0.8p)", n, buffers); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(n, buffers); - - if (context->skipValidation() || ValidateGenBuffers(context, n, buffers)) - { - context->genBuffers(n, buffers); - } - } -} - -void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures) -{ - EVENT("(GLsizei n = %d, GLuint *textures = 0x%0.8p)", n, textures); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(n, textures); - - if (context->skipValidation() || ValidateGenTextures(context, n, textures)) - { - context->genTextures(n, textures); - } - } -} - -void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data) -{ - EVENT("(GLenum pname = 0x%X, GLboolean *data = 0x%0.8p)", pname, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(pname, data); - - if (context->skipValidation() || ValidateGetBooleanv(context, pname, data)) - { - context->getBooleanv(pname, data); - } - } -} - -void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, - params); - - Context *context = GetValidGlobalContext(); - if (context) - { - BufferBinding targetPacked = FromGLenum(target); - context->gatherParams(targetPacked, pname, params); - - if (context->skipValidation() || - ValidateGetBufferParameteriv(context, targetPacked, pname, params)) - { - context->getBufferParameteriv(targetPacked, pname, params); - } - } -} - void GL_APIENTRY GetClipPlanef(GLenum plane, GLfloat *equation) { EVENT("(GLenum plane = 0x%X, GLfloat *equation = 0x%0.8p)", plane, equation); @@ -969,24 +382,6 @@ void GL_APIENTRY GetClipPlanex(GLenum plane, GLfixed *equation) } } -GLenum GL_APIENTRY GetError() -{ - EVENT("()"); - - Context *context = GetGlobalContext(); - if (context) - { - context->gatherParams(); - - if (context->skipValidation() || ValidateGetError(context)) - { - return context->getError(); - } - } - - return GetDefaultReturnValue(); -} - void GL_APIENTRY GetFixedv(GLenum pname, GLfixed *params) { EVENT("(GLenum pname = 0x%X, GLfixed *params = 0x%0.8p)", pname, params); @@ -1003,38 +398,6 @@ void GL_APIENTRY GetFixedv(GLenum pname, GLfixed *params) } } -void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data) -{ - EVENT("(GLenum pname = 0x%X, GLfloat *data = 0x%0.8p)", pname, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(pname, data); - - if (context->skipValidation() || ValidateGetFloatv(context, pname, data)) - { - context->getFloatv(pname, data); - } - } -} - -void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data) -{ - EVENT("(GLenum pname = 0x%X, GLint *data = 0x%0.8p)", pname, data); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(pname, data); - - if (context->skipValidation() || ValidateGetIntegerv(context, pname, data)) - { - context->getIntegerv(pname, data); - } - } -} - void GL_APIENTRY GetLightfv(GLenum light, GLenum pname, GLfloat *params) { EVENT("(GLenum light = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", light, pname, @@ -1119,24 +482,6 @@ void GL_APIENTRY GetPointerv(GLenum pname, void **params) } } -const GLubyte *GL_APIENTRY GetString(GLenum name) -{ - EVENT("(GLenum name = 0x%X)", name); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(name); - - if (context->skipValidation() || ValidateGetString(context, name)) - { - return context->getString(name); - } - } - - return GetDefaultReturnValue(); -} - void GL_APIENTRY GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params) { EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", target, pname, @@ -1188,40 +533,6 @@ void GL_APIENTRY GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params) } } -void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", target, pname, - params); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, params); - - if (context->skipValidation() || ValidateGetTexParameterfv(context, target, pname, params)) - { - context->getTexParameterfv(target, pname, params); - } - } -} - -void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, - params); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, params); - - if (context->skipValidation() || ValidateGetTexParameteriv(context, target, pname, params)) - { - context->getTexParameteriv(target, pname, params); - } - } -} - void GL_APIENTRY GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) { EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%0.8p)", target, pname, @@ -1230,85 +541,17 @@ void GL_APIENTRY GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, pname, params); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); - if (context->skipValidation() || ValidateGetTexParameterxv(context, target, pname, params)) + if (context->skipValidation() || + ValidateGetTexParameterxv(context, targetPacked, pname, params)) { - context->getTexParameterxv(target, pname, params); + context->getTexParameterxv(targetPacked, pname, params); } } } -void GL_APIENTRY Hint(GLenum target, GLenum mode) -{ - EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, mode); - - if (context->skipValidation() || ValidateHint(context, target, mode)) - { - context->hint(target, mode); - } - } -} - -GLboolean GL_APIENTRY IsBuffer(GLuint buffer) -{ - EVENT("(GLuint buffer = %u)", buffer); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(buffer); - - if (context->skipValidation() || ValidateIsBuffer(context, buffer)) - { - return context->isBuffer(buffer); - } - } - - return GetDefaultReturnValue(); -} - -GLboolean GL_APIENTRY IsEnabled(GLenum cap) -{ - EVENT("(GLenum cap = 0x%X)", cap); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(cap); - - if (context->skipValidation() || ValidateIsEnabled(context, cap)) - { - return context->isEnabled(cap); - } - } - - return GetDefaultReturnValue(); -} - -GLboolean GL_APIENTRY IsTexture(GLuint texture) -{ - EVENT("(GLuint texture = %u)", texture); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(texture); - - if (context->skipValidation() || ValidateIsTexture(context, texture)) - { - return context->isTexture(texture); - } - } - - return GetDefaultReturnValue(); -} - void GL_APIENTRY LightModelf(GLenum pname, GLfloat param) { EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param); @@ -1439,22 +682,6 @@ void GL_APIENTRY Lightxv(GLenum light, GLenum pname, const GLfixed *params) } } -void GL_APIENTRY LineWidth(GLfloat width) -{ - EVENT("(GLfloat width = %f)", width); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(width); - - if (context->skipValidation() || ValidateLineWidth(context, width)) - { - context->lineWidth(width); - } - } -} - void GL_APIENTRY LineWidthx(GLfixed width) { EVENT("(GLfixed width = 0x%X)", width); @@ -1608,11 +835,12 @@ void GL_APIENTRY MatrixMode(GLenum mode) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(mode); + MatrixType modePacked = FromGLenum(mode); + context->gatherParams(modePacked); - if (context->skipValidation() || ValidateMatrixMode(context, mode)) + if (context->skipValidation() || ValidateMatrixMode(context, modePacked)) { - context->matrixMode(mode); + context->matrixMode(modePacked); } } } @@ -1772,22 +1000,6 @@ void GL_APIENTRY Orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, G } } -void GL_APIENTRY PixelStorei(GLenum pname, GLint param) -{ - EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(pname, param); - - if (context->skipValidation() || ValidatePixelStorei(context, pname, param)) - { - context->pixelStorei(pname, param); - } - } -} - void GL_APIENTRY PointParameterf(GLenum pname, GLfloat param) { EVENT("(GLenum pname = 0x%X, GLfloat param = %f)", pname, param); @@ -1884,22 +1096,6 @@ void GL_APIENTRY PointSizex(GLfixed size) } } -void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units) -{ - EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(factor, units); - - if (context->skipValidation() || ValidatePolygonOffset(context, factor, units)) - { - context->polygonOffset(factor, units); - } - } -} - void GL_APIENTRY PolygonOffsetx(GLfixed factor, GLfixed units) { EVENT("(GLfixed factor = 0x%X, GLfixed units = 0x%X)", factor, units); @@ -1948,32 +1144,6 @@ void GL_APIENTRY PushMatrix() } } -void GL_APIENTRY ReadPixels(GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - void *pixels) -{ - EVENT( - "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = " - "0x%X, GLenum type = 0x%X, void *pixels = 0x%0.8p)", - x, y, width, height, format, type, pixels); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(x, y, width, height, format, type, pixels); - - if (context->skipValidation() || - ValidateReadPixels(context, x, y, width, height, format, type, pixels)) - { - context->readPixels(x, y, width, height, format, type, pixels); - } - } -} - void GL_APIENTRY Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { EVENT("(GLfloat angle = %f, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", angle, x, y, z); @@ -2007,22 +1177,6 @@ void GL_APIENTRY Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) } } -void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert) -{ - EVENT("(GLfloat value = %f, GLboolean invert = %u)", value, invert); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(value, invert); - - if (context->skipValidation() || ValidateSampleCoverage(context, value, invert)) - { - context->sampleCoverage(value, invert); - } - } -} - void GL_APIENTRY SampleCoveragex(GLclampx value, GLboolean invert) { EVENT("(GLclampx value = 0x%X, GLboolean invert = %u)", value, invert); @@ -2071,23 +1225,6 @@ void GL_APIENTRY Scalex(GLfixed x, GLfixed y, GLfixed z) } } -void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height) -{ - EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, - height); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(x, y, width, height); - - if (context->skipValidation() || ValidateScissor(context, x, y, width, height)) - { - context->scissor(x, y, width, height); - } - } -} - void GL_APIENTRY ShadeModel(GLenum mode) { EVENT("(GLenum mode = 0x%X)", mode); @@ -2104,54 +1241,6 @@ void GL_APIENTRY ShadeModel(GLenum mode) } } -void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask) -{ - EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(func, ref, mask); - - if (context->skipValidation() || ValidateStencilFunc(context, func, ref, mask)) - { - context->stencilFunc(func, ref, mask); - } - } -} - -void GL_APIENTRY StencilMask(GLuint mask) -{ - EVENT("(GLuint mask = %u)", mask); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(mask); - - if (context->skipValidation() || ValidateStencilMask(context, mask)) - { - context->stencilMask(mask); - } - } -} - -void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass) -{ - EVENT("(GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpass = 0x%X)", fail, zfail, zpass); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(fail, zfail, zpass); - - if (context->skipValidation() || ValidateStencilOp(context, fail, zfail, zpass)) - { - context->stencilOp(fail, zfail, zpass); - } - } -} - void GL_APIENTRY TexCoordPointer(GLint size, GLenum type, GLsizei stride, const void *pointer) { EVENT( @@ -2271,104 +1360,6 @@ void GL_APIENTRY TexEnvxv(GLenum target, GLenum pname, const GLfixed *params) } } -void GL_APIENTRY TexImage2D(GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const void *pixels) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " - "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const " - "void *pixels = 0x%0.8p)", - target, level, internalformat, width, height, border, format, type, pixels); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, level, internalformat, width, height, - border, format, type, pixels); - - if (context->skipValidation() || - ValidateTexImage2D(context, target, level, internalformat, width, height, border, - format, type, pixels)) - { - context->texImage2D(target, level, internalformat, width, height, border, format, type, - pixels); - } - } -} - -void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, param); - - if (context->skipValidation() || ValidateTexParameterf(context, target, pname, param)) - { - context->texParameterf(target, pname, param); - } - } -} - -void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%0.8p)", target, - pname, params); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, params); - - if (context->skipValidation() || ValidateTexParameterfv(context, target, pname, params)) - { - context->texParameterfv(target, pname, params); - } - } -} - -void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, param); - - if (context->skipValidation() || ValidateTexParameteri(context, target, pname, param)) - { - context->texParameteri(target, pname, param); - } - } -} - -void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params) -{ - EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%0.8p)", target, - pname, params); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, pname, params); - - if (context->skipValidation() || ValidateTexParameteriv(context, target, pname, params)) - { - context->texParameteriv(target, pname, params); - } - } -} - void GL_APIENTRY TexParameterx(GLenum target, GLenum pname, GLfixed param) { EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", target, pname, @@ -2377,11 +1368,12 @@ void GL_APIENTRY TexParameterx(GLenum target, GLenum pname, GLfixed param) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, pname, param); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, param); - if (context->skipValidation() || ValidateTexParameterx(context, target, pname, param)) + if (context->skipValidation() || ValidateTexParameterx(context, targetPacked, pname, param)) { - context->texParameterx(target, pname, param); + context->texParameterx(targetPacked, pname, param); } } } @@ -2394,43 +1386,13 @@ void GL_APIENTRY TexParameterxv(GLenum target, GLenum pname, const GLfixed *para Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, pname, params); - - if (context->skipValidation() || ValidateTexParameterxv(context, target, pname, params)) - { - context->texParameterxv(target, pname, params); - } - } -} - -void GL_APIENTRY TexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - const void *pixels) -{ - EVENT( - "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei " - "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, const void " - "*pixels = 0x%0.8p)", - target, level, xoffset, yoffset, width, height, format, type, pixels); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(target, level, xoffset, yoffset, width, - height, format, type, pixels); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); if (context->skipValidation() || - ValidateTexSubImage2D(context, target, level, xoffset, yoffset, width, height, format, - type, pixels)) + ValidateTexParameterxv(context, targetPacked, pname, params)) { - context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, - pixels); + context->texParameterxv(targetPacked, pname, params); } } } @@ -2485,21 +1447,4 @@ void GL_APIENTRY VertexPointer(GLint size, GLenum type, GLsizei stride, const vo } } } - -void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height) -{ - EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, - height); - - Context *context = GetValidGlobalContext(); - if (context) - { - context->gatherParams(x, y, width, height); - - if (context->skipValidation() || ValidateViewport(context, x, y, width, height)) - { - context->viewport(x, y, width, height); - } - } -} } // namespace gl diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h index a28ff8587e35..326483978199 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_1_0_autogen.h @@ -16,126 +16,43 @@ namespace gl { -ANGLE_EXPORT void GL_APIENTRY ActiveTexture(GLenum texture); ANGLE_EXPORT void GL_APIENTRY AlphaFunc(GLenum func, GLfloat ref); ANGLE_EXPORT void GL_APIENTRY AlphaFuncx(GLenum func, GLfixed ref); -ANGLE_EXPORT void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer); -ANGLE_EXPORT void GL_APIENTRY BindTexture(GLenum target, GLuint texture); -ANGLE_EXPORT void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor); -ANGLE_EXPORT void GL_APIENTRY BufferData(GLenum target, - GLsizeiptr size, - const void *data, - GLenum usage); -ANGLE_EXPORT void GL_APIENTRY BufferSubData(GLenum target, - GLintptr offset, - GLsizeiptr size, - const void *data); -ANGLE_EXPORT void GL_APIENTRY Clear(GLbitfield mask); -ANGLE_EXPORT void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); ANGLE_EXPORT void GL_APIENTRY ClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -ANGLE_EXPORT void GL_APIENTRY ClearDepthf(GLfloat d); ANGLE_EXPORT void GL_APIENTRY ClearDepthx(GLfixed depth); -ANGLE_EXPORT void GL_APIENTRY ClearStencil(GLint s); ANGLE_EXPORT void GL_APIENTRY ClientActiveTexture(GLenum texture); ANGLE_EXPORT void GL_APIENTRY ClipPlanef(GLenum p, const GLfloat *eqn); ANGLE_EXPORT void GL_APIENTRY ClipPlanex(GLenum plane, const GLfixed *equation); ANGLE_EXPORT void GL_APIENTRY Color4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); ANGLE_EXPORT void GL_APIENTRY Color4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); ANGLE_EXPORT void GL_APIENTRY Color4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -ANGLE_EXPORT void GL_APIENTRY ColorMask(GLboolean red, - GLboolean green, - GLboolean blue, - GLboolean alpha); ANGLE_EXPORT void GL_APIENTRY ColorPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); -ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const void *data); -ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLsizei imageSize, - const void *data); -ANGLE_EXPORT void GL_APIENTRY CopyTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLint border); -ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLint x, - GLint y, - GLsizei width, - GLsizei height); -ANGLE_EXPORT void GL_APIENTRY CullFace(GLenum mode); -ANGLE_EXPORT void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers); -ANGLE_EXPORT void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures); -ANGLE_EXPORT void GL_APIENTRY DepthFunc(GLenum func); -ANGLE_EXPORT void GL_APIENTRY DepthMask(GLboolean flag); -ANGLE_EXPORT void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f); ANGLE_EXPORT void GL_APIENTRY DepthRangex(GLfixed n, GLfixed f); -ANGLE_EXPORT void GL_APIENTRY Disable(GLenum cap); ANGLE_EXPORT void GL_APIENTRY DisableClientState(GLenum array); -ANGLE_EXPORT void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count); -ANGLE_EXPORT void GL_APIENTRY DrawElements(GLenum mode, - GLsizei count, - GLenum type, - const void *indices); -ANGLE_EXPORT void GL_APIENTRY Enable(GLenum cap); ANGLE_EXPORT void GL_APIENTRY EnableClientState(GLenum array); -ANGLE_EXPORT void GL_APIENTRY Finish(); -ANGLE_EXPORT void GL_APIENTRY Flush(); ANGLE_EXPORT void GL_APIENTRY Fogf(GLenum pname, GLfloat param); ANGLE_EXPORT void GL_APIENTRY Fogfv(GLenum pname, const GLfloat *params); ANGLE_EXPORT void GL_APIENTRY Fogx(GLenum pname, GLfixed param); ANGLE_EXPORT void GL_APIENTRY Fogxv(GLenum pname, const GLfixed *param); -ANGLE_EXPORT void GL_APIENTRY FrontFace(GLenum mode); ANGLE_EXPORT void GL_APIENTRY Frustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); ANGLE_EXPORT void GL_APIENTRY Frustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -ANGLE_EXPORT void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers); -ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures); -ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data); -ANGLE_EXPORT void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params); ANGLE_EXPORT void GL_APIENTRY GetClipPlanef(GLenum plane, GLfloat *equation); ANGLE_EXPORT void GL_APIENTRY GetClipPlanex(GLenum plane, GLfixed *equation); -ANGLE_EXPORT GLenum GL_APIENTRY GetError(); ANGLE_EXPORT void GL_APIENTRY GetFixedv(GLenum pname, GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data); -ANGLE_EXPORT void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data); ANGLE_EXPORT void GL_APIENTRY GetLightfv(GLenum light, GLenum pname, GLfloat *params); ANGLE_EXPORT void GL_APIENTRY GetLightxv(GLenum light, GLenum pname, GLfixed *params); ANGLE_EXPORT void GL_APIENTRY GetMaterialfv(GLenum face, GLenum pname, GLfloat *params); ANGLE_EXPORT void GL_APIENTRY GetMaterialxv(GLenum face, GLenum pname, GLfixed *params); ANGLE_EXPORT void GL_APIENTRY GetPointerv(GLenum pname, void **params); -ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name); ANGLE_EXPORT void GL_APIENTRY GetTexEnvfv(GLenum target, GLenum pname, GLfloat *params); ANGLE_EXPORT void GL_APIENTRY GetTexEnviv(GLenum target, GLenum pname, GLint *params); ANGLE_EXPORT void GL_APIENTRY GetTexEnvxv(GLenum target, GLenum pname, GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); -ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params); ANGLE_EXPORT void GL_APIENTRY GetTexParameterxv(GLenum target, GLenum pname, GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode); -ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer); -ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap); -ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture); ANGLE_EXPORT void GL_APIENTRY LightModelf(GLenum pname, GLfloat param); ANGLE_EXPORT void GL_APIENTRY LightModelfv(GLenum pname, const GLfloat *params); ANGLE_EXPORT void GL_APIENTRY LightModelx(GLenum pname, GLfixed param); @@ -144,7 +61,6 @@ ANGLE_EXPORT void GL_APIENTRY Lightf(GLenum light, GLenum pname, GLfloat param); ANGLE_EXPORT void GL_APIENTRY Lightfv(GLenum light, GLenum pname, const GLfloat *params); ANGLE_EXPORT void GL_APIENTRY Lightx(GLenum light, GLenum pname, GLfixed param); ANGLE_EXPORT void GL_APIENTRY Lightxv(GLenum light, GLenum pname, const GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width); ANGLE_EXPORT void GL_APIENTRY LineWidthx(GLfixed width); ANGLE_EXPORT void GL_APIENTRY LoadIdentity(); ANGLE_EXPORT void GL_APIENTRY LoadMatrixf(const GLfloat *m); @@ -168,35 +84,21 @@ ANGLE_EXPORT void GL_APIENTRY Orthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); ANGLE_EXPORT void GL_APIENTRY Orthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param); ANGLE_EXPORT void GL_APIENTRY PointParameterf(GLenum pname, GLfloat param); ANGLE_EXPORT void GL_APIENTRY PointParameterfv(GLenum pname, const GLfloat *params); ANGLE_EXPORT void GL_APIENTRY PointParameterx(GLenum pname, GLfixed param); ANGLE_EXPORT void GL_APIENTRY PointParameterxv(GLenum pname, const GLfixed *params); ANGLE_EXPORT void GL_APIENTRY PointSize(GLfloat size); ANGLE_EXPORT void GL_APIENTRY PointSizex(GLfixed size); -ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units); ANGLE_EXPORT void GL_APIENTRY PolygonOffsetx(GLfixed factor, GLfixed units); ANGLE_EXPORT void GL_APIENTRY PopMatrix(); ANGLE_EXPORT void GL_APIENTRY PushMatrix(); -ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x, - GLint y, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - void *pixels); ANGLE_EXPORT void GL_APIENTRY Rotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); ANGLE_EXPORT void GL_APIENTRY Rotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -ANGLE_EXPORT void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert); ANGLE_EXPORT void GL_APIENTRY SampleCoveragex(GLclampx value, GLboolean invert); ANGLE_EXPORT void GL_APIENTRY Scalef(GLfloat x, GLfloat y, GLfloat z); ANGLE_EXPORT void GL_APIENTRY Scalex(GLfixed x, GLfixed y, GLfixed z); -ANGLE_EXPORT void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height); ANGLE_EXPORT void GL_APIENTRY ShadeModel(GLenum mode); -ANGLE_EXPORT void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask); -ANGLE_EXPORT void GL_APIENTRY StencilMask(GLuint mask); -ANGLE_EXPORT void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass); ANGLE_EXPORT void GL_APIENTRY TexCoordPointer(GLint size, GLenum type, GLsizei stride, @@ -207,37 +109,14 @@ ANGLE_EXPORT void GL_APIENTRY TexEnvi(GLenum target, GLenum pname, GLint param); ANGLE_EXPORT void GL_APIENTRY TexEnviv(GLenum target, GLenum pname, const GLint *params); ANGLE_EXPORT void GL_APIENTRY TexEnvx(GLenum target, GLenum pname, GLfixed param); ANGLE_EXPORT void GL_APIENTRY TexEnvxv(GLenum target, GLenum pname, const GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY TexImage2D(GLenum target, - GLint level, - GLint internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLenum format, - GLenum type, - const void *pixels); -ANGLE_EXPORT void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param); -ANGLE_EXPORT void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params); -ANGLE_EXPORT void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param); -ANGLE_EXPORT void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params); ANGLE_EXPORT void GL_APIENTRY TexParameterx(GLenum target, GLenum pname, GLfixed param); ANGLE_EXPORT void GL_APIENTRY TexParameterxv(GLenum target, GLenum pname, const GLfixed *params); -ANGLE_EXPORT void GL_APIENTRY TexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLenum type, - const void *pixels); ANGLE_EXPORT void GL_APIENTRY Translatef(GLfloat x, GLfloat y, GLfloat z); ANGLE_EXPORT void GL_APIENTRY Translatex(GLfixed x, GLfixed y, GLfixed z); ANGLE_EXPORT void GL_APIENTRY VertexPointer(GLint size, GLenum type, GLsizei stride, const void *pointer); -ANGLE_EXPORT void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height); } // namespace gl #endif // LIBGLESV2_ENTRY_POINTS_GLES_1_0_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp index 3b566a3b9c4a..30d0574d87da 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.cpp @@ -16,6 +16,22 @@ namespace gl { +void GL_APIENTRY ActiveTexture(GLenum texture) +{ + EVENT("(GLenum texture = 0x%X)", texture); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(texture); + + if (context->skipValidation() || ValidateActiveTexture(context, texture)) + { + context->activeTexture(texture); + } + } +} + void GL_APIENTRY AttachShader(GLuint program, GLuint shader) { EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader); @@ -49,6 +65,23 @@ void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar * } } +void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer) +{ + EVENT("(GLenum target = 0x%X, GLuint buffer = %u)", target, buffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + BufferBinding targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, buffer); + + if (context->skipValidation() || ValidateBindBuffer(context, targetPacked, buffer)) + { + context->bindBuffer(targetPacked, buffer); + } + } +} + void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer) { EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer); @@ -81,6 +114,23 @@ void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer) } } +void GL_APIENTRY BindTexture(GLenum target, GLuint texture) +{ + EVENT("(GLenum target = 0x%X, GLuint texture = %u)", target, texture); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, texture); + + if (context->skipValidation() || ValidateBindTexture(context, targetPacked, texture)) + { + context->bindTexture(targetPacked, texture); + } + } +} + void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red, @@ -130,6 +180,22 @@ void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) } } +void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor) +{ + EVENT("(GLenum sfactor = 0x%X, GLenum dfactor = 0x%X)", sfactor, dfactor); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(sfactor, dfactor); + + if (context->skipValidation() || ValidateBlendFunc(context, sfactor, dfactor)) + { + context->blendFunc(sfactor, dfactor); + } + } +} + void GL_APIENTRY BlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, @@ -154,6 +220,49 @@ void GL_APIENTRY BlendFuncSeparate(GLenum sfactorRGB, } } +void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const void *data, GLenum usage) +{ + EVENT( + "(GLenum target = 0x%X, GLsizeiptr size = %d, const void *data = 0x%0.8p, GLenum usage = " + "0x%X)", + target, size, data, usage); + + Context *context = GetValidGlobalContext(); + if (context) + { + BufferBinding targetPacked = FromGLenum(target); + BufferUsage usagePacked = FromGLenum(usage); + context->gatherParams(targetPacked, size, data, usagePacked); + + if (context->skipValidation() || + ValidateBufferData(context, targetPacked, size, data, usagePacked)) + { + context->bufferData(targetPacked, size, data, usagePacked); + } + } +} + +void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void *data) +{ + EVENT( + "(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const void *data = " + "0x%0.8p)", + target, offset, size, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + BufferBinding targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, offset, size, data); + + if (context->skipValidation() || + ValidateBufferSubData(context, targetPacked, offset, size, data)) + { + context->bufferSubData(targetPacked, offset, size, data); + } + } +} + GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target) { EVENT("(GLenum target = 0x%X)", target); @@ -172,6 +281,88 @@ GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target) return GetDefaultReturnValue(); } +void GL_APIENTRY Clear(GLbitfield mask) +{ + EVENT("(GLbitfield mask = 0x%X)", mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(mask); + + if (context->skipValidation() || ValidateClear(context, mask)) + { + context->clear(mask); + } + } +} + +void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + EVENT("(GLfloat red = %f, GLfloat green = %f, GLfloat blue = %f, GLfloat alpha = %f)", red, + green, blue, alpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(red, green, blue, alpha); + + if (context->skipValidation() || ValidateClearColor(context, red, green, blue, alpha)) + { + context->clearColor(red, green, blue, alpha); + } + } +} + +void GL_APIENTRY ClearDepthf(GLfloat d) +{ + EVENT("(GLfloat d = %f)", d); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(d); + + if (context->skipValidation() || ValidateClearDepthf(context, d)) + { + context->clearDepthf(d); + } + } +} + +void GL_APIENTRY ClearStencil(GLint s) +{ + EVENT("(GLint s = %d)", s); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(s); + + if (context->skipValidation() || ValidateClearStencil(context, s)) + { + context->clearStencil(s); + } + } +} + +void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + EVENT("(GLboolean red = %u, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)", + red, green, blue, alpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(red, green, blue, alpha); + + if (context->skipValidation() || ValidateColorMask(context, red, green, blue, alpha)) + { + context->colorMask(red, green, blue, alpha); + } + } +} + void GL_APIENTRY CompileShader(GLuint shader) { EVENT("(GLuint shader = %u)", shader); @@ -188,6 +379,132 @@ void GL_APIENTRY CompileShader(GLuint shader) } } +void GL_APIENTRY CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void *data) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = " + "%d, GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const void *data = " + "0x%0.8p)", + target, level, internalformat, width, height, border, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams( + targetPacked, level, internalformat, width, height, border, imageSize, data); + + if (context->skipValidation() || + ValidateCompressedTexImage2D(context, targetPacked, level, internalformat, width, + height, border, imageSize, data)) + { + context->compressedTexImage2D(targetPacked, level, internalformat, width, height, + border, imageSize, data); + } + } +} + +void GL_APIENTRY CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void *data) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei " + "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLsizei imageSize = %d, const void " + "*data = 0x%0.8p)", + target, level, xoffset, yoffset, width, height, format, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams( + targetPacked, level, xoffset, yoffset, width, height, format, imageSize, data); + + if (context->skipValidation() || + ValidateCompressedTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width, + height, format, imageSize, data)) + { + context->compressedTexSubImage2D(targetPacked, level, xoffset, yoffset, width, height, + format, imageSize, data); + } + } +} + +void GL_APIENTRY CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLint x = %d, " + "GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)", + target, level, internalformat, x, y, width, height, border); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, internalformat, x, y, + width, height, border); + + if (context->skipValidation() || + ValidateCopyTexImage2D(context, targetPacked, level, internalformat, x, y, width, + height, border)) + { + context->copyTexImage2D(targetPacked, level, internalformat, x, y, width, height, + border); + } + } +} + +void GL_APIENTRY CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLint x " + "= %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", + target, level, xoffset, yoffset, x, y, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, xoffset, yoffset, + x, y, width, height); + + if (context->skipValidation() || + ValidateCopyTexSubImage2D(context, targetPacked, level, xoffset, yoffset, x, y, width, + height)) + { + context->copyTexSubImage2D(targetPacked, level, xoffset, yoffset, x, y, width, height); + } + } +} + GLuint GL_APIENTRY CreateProgram() { EVENT("()"); @@ -213,17 +530,51 @@ GLuint GL_APIENTRY CreateShader(GLenum type) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(type); + ShaderType typePacked = FromGLenum(type); + context->gatherParams(typePacked); - if (context->skipValidation() || ValidateCreateShader(context, type)) + if (context->skipValidation() || ValidateCreateShader(context, typePacked)) { - return context->createShader(type); + return context->createShader(typePacked); } } return GetDefaultReturnValue(); } +void GL_APIENTRY CullFace(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + CullFaceMode modePacked = FromGLenum(mode); + context->gatherParams(modePacked); + + if (context->skipValidation() || ValidateCullFace(context, modePacked)) + { + context->cullFace(modePacked); + } + } +} + +void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers) +{ + EVENT("(GLsizei n = %d, const GLuint *buffers = 0x%0.8p)", n, buffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, buffers); + + if (context->skipValidation() || ValidateDeleteBuffers(context, n, buffers)) + { + context->deleteBuffers(n, buffers); + } + } +} + void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint *framebuffers) { EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%0.8p)", n, framebuffers); @@ -288,6 +639,70 @@ void GL_APIENTRY DeleteShader(GLuint shader) } } +void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures) +{ + EVENT("(GLsizei n = %d, const GLuint *textures = 0x%0.8p)", n, textures); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, textures); + + if (context->skipValidation() || ValidateDeleteTextures(context, n, textures)) + { + context->deleteTextures(n, textures); + } + } +} + +void GL_APIENTRY DepthFunc(GLenum func) +{ + EVENT("(GLenum func = 0x%X)", func); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(func); + + if (context->skipValidation() || ValidateDepthFunc(context, func)) + { + context->depthFunc(func); + } + } +} + +void GL_APIENTRY DepthMask(GLboolean flag) +{ + EVENT("(GLboolean flag = %u)", flag); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(flag); + + if (context->skipValidation() || ValidateDepthMask(context, flag)) + { + context->depthMask(flag); + } + } +} + +void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f) +{ + EVENT("(GLfloat n = %f, GLfloat f = %f)", n, f); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, f); + + if (context->skipValidation() || ValidateDepthRangef(context, n, f)) + { + context->depthRangef(n, f); + } + } +} + void GL_APIENTRY DetachShader(GLuint program, GLuint shader) { EVENT("(GLuint program = %u, GLuint shader = %u)", program, shader); @@ -304,6 +719,22 @@ void GL_APIENTRY DetachShader(GLuint program, GLuint shader) } } +void GL_APIENTRY Disable(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(cap); + + if (context->skipValidation() || ValidateDisable(context, cap)) + { + context->disable(cap); + } + } +} + void GL_APIENTRY DisableVertexAttribArray(GLuint index) { EVENT("(GLuint index = %u)", index); @@ -320,6 +751,57 @@ void GL_APIENTRY DisableVertexAttribArray(GLuint index) } } +void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count) +{ + EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(mode, first, count); + + if (context->skipValidation() || ValidateDrawArrays(context, mode, first, count)) + { + context->drawArrays(mode, first, count); + } + } +} + +void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const void *indices) +{ + EVENT( + "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = " + "0x%0.8p)", + mode, count, type, indices); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(mode, count, type, indices); + + if (context->skipValidation() || ValidateDrawElements(context, mode, count, type, indices)) + { + context->drawElements(mode, count, type, indices); + } + } +} + +void GL_APIENTRY Enable(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(cap); + + if (context->skipValidation() || ValidateEnable(context, cap)) + { + context->enable(cap); + } + } +} + void GL_APIENTRY EnableVertexAttribArray(GLuint index) { EVENT("(GLuint index = %u)", index); @@ -336,6 +818,38 @@ void GL_APIENTRY EnableVertexAttribArray(GLuint index) } } +void GL_APIENTRY Finish() +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(); + + if (context->skipValidation() || ValidateFinish(context)) + { + context->finish(); + } + } +} + +void GL_APIENTRY Flush() +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(); + + if (context->skipValidation() || ValidateFlush(context)) + { + context->flush(); + } + } +} + void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, @@ -375,13 +889,47 @@ void GL_APIENTRY FramebufferTexture2D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, attachment, textarget, + TextureTarget textargetPacked = FromGLenum(textarget); + context->gatherParams(target, attachment, textargetPacked, texture, level); if (context->skipValidation() || - ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) + ValidateFramebufferTexture2D(context, target, attachment, textargetPacked, texture, + level)) { - context->framebufferTexture2D(target, attachment, textarget, texture, level); + context->framebufferTexture2D(target, attachment, textargetPacked, texture, level); + } + } +} + +void GL_APIENTRY FrontFace(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(mode); + + if (context->skipValidation() || ValidateFrontFace(context, mode)) + { + context->frontFace(mode); + } + } +} + +void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers) +{ + EVENT("(GLsizei n = %d, GLuint *buffers = 0x%0.8p)", n, buffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, buffers); + + if (context->skipValidation() || ValidateGenBuffers(context, n, buffers)) + { + context->genBuffers(n, buffers); } } } @@ -418,6 +966,22 @@ void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint *renderbuffers) } } +void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures) +{ + EVENT("(GLsizei n = %d, GLuint *textures = 0x%0.8p)", n, textures); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, textures); + + if (context->skipValidation() || ValidateGenTextures(context, n, textures)) + { + context->genTextures(n, textures); + } + } +} + void GL_APIENTRY GenerateMipmap(GLenum target) { EVENT("(GLenum target = 0x%X)", target); @@ -425,11 +989,12 @@ void GL_APIENTRY GenerateMipmap(GLenum target) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked); - if (context->skipValidation() || ValidateGenerateMipmap(context, target)) + if (context->skipValidation() || ValidateGenerateMipmap(context, targetPacked)) { - context->generateMipmap(target); + context->generateMipmap(targetPacked); } } } @@ -529,6 +1094,75 @@ GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar *name) return GetDefaultReturnValue(); } +void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data) +{ + EVENT("(GLenum pname = 0x%X, GLboolean *data = 0x%0.8p)", pname, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(pname, data); + + if (context->skipValidation() || ValidateGetBooleanv(context, pname, data)) + { + context->getBooleanv(pname, data); + } + } +} + +void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + BufferBinding targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); + + if (context->skipValidation() || + ValidateGetBufferParameteriv(context, targetPacked, pname, params)) + { + context->getBufferParameteriv(targetPacked, pname, params); + } + } +} + +GLenum GL_APIENTRY GetError() +{ + EVENT("()"); + + Context *context = GetGlobalContext(); + if (context) + { + context->gatherParams(); + + if (context->skipValidation() || ValidateGetError(context)) + { + return context->getError(); + } + } + + return GetDefaultReturnValue(); +} + +void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data) +{ + EVENT("(GLenum pname = 0x%X, GLfloat *data = 0x%0.8p)", pname, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(pname, data); + + if (context->skipValidation() || ValidateGetFloatv(context, pname, data)) + { + context->getFloatv(pname, data); + } + } +} + void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, @@ -553,6 +1187,22 @@ void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, } } +void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data) +{ + EVENT("(GLenum pname = 0x%X, GLint *data = 0x%0.8p)", pname, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(pname, data); + + if (context->skipValidation() || ValidateGetIntegerv(context, pname, data)) + { + context->getIntegerv(pname, data); + } + } +} + void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, @@ -692,6 +1342,62 @@ void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params) } } +const GLubyte *GL_APIENTRY GetString(GLenum name) +{ + EVENT("(GLenum name = 0x%X)", name); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(name); + + if (context->skipValidation() || ValidateGetString(context, name)) + { + return context->getString(name); + } + } + + return GetDefaultReturnValue(); +} + +void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); + + if (context->skipValidation() || + ValidateGetTexParameterfv(context, targetPacked, pname, params)) + { + context->getTexParameterfv(targetPacked, pname, params); + } + } +} + +void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); + + if (context->skipValidation() || + ValidateGetTexParameteriv(context, targetPacked, pname, params)) + { + context->getTexParameteriv(targetPacked, pname, params); + } + } +} + GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name) { EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", program, name); @@ -796,6 +1502,58 @@ void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint *params) } } +void GL_APIENTRY Hint(GLenum target, GLenum mode) +{ + EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target, mode); + + if (context->skipValidation() || ValidateHint(context, target, mode)) + { + context->hint(target, mode); + } + } +} + +GLboolean GL_APIENTRY IsBuffer(GLuint buffer) +{ + EVENT("(GLuint buffer = %u)", buffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(buffer); + + if (context->skipValidation() || ValidateIsBuffer(context, buffer)) + { + return context->isBuffer(buffer); + } + } + + return GetDefaultReturnValue(); +} + +GLboolean GL_APIENTRY IsEnabled(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(cap); + + if (context->skipValidation() || ValidateIsEnabled(context, cap)) + { + return context->isEnabled(cap); + } + } + + return GetDefaultReturnValue(); +} + GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer) { EVENT("(GLuint framebuffer = %u)", framebuffer); @@ -868,6 +1626,40 @@ GLboolean GL_APIENTRY IsShader(GLuint shader) return GetDefaultReturnValue(); } +GLboolean GL_APIENTRY IsTexture(GLuint texture) +{ + EVENT("(GLuint texture = %u)", texture); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(texture); + + if (context->skipValidation() || ValidateIsTexture(context, texture)) + { + return context->isTexture(texture); + } + } + + return GetDefaultReturnValue(); +} + +void GL_APIENTRY LineWidth(GLfloat width) +{ + EVENT("(GLfloat width = %f)", width); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(width); + + if (context->skipValidation() || ValidateLineWidth(context, width)) + { + context->lineWidth(width); + } + } +} + void GL_APIENTRY LinkProgram(GLuint program) { EVENT("(GLuint program = %u)", program); @@ -884,6 +1676,64 @@ void GL_APIENTRY LinkProgram(GLuint program) } } +void GL_APIENTRY PixelStorei(GLenum pname, GLint param) +{ + EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(pname, param); + + if (context->skipValidation() || ValidatePixelStorei(context, pname, param)) + { + context->pixelStorei(pname, param); + } + } +} + +void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units) +{ + EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(factor, units); + + if (context->skipValidation() || ValidatePolygonOffset(context, factor, units)) + { + context->polygonOffset(factor, units); + } + } +} + +void GL_APIENTRY ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void *pixels) +{ + EVENT( + "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLenum format = " + "0x%X, GLenum type = 0x%X, void *pixels = 0x%0.8p)", + x, y, width, height, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(x, y, width, height, format, type, pixels); + + if (context->skipValidation() || + ValidateReadPixels(context, x, y, width, height, format, type, pixels)) + { + context->readPixels(x, y, width, height, format, type, pixels); + } + } +} + void GL_APIENTRY ReleaseShaderCompiler() { EVENT("()"); @@ -924,6 +1774,39 @@ void GL_APIENTRY RenderbufferStorage(GLenum target, } } +void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert) +{ + EVENT("(GLfloat value = %f, GLboolean invert = %u)", value, invert); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(value, invert); + + if (context->skipValidation() || ValidateSampleCoverage(context, value, invert)) + { + context->sampleCoverage(value, invert); + } + } +} + +void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, + height); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(x, y, width, height); + + if (context->skipValidation() || ValidateScissor(context, x, y, width, height)) + { + context->scissor(x, y, width, height); + } + } +} + void GL_APIENTRY ShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, @@ -972,6 +1855,22 @@ void GL_APIENTRY ShaderSource(GLuint shader, } } +void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask) +{ + EVENT("(GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", func, ref, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(func, ref, mask); + + if (context->skipValidation() || ValidateStencilFunc(context, func, ref, mask)) + { + context->stencilFunc(func, ref, mask); + } + } +} + void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %u)", face, func, @@ -990,6 +1889,22 @@ void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint } } +void GL_APIENTRY StencilMask(GLuint mask) +{ + EVENT("(GLuint mask = %u)", mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(mask); + + if (context->skipValidation() || ValidateStencilMask(context, mask)) + { + context->stencilMask(mask); + } + } +} + void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask) { EVENT("(GLenum face = 0x%X, GLuint mask = %u)", face, mask); @@ -1006,6 +1921,22 @@ void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask) } } +void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ + EVENT("(GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpass = 0x%X)", fail, zfail, zpass); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(fail, zfail, zpass); + + if (context->skipValidation() || ValidateStencilOp(context, fail, zfail, zpass)) + { + context->stencilOp(fail, zfail, zpass); + } + } +} + void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) { EVENT("(GLenum face = 0x%X, GLenum sfail = 0x%X, GLenum dpfail = 0x%X, GLenum dppass = 0x%X)", @@ -1024,6 +1955,144 @@ void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLe } } +void GL_APIENTRY TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " + "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const " + "void *pixels = 0x%0.8p)", + target, level, internalformat, width, height, border, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, internalformat, width, + height, border, format, type, pixels); + + if (context->skipValidation() || + ValidateTexImage2D(context, targetPacked, level, internalformat, width, height, border, + format, type, pixels)) + { + context->texImage2D(targetPacked, level, internalformat, width, height, border, format, + type, pixels); + } + } +} + +void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, param); + + if (context->skipValidation() || ValidateTexParameterf(context, targetPacked, pname, param)) + { + context->texParameterf(targetPacked, pname, param); + } + } +} + +void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%0.8p)", target, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); + + if (context->skipValidation() || + ValidateTexParameterfv(context, targetPacked, pname, params)) + { + context->texParameterfv(targetPacked, pname, params); + } + } +} + +void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, param); + + if (context->skipValidation() || ValidateTexParameteri(context, targetPacked, pname, param)) + { + context->texParameteri(targetPacked, pname, param); + } + } +} + +void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%0.8p)", target, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, pname, params); + + if (context->skipValidation() || + ValidateTexParameteriv(context, targetPacked, pname, params)) + { + context->texParameteriv(targetPacked, pname, params); + } + } +} + +void GL_APIENTRY TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, GLsizei " + "width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, const void " + "*pixels = 0x%0.8p)", + target, level, xoffset, yoffset, width, height, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, xoffset, yoffset, + width, height, format, type, pixels); + + if (context->skipValidation() || + ValidateTexSubImage2D(context, targetPacked, level, xoffset, yoffset, width, height, + format, type, pixels)) + { + context->texSubImage2D(targetPacked, level, xoffset, yoffset, width, height, format, + type, pixels); + } + } +} + void GL_APIENTRY Uniform1f(GLint location, GLfloat v0) { EVENT("(GLint location = %d, GLfloat v0 = %f)", location, v0); @@ -1548,4 +2617,21 @@ void GL_APIENTRY VertexAttribPointer(GLuint index, } } } + +void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, + height); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(x, y, width, height); + + if (context->skipValidation() || ValidateViewport(context, x, y, width, height)) + { + context->viewport(x, y, width, height); + } + } +} } // namespace gl diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h index 8cd776d01ff3..bfecd80c3ddc 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_autogen.h @@ -16,28 +16,96 @@ namespace gl { +ANGLE_EXPORT void GL_APIENTRY ActiveTexture(GLenum texture); ANGLE_EXPORT void GL_APIENTRY AttachShader(GLuint program, GLuint shader); ANGLE_EXPORT void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer); ANGLE_EXPORT void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer); ANGLE_EXPORT void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer); +ANGLE_EXPORT void GL_APIENTRY BindTexture(GLenum target, GLuint texture); ANGLE_EXPORT void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); ANGLE_EXPORT void GL_APIENTRY BlendEquation(GLenum mode); ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); +ANGLE_EXPORT void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor); ANGLE_EXPORT void GL_APIENTRY BlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); +ANGLE_EXPORT void GL_APIENTRY BufferData(GLenum target, + GLsizeiptr size, + const void *data, + GLenum usage); +ANGLE_EXPORT void GL_APIENTRY BufferSubData(GLenum target, + GLintptr offset, + GLsizeiptr size, + const void *data); ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target); +ANGLE_EXPORT void GL_APIENTRY Clear(GLbitfield mask); +ANGLE_EXPORT void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +ANGLE_EXPORT void GL_APIENTRY ClearDepthf(GLfloat d); +ANGLE_EXPORT void GL_APIENTRY ClearStencil(GLint s); +ANGLE_EXPORT void GL_APIENTRY ColorMask(GLboolean red, + GLboolean green, + GLboolean blue, + GLboolean alpha); ANGLE_EXPORT void GL_APIENTRY CompileShader(GLuint shader); +ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLsizei imageSize, + const void *data); +ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLsizei imageSize, + const void *data); +ANGLE_EXPORT void GL_APIENTRY CopyTexImage2D(GLenum target, + GLint level, + GLenum internalformat, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLint border); +ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height); ANGLE_EXPORT GLuint GL_APIENTRY CreateProgram(); ANGLE_EXPORT GLuint GL_APIENTRY CreateShader(GLenum type); +ANGLE_EXPORT void GL_APIENTRY CullFace(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint *buffers); ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint *framebuffers); ANGLE_EXPORT void GL_APIENTRY DeleteProgram(GLuint program); ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint *renderbuffers); ANGLE_EXPORT void GL_APIENTRY DeleteShader(GLuint shader); +ANGLE_EXPORT void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint *textures); +ANGLE_EXPORT void GL_APIENTRY DepthFunc(GLenum func); +ANGLE_EXPORT void GL_APIENTRY DepthMask(GLboolean flag); +ANGLE_EXPORT void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f); ANGLE_EXPORT void GL_APIENTRY DetachShader(GLuint program, GLuint shader); +ANGLE_EXPORT void GL_APIENTRY Disable(GLenum cap); ANGLE_EXPORT void GL_APIENTRY DisableVertexAttribArray(GLuint index); +ANGLE_EXPORT void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count); +ANGLE_EXPORT void GL_APIENTRY DrawElements(GLenum mode, + GLsizei count, + GLenum type, + const void *indices); +ANGLE_EXPORT void GL_APIENTRY Enable(GLenum cap); ANGLE_EXPORT void GL_APIENTRY EnableVertexAttribArray(GLuint index); +ANGLE_EXPORT void GL_APIENTRY Finish(); +ANGLE_EXPORT void GL_APIENTRY Flush(); ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, @@ -47,8 +115,11 @@ ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum textarget, GLuint texture, GLint level); +ANGLE_EXPORT void GL_APIENTRY FrontFace(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY GenBuffers(GLsizei n, GLuint *buffers); ANGLE_EXPORT void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint *framebuffers); ANGLE_EXPORT void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint *renderbuffers); +ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint *textures); ANGLE_EXPORT void GL_APIENTRY GenerateMipmap(GLenum target); ANGLE_EXPORT void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, @@ -69,10 +140,15 @@ ANGLE_EXPORT void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei *count, GLuint *shaders); ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean *data); +ANGLE_EXPORT void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint *params); +ANGLE_EXPORT GLenum GL_APIENTRY GetError(); +ANGLE_EXPORT void GL_APIENTRY GetFloatv(GLenum pname, GLfloat *data); ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetIntegerv(GLenum pname, GLint *data); ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei *length, @@ -94,22 +170,41 @@ ANGLE_EXPORT void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei *length, GLchar *source); ANGLE_EXPORT void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint *params); +ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint *params); ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar *name); ANGLE_EXPORT void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat *params); ANGLE_EXPORT void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint *params); ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, void **pointer); ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat *params); ANGLE_EXPORT void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode); +ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer); +ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap); ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer); ANGLE_EXPORT GLboolean GL_APIENTRY IsProgram(GLuint program); ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer); ANGLE_EXPORT GLboolean GL_APIENTRY IsShader(GLuint shader); +ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture); +ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width); ANGLE_EXPORT void GL_APIENTRY LinkProgram(GLuint program); +ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units); +ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + void *pixels); ANGLE_EXPORT void GL_APIENTRY ReleaseShaderCompiler(); ANGLE_EXPORT void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert); +ANGLE_EXPORT void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height); ANGLE_EXPORT void GL_APIENTRY ShaderBinary(GLsizei count, const GLuint *shaders, GLenum binaryformat, @@ -119,12 +214,37 @@ ANGLE_EXPORT void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length); +ANGLE_EXPORT void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask); ANGLE_EXPORT void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilMask(GLuint mask); ANGLE_EXPORT void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass); ANGLE_EXPORT void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); +ANGLE_EXPORT void GL_APIENTRY TexImage2D(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + const void *pixels); +ANGLE_EXPORT void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param); +ANGLE_EXPORT void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params); +ANGLE_EXPORT void GL_APIENTRY TexSubImage2D(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + const void *pixels); ANGLE_EXPORT void GL_APIENTRY Uniform1f(GLint location, GLfloat v0); ANGLE_EXPORT void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat *value); ANGLE_EXPORT void GL_APIENTRY Uniform1i(GLint location, GLint v0); @@ -171,6 +291,7 @@ ANGLE_EXPORT void GL_APIENTRY VertexAttribPointer(GLuint index, GLboolean normalized, GLsizei stride, const void *pointer); +ANGLE_EXPORT void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height); } // namespace gl #endif // LIBGLESV2_ENTRY_POINTS_GLES_2_0_AUTOGEN_H_ diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_ext.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_ext.cpp index 24e649e5488c..42ed4a7f816e 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_ext.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_2_0_ext.cpp @@ -33,19 +33,6 @@ namespace gl { -namespace -{ - -void SetRobustLengthParam(GLsizei *length, GLsizei value) -{ - if (length) - { - *length = value; - } -} - -} // anonymous namespace - ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name) @@ -77,7 +64,7 @@ ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components) { return; } - context->setCoverageModulation(components); + context->coverageModulation(components); } } @@ -93,7 +80,7 @@ ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLflo { return; } - context->loadPathRenderingMatrix(matrixMode, matrix); + context->matrixLoadf(matrixMode, matrix); } } @@ -108,7 +95,7 @@ ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode) { return; } - context->loadPathRenderingIdentityMatrix(matrixMode); + context->matrixLoadIdentity(matrixMode); } } @@ -123,7 +110,7 @@ ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei range) { return 0; } - return context->createPaths(range); + return context->genPaths(range); } return 0; } @@ -150,11 +137,11 @@ ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path) Context *context = GetValidGlobalContext(); if (context) { - if (!context->skipValidation() && !ValidateIsPathCHROMIUM(context)) + if (!context->skipValidation() && !ValidateIsPathCHROMIUM(context, path)) { return GL_FALSE; } - return context->hasPathData(path); + return context->isPath(path); } return GL_FALSE; } @@ -180,7 +167,7 @@ ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path, { return; } - context->setPathCommands(path, numCommands, commands, numCoords, coordType, coords); + context->pathCommands(path, numCommands, commands, numCoords, coordType, coords); } } @@ -262,7 +249,7 @@ ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GL { return; } - context->setPathStencilFunc(func, ref, mask); + context->pathStencilFunc(func, ref, mask); } } @@ -305,7 +292,7 @@ ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMod Context *context = GetValidGlobalContext(); if (context) { - if (!context->skipValidation() && !ValidateCoverPathCHROMIUM(context, path, coverMode)) + if (!context->skipValidation() && !ValidateCoverFillPathCHROMIUM(context, path, coverMode)) { return; } @@ -320,7 +307,8 @@ ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverM Context *context = GetValidGlobalContext(); if (context) { - if (!context->skipValidation() && !ValidateCoverPathCHROMIUM(context, path, coverMode)) + if (!context->skipValidation() && + !ValidateCoverStrokePathCHROMIUM(context, path, coverMode)) { return; } @@ -615,16 +603,18 @@ ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, Context *context = GetValidGlobalContext(); if (context) { + TextureTarget destTargetPacked = FromGLenum(destTarget); if (!context->skipValidation() && - !ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTarget, destId, + !ValidateCopyTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, destId, destLevel, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)) { return; } - context->copyTexture(sourceId, sourceLevel, destTarget, destId, destLevel, internalFormat, - destType, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); + context->copyTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel, + internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha, + unpackUnmultiplyAlpha); } } @@ -654,15 +644,17 @@ ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, Context *context = GetValidGlobalContext(); if (context) { + TextureTarget destTargetPacked = FromGLenum(destTarget); if (!context->skipValidation() && - !ValidateCopySubTextureCHROMIUM( - context, sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, yoffset, x, - y, width, height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha)) + !ValidateCopySubTextureCHROMIUM(context, sourceId, sourceLevel, destTargetPacked, + destId, destLevel, xoffset, yoffset, x, y, width, + height, unpackFlipY, unpackPremultiplyAlpha, + unpackUnmultiplyAlpha)) { return; } - context->copySubTexture(sourceId, sourceLevel, destTarget, destId, destLevel, xoffset, + context->copySubTexture(sourceId, sourceLevel, destTargetPacked, destId, destLevel, xoffset, yoffset, x, y, width, height, unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); } @@ -714,15 +706,12 @@ ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname, Context *context = GetValidGlobalContext(); if (context) { - GLenum nativeType; - unsigned int numParams = 0; - if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + if (!ValidateGetBooleanvRobustANGLE(context, pname, bufSize, length, params)) { return; } - context->getBooleanv(pname, params); - SetRobustLengthParam(length, numParams); + context->getBooleanvRobust(pname, bufSize, length, params); } } @@ -740,16 +729,13 @@ ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target, { BufferBinding targetPacked = FromGLenum(target); - GLsizei numParams = 0; - if (!ValidateGetBufferParameterivRobustANGLE(context, targetPacked, pname, bufSize, - &numParams, params)) + if (!ValidateGetBufferParameterivRobustANGLE(context, targetPacked, pname, bufSize, length, + params)) { return; } - Buffer *buffer = context->getGLState().getTargetBuffer(targetPacked); - QueryBufferParameteriv(buffer, pname, params); - SetRobustLengthParam(length, numParams); + context->getBufferParameterivRobust(targetPacked, pname, bufSize, length, params); } } @@ -766,15 +752,12 @@ ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname, Context *context = GetValidGlobalContext(); if (context) { - GLenum nativeType; - unsigned int numParams = 0; - if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + if (!ValidateGetFloatvRobustANGLE(context, pname, bufSize, length, params)) { return; } - context->getFloatv(pname, params); - SetRobustLengthParam(length, numParams); + context->getFloatvRobust(pname, bufSize, length, params); } } @@ -793,16 +776,14 @@ ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLE(GLe Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; if (!ValidateGetFramebufferAttachmentParameterivRobustANGLE(context, target, attachment, - pname, bufSize, &numParams)) + pname, bufSize, length, params)) { return; } - const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); - QueryFramebufferAttachmentParameteriv(context, framebuffer, attachment, pname, params); - SetRobustLengthParam(length, numParams); + context->getFramebufferAttachmentParameterivRobust(target, attachment, pname, bufSize, + length, params); } } @@ -819,15 +800,12 @@ ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname, Context *context = GetValidGlobalContext(); if (context) { - GLenum nativeType; - unsigned int numParams = 0; - if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + if (!ValidateGetIntegervRobustANGLE(context, pname, bufSize, length, data)) { return; } - context->getIntegerv(pname, data); - SetRobustLengthParam(length, numParams); + context->getIntegervRobust(pname, bufSize, length, data); } } @@ -845,15 +823,12 @@ ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLE(GLuint program, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, &numParams)) + if (!ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, length, params)) { return; } - Program *programObject = context->getProgram(program); - QueryProgramiv(context, programObject, pname, params); - SetRobustLengthParam(length, numParams); + context->getProgramivRobust(program, pname, bufSize, length, params); } } @@ -871,16 +846,13 @@ ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivRobustANGLE(GLenum targe Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetRenderbufferParameterivRobustANGLE(context, target, pname, bufSize, - &numParams, params)) + if (!ValidateGetRenderbufferParameterivRobustANGLE(context, target, pname, bufSize, length, + params)) { return; } - Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); - QueryRenderbufferiv(context, renderbuffer, pname, params); - SetRobustLengthParam(length, numParams); + context->getRenderbufferParameterivRobust(target, pname, bufSize, length, params); } } @@ -895,15 +867,12 @@ GetShaderivRobustANGLE(GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *le Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, &numParams, params)) + if (!ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, length, params)) { return; } - Shader *shaderObject = context->getShader(shader); - QueryShaderiv(context, shaderObject, pname, params); - SetRobustLengthParam(length, numParams); + context->getShaderivRobust(shader, pname, bufSize, length, params); } } @@ -921,16 +890,14 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetTexParameterfvRobustANGLE(context, target, pname, bufSize, &numParams, + TextureType targetPacked = FromGLenum(target); + if (!ValidateGetTexParameterfvRobustANGLE(context, targetPacked, pname, bufSize, length, params)) { return; } - Texture *texture = context->getTargetTexture(target); - QueryTexParameterfv(texture, pname, params); - SetRobustLengthParam(length, numParams); + context->getTexParameterfvRobust(targetPacked, pname, bufSize, length, params); } } @@ -948,16 +915,14 @@ ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetTexParameterivRobustANGLE(context, target, pname, bufSize, &numParams, + TextureType targetPacked = FromGLenum(target); + if (!ValidateGetTexParameterivRobustANGLE(context, targetPacked, pname, bufSize, length, params)) { return; } - Texture *texture = context->getTargetTexture(target); - QueryTexParameteriv(texture, pname, params); - SetRobustLengthParam(length, numParams); + context->getTexParameterivRobust(targetPacked, pname, bufSize, length, params); } } @@ -975,18 +940,12 @@ ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, &writeLength, - params)) + if (!ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, length, params)) { return; } - Program *programObject = context->getProgram(program); - ASSERT(programObject); - - programObject->getUniformfv(context, location, params); - SetRobustLengthParam(length, writeLength); + context->getUniformfvRobust(program, location, bufSize, length, params); } } @@ -1004,18 +963,12 @@ ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLE(GLuint program, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetUniformivRobustANGLE(context, program, location, bufSize, &writeLength, - params)) + if (!ValidateGetUniformivRobustANGLE(context, program, location, bufSize, length, params)) { return; } - Program *programObject = context->getProgram(program); - ASSERT(programObject); - - programObject->getUniformiv(context, location, params); - SetRobustLengthParam(length, writeLength); + context->getUniformivRobust(program, location, bufSize, length, params); } } @@ -1033,15 +986,12 @@ ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, &writeLength, - params)) + if (!ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, length, params)) { return; } - context->getVertexAttribfv(index, pname, params); - SetRobustLengthParam(length, writeLength); + context->getVertexAttribfvRobust(index, pname, bufSize, length, params); } } @@ -1059,15 +1009,12 @@ ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, &writeLength, - params)) + if (!ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, length, params)) { return; } - context->getVertexAttribiv(index, pname, params); - SetRobustLengthParam(length, writeLength); + context->getVertexAttribivRobust(index, pname, bufSize, length, params); } } @@ -1085,15 +1032,13 @@ ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetVertexAttribPointervRobustANGLE(context, index, pname, bufSize, - &writeLength, pointer)) + if (!ValidateGetVertexAttribPointervRobustANGLE(context, index, pname, bufSize, length, + pointer)) { return; } - context->getVertexAttribPointerv(index, pname, pointer); - SetRobustLengthParam(length, writeLength); + context->getVertexAttribPointervRobust(index, pname, bufSize, length, pointer); } } @@ -1118,20 +1063,14 @@ ANGLE_EXPORT void GL_APIENTRY ReadPixelsRobustANGLE(GLint x, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - GLsizei writeColumns = 0; - GLsizei writeRows = 0; if (!ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize, - &writeLength, &writeColumns, &writeRows, pixels)) + length, columns, rows, pixels)) { return; } - context->readPixels(x, y, width, height, format, type, pixels); - - SetRobustLengthParam(length, writeLength); - SetRobustLengthParam(columns, writeColumns); - SetRobustLengthParam(rows, writeRows); + context->readPixelsRobust(x, y, width, height, format, type, bufSize, length, columns, rows, + pixels); } } @@ -1155,14 +1094,15 @@ ANGLE_EXPORT void GL_APIENTRY TexImage2DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexImage2DRobust(context, target, level, internalformat, width, height, border, - format, type, bufSize, pixels)) + TextureTarget targetPacked = FromGLenum(target); + if (!ValidateTexImage2DRobust(context, targetPacked, level, internalformat, width, height, + border, format, type, bufSize, pixels)) { return; } - context->texImage2D(target, level, internalformat, width, height, border, format, type, - pixels); + context->texImage2DRobust(targetPacked, level, internalformat, width, height, border, + format, type, bufSize, pixels); } } @@ -1179,13 +1119,13 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexParameterfvRobustANGLE(context, target, pname, bufSize, params)) + TextureType targetPacked = FromGLenum(target); + if (!ValidateTexParameterfvRobustANGLE(context, targetPacked, pname, bufSize, params)) { return; } - Texture *texture = context->getTargetTexture(target); - SetTexParameterfv(context, texture, pname, params); + context->texParameterfvRobust(targetPacked, pname, bufSize, params); } } @@ -1202,13 +1142,13 @@ ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexParameterivRobustANGLE(context, target, pname, bufSize, params)) + TextureType targetPacked = FromGLenum(target); + if (!ValidateTexParameterivRobustANGLE(context, targetPacked, pname, bufSize, params)) { return; } - Texture *texture = context->getTargetTexture(target); - SetTexParameteriv(context, texture, pname, params); + context->texParameterivRobust(targetPacked, pname, bufSize, params); } } @@ -1232,14 +1172,15 @@ ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexSubImage2DRobustANGLE(context, target, level, xoffset, yoffset, width, + TextureTarget targetPacked = FromGLenum(target); + if (!ValidateTexSubImage2DRobustANGLE(context, targetPacked, level, xoffset, yoffset, width, height, format, type, bufSize, pixels)) { return; } - context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, - pixels); + context->texSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height, format, + type, bufSize, pixels); } } @@ -1264,14 +1205,15 @@ ANGLE_EXPORT void GL_APIENTRY TexImage3DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexImage3DRobustANGLE(context, target, level, internalformat, width, height, - depth, border, format, type, bufSize, pixels)) + TextureType targetPacked = FromGLenum(target); + if (!ValidateTexImage3DRobustANGLE(context, targetPacked, level, internalformat, width, + height, depth, border, format, type, bufSize, pixels)) { return; } - context->texImage3D(target, level, internalformat, width, height, depth, border, format, - type, pixels); + context->texImage3DRobust(targetPacked, level, internalformat, width, height, depth, border, + format, type, bufSize, pixels); } } @@ -1299,14 +1241,16 @@ ANGLE_EXPORT void GL_APIENTRY TexSubImage3DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!ValidateTexSubImage3DRobustANGLE(context, target, level, xoffset, yoffset, zoffset, - width, height, depth, format, type, bufSize, pixels)) + TextureType targetPacked = FromGLenum(target); + if (!ValidateTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset, yoffset, + zoffset, width, height, depth, format, type, bufSize, + pixels)) { return; } - context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels); + context->texSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, width, height, + depth, format, type, bufSize, pixels); } } @@ -1330,15 +1274,16 @@ void GL_APIENTRY CompressedTexImage2DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - if (!context->skipValidation() && - !ValidateCompressedTexImage2DRobustANGLE(context, target, level, internalformat, width, - height, border, imageSize, dataSize, data)) + TextureTarget targetPacked = FromGLenum(target); + if (!context->skipValidation() && !ValidateCompressedTexImage2DRobustANGLE( + context, targetPacked, level, internalformat, width, + height, border, imageSize, dataSize, data)) { return; } - context->compressedTexImage2D(target, level, internalformat, width, height, border, - imageSize, data); + context->compressedTexImage2DRobust(targetPacked, level, internalformat, width, height, + border, imageSize, dataSize, data); } } @@ -1362,15 +1307,16 @@ void GL_APIENTRY CompressedTexSubImage2DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { + TextureTarget targetPacked = FromGLenum(target); if (!context->skipValidation() && !ValidateCompressedTexSubImage2DRobustANGLE( - context, target, level, xoffset, yoffset, width, + context, targetPacked, level, xoffset, yoffset, width, height, format, imageSize, dataSize, data)) { return; } - context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, - imageSize, data); + context->compressedTexSubImage2DRobust(targetPacked, level, xoffset, yoffset, width, height, + format, imageSize, dataSize, data); } } @@ -1395,15 +1341,16 @@ void GL_APIENTRY CompressedTexImage3DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { + TextureType targetPacked = FromGLenum(target); if (!context->skipValidation() && !ValidateCompressedTexImage3DRobustANGLE( - context, target, level, internalformat, width, height, - depth, border, imageSize, dataSize, data)) + context, targetPacked, level, internalformat, width, + height, depth, border, imageSize, dataSize, data)) { return; } - context->compressedTexImage3D(target, level, internalformat, width, height, depth, border, - imageSize, data); + context->compressedTexImage3DRobust(targetPacked, level, internalformat, width, height, + depth, border, imageSize, dataSize, data); } } @@ -1431,16 +1378,18 @@ void GL_APIENTRY CompressedTexSubImage3DRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { + TextureType targetPacked = FromGLenum(target); if (!context->skipValidation() && - !ValidateCompressedTexSubImage3DRobustANGLE(context, target, level, xoffset, yoffset, - zoffset, width, height, depth, format, - imageSize, dataSize, data)) + !ValidateCompressedTexSubImage3DRobustANGLE(context, targetPacked, level, xoffset, + yoffset, zoffset, width, height, depth, + format, imageSize, dataSize, data)) { return; } - context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, - depth, format, imageSize, data); + context->compressedTexSubImage3DRobust(targetPacked, level, xoffset, yoffset, zoffset, + width, height, depth, format, imageSize, dataSize, + data); } } @@ -1455,14 +1404,12 @@ GetQueryivRobustANGLE(GLenum target, GLenum pname, GLsizei bufSize, GLsizei *len Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetQueryivRobustANGLE(context, target, pname, bufSize, &numParams, params)) + if (!ValidateGetQueryivRobustANGLE(context, target, pname, bufSize, length, params)) { return; } - context->getQueryiv(target, pname, params); - SetRobustLengthParam(length, numParams); + context->getQueryivRobust(target, pname, bufSize, length, params); } } @@ -1480,14 +1427,12 @@ ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivRobustANGLE(GLuint id, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, &numParams, params)) + if (!ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, length, params)) { return; } - context->getQueryObjectuiv(id, pname, params); - SetRobustLengthParam(length, numParams); + context->getQueryObjectuivRobust(id, pname, bufSize, length, params); } } @@ -1507,15 +1452,13 @@ ANGLE_EXPORT void GL_APIENTRY GetBufferPointervRobustANGLE(GLenum target, { BufferBinding targetPacked = FromGLenum(target); - GLsizei numParams = 0; - if (!ValidateGetBufferPointervRobustANGLE(context, targetPacked, pname, bufSize, &numParams, + if (!ValidateGetBufferPointervRobustANGLE(context, targetPacked, pname, bufSize, length, params)) { return; } - context->getBufferPointerv(targetPacked, pname, params); - SetRobustLengthParam(length, numParams); + context->getBufferPointervRobust(targetPacked, pname, bufSize, length, params); } } @@ -1530,14 +1473,12 @@ GetIntegeri_vRobustANGLE(GLenum target, GLuint index, GLsizei bufSize, GLsizei * Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + if (!ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, length, data)) { return; } - context->getIntegeri_v(target, index, data); - SetRobustLengthParam(length, numParams); + context->getIntegeri_vRobust(target, index, bufSize, length, data); } } @@ -1556,16 +1497,13 @@ ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; if (!ValidateGetInternalFormativRobustANGLE(context, target, internalformat, pname, bufSize, - &numParams, params)) + length, params)) { return; } - const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); - QueryInternalFormativ(formatCaps, pname, bufSize, params); - SetRobustLengthParam(length, numParams); + context->getInternalformativRobust(target, internalformat, pname, bufSize, length, params); } } @@ -1583,15 +1521,12 @@ ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivRobustANGLE(GLuint index, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, &writeLength, - params)) + if (!ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, length, params)) { return; } - context->getVertexAttribIiv(index, pname, params); - SetRobustLengthParam(length, writeLength); + context->getVertexAttribIivRobust(index, pname, bufSize, length, params); } } @@ -1609,15 +1544,12 @@ ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivRobustANGLE(GLuint index, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, &writeLength, - params)) + if (!ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, length, params)) { return; } - context->getVertexAttribIuiv(index, pname, params); - SetRobustLengthParam(length, writeLength); + context->getVertexAttribIuivRobust(index, pname, bufSize, length, params); } } @@ -1635,18 +1567,12 @@ ANGLE_EXPORT void GL_APIENTRY GetUniformuivRobustANGLE(GLuint program, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - if (!ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, &writeLength, - params)) + if (!ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, length, params)) { return; } - Program *programObject = context->getProgram(program); - ASSERT(programObject); - - programObject->getUniformuiv(context, location, params); - SetRobustLengthParam(length, writeLength); + context->getUniformuivRobust(program, location, bufSize, length, params); } } @@ -1665,16 +1591,14 @@ ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockivRobustANGLE(GLuint program, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; if (!ValidateGetActiveUniformBlockivRobustANGLE(context, program, uniformBlockIndex, pname, - bufSize, &writeLength, params)) + bufSize, length, params)) { return; } - const Program *programObject = context->getProgram(program); - QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params); - SetRobustLengthParam(length, writeLength); + context->getActiveUniformBlockivRobust(program, uniformBlockIndex, pname, bufSize, length, + params); } } @@ -1691,22 +1615,12 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname, Context *context = GetValidGlobalContext(); if (context) { - GLenum nativeType; - unsigned int numParams = 0; - if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + if (!ValidateGetInteger64vRobustANGLE(context, pname, bufSize, length, data)) { return; } - if (nativeType == GL_INT_64_ANGLEX) - { - context->getInteger64v(pname, data); - } - else - { - CastStateValues(context, nativeType, pname, numParams, data); - } - SetRobustLengthParam(length, numParams); + context->getInteger64vRobust(pname, bufSize, length, data); } } @@ -1724,14 +1638,12 @@ ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + if (!ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, length, data)) { return; } - context->getInteger64i_v(target, index, data); - SetRobustLengthParam(length, numParams); + context->getInteger64i_vRobust(target, index, bufSize, length, data); } } @@ -1749,16 +1661,13 @@ ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target, { BufferBinding targetPacked = FromGLenum(target); - GLsizei numParams = 0; if (!ValidateGetBufferParameteri64vRobustANGLE(context, targetPacked, pname, bufSize, - &numParams, params)) + length, params)) { return; } - Buffer *buffer = context->getGLState().getTargetBuffer(targetPacked); - QueryBufferParameteri64v(buffer, pname, params); - SetRobustLengthParam(length, numParams); + context->getBufferParameteri64vRobust(targetPacked, pname, bufSize, length, params); } } @@ -1780,7 +1689,7 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler, return; } - context->samplerParameteriv(sampler, pname, param); + context->samplerParameterivRobust(sampler, pname, bufSize, param); } } @@ -1802,7 +1711,7 @@ ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler, return; } - context->samplerParameterfv(sampler, pname, param); + context->samplerParameterfvRobust(sampler, pname, bufSize, param); } } @@ -1820,15 +1729,13 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, &numParams, + if (!ValidateGetSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, length, params)) { return; } - context->getSamplerParameteriv(sampler, pname, params); - SetRobustLengthParam(length, numParams); + context->getSamplerParameterivRobust(sampler, pname, bufSize, length, params); } } @@ -1846,15 +1753,13 @@ ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, &numParams, + if (!ValidateGetSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, length, params)) { return; } - context->getSamplerParameterfv(sampler, pname, params); - SetRobustLengthParam(length, numParams); + context->getSamplerParameterfvRobust(sampler, pname, bufSize, length, params); } } @@ -1898,14 +1803,12 @@ ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + if (!ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, length, data)) { return; } - context->getBooleani_v(target, index, data); - SetRobustLengthParam(length, numParams); + context->getBooleani_vRobust(target, index, bufSize, length, data); } } @@ -1983,20 +1886,14 @@ ANGLE_EXPORT void GL_APIENTRY ReadnPixelsRobustANGLE(GLint x, Context *context = GetValidGlobalContext(); if (context) { - GLsizei writeLength = 0; - GLsizei writeColumns = 0; - GLsizei writeRows = 0; if (!ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize, - &writeLength, &writeColumns, &writeRows, data)) + length, columns, rows, data)) { return; } - context->readPixels(x, y, width, height, format, type, data); - - SetRobustLengthParam(length, writeLength); - SetRobustLengthParam(columns, writeColumns); - SetRobustLengthParam(rows, writeRows); + context->readnPixelsRobust(x, y, width, height, format, type, bufSize, length, columns, + rows, data); } } @@ -2153,14 +2050,12 @@ ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, &numParams, params)) + if (!ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, length, params)) { return; } - context->getQueryObjectiv(id, pname, params); - SetRobustLengthParam(length, numParams); + context->getQueryObjectivRobust(id, pname, bufSize, length, params); } } @@ -2178,14 +2073,12 @@ ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, &numParams, params)) + if (!ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, length, params)) { return; } - context->getQueryObjecti64v(id, pname, params); - SetRobustLengthParam(length, numParams); + context->getQueryObjecti64vRobust(id, pname, bufSize, length, params); } } @@ -2203,15 +2096,12 @@ ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id, Context *context = GetValidGlobalContext(); if (context) { - GLsizei numParams = 0; - if (!ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, &numParams, - params)) + if (!ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, length, params)) { return; } - context->getQueryObjectui64v(id, pname, params); - SetRobustLengthParam(length, numParams); + context->getQueryObjectui64vRobust(id, pname, bufSize, length, params); } } @@ -2235,8 +2125,8 @@ GL_APICALL void GL_APIENTRY FramebufferTextureMultiviewLayeredANGLE(GLenum targe { return; } - context->framebufferTextureMultiviewLayeredANGLE(target, attachment, texture, level, - baseViewIndex, numViews); + context->framebufferTextureMultiviewLayered(target, attachment, texture, level, + baseViewIndex, numViews); } } @@ -2260,8 +2150,8 @@ GL_APICALL void GL_APIENTRY FramebufferTextureMultiviewSideBySideANGLE(GLenum ta { return; } - context->framebufferTextureMultiviewSideBySideANGLE(target, attachment, texture, level, - numViews, viewportOffsets); + context->framebufferTextureMultiviewSideBySide(target, attachment, texture, level, numViews, + viewportOffsets); } } diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp index 08892e1dad5e..e227021ee647 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_0_autogen.cpp @@ -277,14 +277,15 @@ void GL_APIENTRY CompressedTexImage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { + TextureType targetPacked = FromGLenum(target); context->gatherParams( - target, level, internalformat, width, height, depth, border, imageSize, data); + targetPacked, level, internalformat, width, height, depth, border, imageSize, data); if (context->skipValidation() || - ValidateCompressedTexImage3D(context, target, level, internalformat, width, height, - depth, border, imageSize, data)) + ValidateCompressedTexImage3D(context, targetPacked, level, internalformat, width, + height, depth, border, imageSize, data)) { - context->compressedTexImage3D(target, level, internalformat, width, height, depth, + context->compressedTexImage3D(targetPacked, level, internalformat, width, height, depth, border, imageSize, data); } } @@ -311,15 +312,16 @@ void GL_APIENTRY CompressedTexSubImage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, level, xoffset, yoffset, - zoffset, width, height, depth, - format, imageSize, data); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, xoffset, + yoffset, zoffset, width, height, + depth, format, imageSize, data); if (context->skipValidation() || - ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, + ValidateCompressedTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data)) { - context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, + context->compressedTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } } @@ -372,14 +374,15 @@ void GL_APIENTRY CopyTexSubImage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, level, xoffset, yoffset, + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, xoffset, yoffset, zoffset, x, y, width, height); if (context->skipValidation() || - ValidateCopyTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, x, y, + ValidateCopyTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, x, y, width, height)) { - context->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, + context->copyTexSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, x, y, width, height); } } @@ -1533,15 +1536,16 @@ void GL_APIENTRY TexImage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, level, internalformat, width, height, - depth, border, format, type, pixels); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, internalformat, width, + height, depth, border, format, type, pixels); if (context->skipValidation() || - ValidateTexImage3D(context, target, level, internalformat, width, height, depth, border, - format, type, pixels)) + ValidateTexImage3D(context, targetPacked, level, internalformat, width, height, depth, + border, format, type, pixels)) { - context->texImage3D(target, level, internalformat, width, height, depth, border, format, - type, pixels); + context->texImage3D(targetPacked, level, internalformat, width, height, depth, border, + format, type, pixels); } } } @@ -1557,13 +1561,14 @@ TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, levels, internalformat, width, + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, levels, internalformat, width, height); if (context->skipValidation() || - ValidateTexStorage2D(context, target, levels, internalformat, width, height)) + ValidateTexStorage2D(context, targetPacked, levels, internalformat, width, height)) { - context->texStorage2D(target, levels, internalformat, width, height); + context->texStorage2D(targetPacked, levels, internalformat, width, height); } } } @@ -1583,13 +1588,14 @@ void GL_APIENTRY TexStorage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, levels, internalformat, width, + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, levels, internalformat, width, height, depth); - if (context->skipValidation() || - ValidateTexStorage3D(context, target, levels, internalformat, width, height, depth)) + if (context->skipValidation() || ValidateTexStorage3D(context, targetPacked, levels, + internalformat, width, height, depth)) { - context->texStorage3D(target, levels, internalformat, width, height, depth); + context->texStorage3D(targetPacked, levels, internalformat, width, height, depth); } } } @@ -1615,15 +1621,17 @@ void GL_APIENTRY TexSubImage3D(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams( - target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, xoffset, yoffset, + zoffset, width, height, depth, format, + type, pixels); if (context->skipValidation() || - ValidateTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, height, - depth, format, type, pixels)) + ValidateTexSubImage3D(context, targetPacked, level, xoffset, yoffset, zoffset, width, + height, depth, format, type, pixels)) { - context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, - format, type, pixels); + context->texSubImage3D(targetPacked, level, xoffset, yoffset, zoffset, width, height, + depth, format, type, pixels); } } } diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp index eb1be4561c5a..91c0ae72c1da 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_3_1_autogen.cpp @@ -105,12 +105,13 @@ GLuint GL_APIENTRY CreateShaderProgramv(GLenum type, GLsizei count, const GLchar Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(type, count, strings); + ShaderType typePacked = FromGLenum(type); + context->gatherParams(typePacked, count, strings); if (context->skipValidation() || - ValidateCreateShaderProgramv(context, type, count, strings)) + ValidateCreateShaderProgramv(context, typePacked, count, strings)) { - return context->createShaderProgramv(type, count, strings); + return context->createShaderProgramv(typePacked, count, strings); } } @@ -465,12 +466,14 @@ void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, level, pname, params); + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, pname, + params); if (context->skipValidation() || - ValidateGetTexLevelParameterfv(context, target, level, pname, params)) + ValidateGetTexLevelParameterfv(context, targetPacked, level, pname, params)) { - context->getTexLevelParameterfv(target, level, pname, params); + context->getTexLevelParameterfv(targetPacked, level, pname, params); } } } @@ -483,12 +486,14 @@ void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, level, pname, params); + TextureTarget targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, level, pname, + params); if (context->skipValidation() || - ValidateGetTexLevelParameteriv(context, target, level, pname, params)) + ValidateGetTexLevelParameteriv(context, targetPacked, level, pname, params)) { - context->getTexLevelParameteriv(target, level, pname, params); + context->getTexLevelParameteriv(targetPacked, level, pname, params); } } } @@ -1299,14 +1304,15 @@ void GL_APIENTRY TexStorage2DMultisample(GLenum target, Context *context = GetValidGlobalContext(); if (context) { + TextureType targetPacked = FromGLenum(target); context->gatherParams( - target, samples, internalformat, width, height, fixedsamplelocations); + targetPacked, samples, internalformat, width, height, fixedsamplelocations); if (context->skipValidation() || - ValidateTexStorage2DMultisample(context, target, samples, internalformat, width, height, - fixedsamplelocations)) + ValidateTexStorage2DMultisample(context, targetPacked, samples, internalformat, width, + height, fixedsamplelocations)) { - context->texStorage2DMultisample(target, samples, internalformat, width, height, + context->texStorage2DMultisample(targetPacked, samples, internalformat, width, height, fixedsamplelocations); } } diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp index a3b272b9105a..ba240dd6131b 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.cpp @@ -628,13 +628,14 @@ TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei wi Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, levels, internalformat, width, - height); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, levels, internalformat, + width, height); if (context->skipValidation() || - ValidateTexStorage2DEXT(context, target, levels, internalformat, width, height)) + ValidateTexStorage2DEXT(context, targetPacked, levels, internalformat, width, height)) { - context->texStorage2D(target, levels, internalformat, width, height); + context->texStorage2D(targetPacked, levels, internalformat, width, height); } } } @@ -654,13 +655,15 @@ void GL_APIENTRY TexStorage3DEXT(GLenum target, Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, levels, internalformat, width, - height, depth); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, levels, internalformat, + width, height, depth); if (context->skipValidation() || - ValidateTexStorage3DEXT(context, target, levels, internalformat, width, height, depth)) + ValidateTexStorage3DEXT(context, targetPacked, levels, internalformat, width, height, + depth)) { - context->texStorage3D(target, levels, internalformat, width, height, depth); + context->texStorage3D(targetPacked, levels, internalformat, width, height, depth); } } } @@ -1046,11 +1049,13 @@ void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) Context *context = GetValidGlobalContext(); if (context) { - context->gatherParams(target, image); + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked, image); - if (context->skipValidation() || ValidateEGLImageTargetTexture2DOES(context, target, image)) + if (context->skipValidation() || + ValidateEGLImageTargetTexture2DOES(context, targetPacked, image)) { - context->eGLImageTargetTexture2D(target, image); + context->eGLImageTargetTexture2D(targetPacked, image); } } } @@ -1192,6 +1197,292 @@ void GL_APIENTRY DrawTexxvOES(const GLfixed *coords) } } +// GL_OES_framebuffer_object +void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer) +{ + EVENT("(GLenum target = 0x%X, GLuint framebuffer = %u)", target, framebuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target, framebuffer); + + if (context->skipValidation() || ValidateBindFramebufferOES(context, target, framebuffer)) + { + context->bindFramebuffer(target, framebuffer); + } + } +} + +void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer) +{ + EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %u)", target, renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target, renderbuffer); + + if (context->skipValidation() || ValidateBindRenderbufferOES(context, target, renderbuffer)) + { + context->bindRenderbuffer(target, renderbuffer); + } + } +} + +GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target); + + if (context->skipValidation() || ValidateCheckFramebufferStatusOES(context, target)) + { + return context->checkFramebufferStatus(target); + } + } + + return GetDefaultReturnValue(); +} + +void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers) +{ + EVENT("(GLsizei n = %d, const GLuint *framebuffers = 0x%0.8p)", n, framebuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, framebuffers); + + if (context->skipValidation() || ValidateDeleteFramebuffersOES(context, n, framebuffers)) + { + context->deleteFramebuffers(n, framebuffers); + } + } +} + +void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers) +{ + EVENT("(GLsizei n = %d, const GLuint *renderbuffers = 0x%0.8p)", n, renderbuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, renderbuffers); + + if (context->skipValidation() || ValidateDeleteRenderbuffersOES(context, n, renderbuffers)) + { + context->deleteRenderbuffers(n, renderbuffers); + } + } +} + +void GL_APIENTRY FramebufferRenderbufferOES(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer) +{ + EVENT( + "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, GLuint " + "renderbuffer = %u)", + target, attachment, renderbuffertarget, renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams( + target, attachment, renderbuffertarget, renderbuffer); + + if (context->skipValidation() || + ValidateFramebufferRenderbufferOES(context, target, attachment, renderbuffertarget, + renderbuffer)) + { + context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); + } + } +} + +void GL_APIENTRY FramebufferTexture2DOES(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level) +{ + EVENT( + "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, GLuint texture " + "= %u, GLint level = %d)", + target, attachment, textarget, texture, level); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureTarget textargetPacked = FromGLenum(textarget); + context->gatherParams(target, attachment, + textargetPacked, texture, level); + + if (context->skipValidation() || + ValidateFramebufferTexture2DOES(context, target, attachment, textargetPacked, texture, + level)) + { + context->framebufferTexture2D(target, attachment, textargetPacked, texture, level); + } + } +} + +void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint *framebuffers) +{ + EVENT("(GLsizei n = %d, GLuint *framebuffers = 0x%0.8p)", n, framebuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, framebuffers); + + if (context->skipValidation() || ValidateGenFramebuffersOES(context, n, framebuffers)) + { + context->genFramebuffers(n, framebuffers); + } + } +} + +void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers) +{ + EVENT("(GLsizei n = %d, GLuint *renderbuffers = 0x%0.8p)", n, renderbuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(n, renderbuffers); + + if (context->skipValidation() || ValidateGenRenderbuffersOES(context, n, renderbuffers)) + { + context->genRenderbuffers(n, renderbuffers); + } + } +} + +void GL_APIENTRY GenerateMipmapOES(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + TextureType targetPacked = FromGLenum(target); + context->gatherParams(targetPacked); + + if (context->skipValidation() || ValidateGenerateMipmapOES(context, targetPacked)) + { + context->generateMipmap(targetPacked); + } + } +} + +void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target, + GLenum attachment, + GLenum pname, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint *params = " + "0x%0.8p)", + target, attachment, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams( + target, attachment, pname, params); + + if (context->skipValidation() || ValidateGetFramebufferAttachmentParameterivOES( + context, target, attachment, pname, params)) + { + context->getFramebufferAttachmentParameteriv(target, attachment, pname, params); + } + } +} + +void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target, pname, params); + + if (context->skipValidation() || + ValidateGetRenderbufferParameterivOES(context, target, pname, params)) + { + context->getRenderbufferParameteriv(target, pname, params); + } + } +} + +GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer) +{ + EVENT("(GLuint framebuffer = %u)", framebuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(framebuffer); + + if (context->skipValidation() || ValidateIsFramebufferOES(context, framebuffer)) + { + return context->isFramebuffer(framebuffer); + } + } + + return GetDefaultReturnValue(); +} + +GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer) +{ + EVENT("(GLuint renderbuffer = %u)", renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(renderbuffer); + + if (context->skipValidation() || ValidateIsRenderbufferOES(context, renderbuffer)) + { + return context->isRenderbuffer(renderbuffer); + } + } + + return GetDefaultReturnValue(); +} + +void GL_APIENTRY RenderbufferStorageOES(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height) +{ + EVENT( + "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = " + "%d)", + target, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(target, internalformat, width, + height); + + if (context->skipValidation() || + ValidateRenderbufferStorageOES(context, target, internalformat, width, height)) + { + context->renderbufferStorage(target, internalformat, width, height); + } + } +} + // GL_OES_get_program_binary void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, @@ -1409,6 +1700,157 @@ GLbitfield GL_APIENTRY QueryMatrixxOES(GLfixed *mantissa, GLint *exponent) return GetDefaultReturnValue(); } +// GL_OES_texture_cube_map +void GL_APIENTRY GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat *params = 0x%0.8p)", coord, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateGetTexGenfvOES(context, coord, pname, params)) + { + context->getTexGenfv(coord, pname, params); + } + } +} + +void GL_APIENTRY GetTexGenivOES(GLenum coord, GLenum pname, GLint *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", coord, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateGetTexGenivOES(context, coord, pname, params)) + { + context->getTexGeniv(coord, pname, params); + } + } +} + +void GL_APIENTRY GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed *params = 0x%0.8p)", coord, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateGetTexGenxvOES(context, coord, pname, params)) + { + context->getTexGenxv(coord, pname, params); + } + } +} + +void GL_APIENTRY TexGenfOES(GLenum coord, GLenum pname, GLfloat param) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", coord, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, param); + + if (context->skipValidation() || ValidateTexGenfOES(context, coord, pname, param)) + { + context->texGenf(coord, pname, param); + } + } +} + +void GL_APIENTRY TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfloat *params = 0x%0.8p)", coord, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateTexGenfvOES(context, coord, pname, params)) + { + context->texGenfv(coord, pname, params); + } + } +} + +void GL_APIENTRY TexGeniOES(GLenum coord, GLenum pname, GLint param) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLint param = %d)", coord, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, param); + + if (context->skipValidation() || ValidateTexGeniOES(context, coord, pname, param)) + { + context->texGeni(coord, pname, param); + } + } +} + +void GL_APIENTRY TexGenivOES(GLenum coord, GLenum pname, const GLint *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLint *params = 0x%0.8p)", coord, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateTexGenivOES(context, coord, pname, params)) + { + context->texGeniv(coord, pname, params); + } + } +} + +void GL_APIENTRY TexGenxOES(GLenum coord, GLenum pname, GLfixed param) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, GLfixed param = 0x%X)", coord, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, param); + + if (context->skipValidation() || ValidateTexGenxOES(context, coord, pname, param)) + { + context->texGenx(coord, pname, param); + } + } +} + +void GL_APIENTRY TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) +{ + EVENT("(GLenum coord = 0x%X, GLenum pname = 0x%X, const GLfixed *params = 0x%0.8p)", coord, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->gatherParams(coord, pname, params); + + if (context->skipValidation() || ValidateTexGenxvOES(context, coord, pname, params)) + { + context->texGenxv(coord, pname, params); + } + } +} + // GL_OES_vertex_array_object void GL_APIENTRY BindVertexArrayOES(GLuint array) { diff --git a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h index eac70fe4d969..2e287d9842d7 100644 --- a/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h +++ b/gfx/angle/checkout/src/libGLESv2/entry_points_gles_ext_autogen.h @@ -200,6 +200,38 @@ ANGLE_EXPORT void GL_APIENTRY DrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); ANGLE_EXPORT void GL_APIENTRY DrawTexxvOES(const GLfixed *coords); +// GL_OES_framebuffer_object +ANGLE_EXPORT void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer); +ANGLE_EXPORT void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer); +ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target); +ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint *framebuffers); +ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint *renderbuffers); +ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbufferOES(GLenum target, + GLenum attachment, + GLenum renderbuffertarget, + GLuint renderbuffer); +ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2DOES(GLenum target, + GLenum attachment, + GLenum textarget, + GLuint texture, + GLint level); +ANGLE_EXPORT void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint *framebuffers); +ANGLE_EXPORT void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint *renderbuffers); +ANGLE_EXPORT void GL_APIENTRY GenerateMipmapOES(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target, + GLenum attachment, + GLenum pname, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target, + GLenum pname, + GLint *params); +ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer); +ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer); +ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageOES(GLenum target, + GLenum internalformat, + GLsizei width, + GLsizei height); + // GL_OES_get_program_binary ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, @@ -234,6 +266,17 @@ ANGLE_EXPORT void GL_APIENTRY PointSizePointerOES(GLenum type, GLsizei stride, c // GL_OES_query_matrix ANGLE_EXPORT GLbitfield GL_APIENTRY QueryMatrixxOES(GLfixed *mantissa, GLint *exponent); +// GL_OES_texture_cube_map +ANGLE_EXPORT void GL_APIENTRY GetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetTexGenivOES(GLenum coord, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params); +ANGLE_EXPORT void GL_APIENTRY TexGenfOES(GLenum coord, GLenum pname, GLfloat param); +ANGLE_EXPORT void GL_APIENTRY TexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY TexGeniOES(GLenum coord, GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY TexGenivOES(GLenum coord, GLenum pname, const GLint *params); +ANGLE_EXPORT void GL_APIENTRY TexGenxOES(GLenum coord, GLenum pname, GLfixed param); +ANGLE_EXPORT void GL_APIENTRY TexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params); + // GL_OES_vertex_array_object ANGLE_EXPORT void GL_APIENTRY BindVertexArrayOES(GLuint array); ANGLE_EXPORT void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays); diff --git a/gfx/angle/checkout/src/libGLESv2/proc_table.h b/gfx/angle/checkout/src/libGLESv2/proc_table.h index f718291be7e3..38506e7c4c46 100644 --- a/gfx/angle/checkout/src/libGLESv2/proc_table.h +++ b/gfx/angle/checkout/src/libGLESv2/proc_table.h @@ -11,6 +11,7 @@ #define LIBGLESV2_PROC_TABLE_H_ #include +#include #include namespace egl diff --git a/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp index 17e272301a50..840df3ce9f7f 100644 --- a/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp +++ b/gfx/angle/checkout/src/third_party/compiler/ArrayBoundsClamper.cpp @@ -25,7 +25,7 @@ #include "third_party/compiler/ArrayBoundsClamper.h" -#include "compiler/translator/IntermTraverse.h" +#include "compiler/translator/tree_util/IntermTraverse.h" // The built-in 'clamp' instruction only accepts floats and returns a float. I // iterated a few times with our driver team who examined the output from our diff --git a/gfx/angle/targets/libANGLE/moz.build b/gfx/angle/targets/libANGLE/moz.build index 1d31b75e2ec9..37ce259c3a1f 100644 --- a/gfx/angle/targets/libANGLE/moz.build +++ b/gfx/angle/targets/libANGLE/moz.build @@ -116,6 +116,7 @@ SOURCES += [ '../../checkout/src/libANGLE/Compiler.cpp', '../../checkout/src/libANGLE/Config.cpp', '../../checkout/src/libANGLE/Context.cpp', + '../../checkout/src/libANGLE/Context_gles_1_0.cpp', '../../checkout/src/libANGLE/ContextState.cpp', '../../checkout/src/libANGLE/Debug.cpp', '../../checkout/src/libANGLE/Device.cpp', @@ -127,6 +128,7 @@ SOURCES += [ '../../checkout/src/libANGLE/formatutils.cpp', '../../checkout/src/libANGLE/Framebuffer.cpp', '../../checkout/src/libANGLE/FramebufferAttachment.cpp', + '../../checkout/src/libANGLE/GLES1State.cpp', '../../checkout/src/libANGLE/HandleAllocator.cpp', '../../checkout/src/libANGLE/HandleRangeAllocator.cpp', '../../checkout/src/libANGLE/Image.cpp', @@ -134,6 +136,8 @@ SOURCES += [ '../../checkout/src/libANGLE/IndexRangeCache.cpp', '../../checkout/src/libANGLE/LoggingAnnotator.cpp', '../../checkout/src/libANGLE/MemoryProgramCache.cpp', + '../../checkout/src/libANGLE/Observer.cpp', + '../../checkout/src/libANGLE/PackedGLEnums.cpp', '../../checkout/src/libANGLE/PackedGLEnums_autogen.cpp', '../../checkout/src/libANGLE/params.cpp', '../../checkout/src/libANGLE/Path.cpp', @@ -233,7 +237,6 @@ SOURCES += [ '../../checkout/src/libANGLE/ResourceManager.cpp', '../../checkout/src/libANGLE/Sampler.cpp', '../../checkout/src/libANGLE/Shader.cpp', - '../../checkout/src/libANGLE/signal_utils.cpp', '../../checkout/src/libANGLE/State.cpp', '../../checkout/src/libANGLE/Stream.cpp', '../../checkout/src/libANGLE/Surface.cpp', diff --git a/gfx/angle/targets/translator/moz.build b/gfx/angle/targets/translator/moz.build index e6890ed2de29..240b6f3ec83d 100644 --- a/gfx/angle/targets/translator/moz.build +++ b/gfx/angle/targets/translator/moz.build @@ -105,38 +105,24 @@ LOCAL_INCLUDES += [ #] SOURCES += [ - '../../checkout/src/compiler/translator/AddAndTrueToLoopCondition.cpp', - '../../checkout/src/compiler/translator/AddDefaultReturnStatements.cpp', - '../../checkout/src/compiler/translator/ArrayReturnValueToOutParameter.cpp', '../../checkout/src/compiler/translator/ASTMetadataHLSL.cpp', '../../checkout/src/compiler/translator/blocklayout.cpp', '../../checkout/src/compiler/translator/blocklayoutHLSL.cpp', - '../../checkout/src/compiler/translator/BreakVariableAliasingInInnerLoops.cpp', '../../checkout/src/compiler/translator/BuiltInFunctionEmulator.cpp', '../../checkout/src/compiler/translator/BuiltInFunctionEmulatorGLSL.cpp', '../../checkout/src/compiler/translator/BuiltInFunctionEmulatorHLSL.cpp', '../../checkout/src/compiler/translator/CallDAG.cpp', - '../../checkout/src/compiler/translator/ClampFragDepth.cpp', - '../../checkout/src/compiler/translator/ClampPointSize.cpp', '../../checkout/src/compiler/translator/CodeGen.cpp', '../../checkout/src/compiler/translator/CollectVariables.cpp', '../../checkout/src/compiler/translator/Compiler.cpp', '../../checkout/src/compiler/translator/ConstantUnion.cpp', '../../checkout/src/compiler/translator/Declarator.cpp', - '../../checkout/src/compiler/translator/DeclareAndInitBuiltinsForInstancedMultiview.cpp', - '../../checkout/src/compiler/translator/DeferGlobalInitializers.cpp', '../../checkout/src/compiler/translator/Diagnostics.cpp', '../../checkout/src/compiler/translator/DirectiveHandler.cpp', '../../checkout/src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp', - '../../checkout/src/compiler/translator/EmulateGLFragColorBroadcast.cpp', - '../../checkout/src/compiler/translator/EmulatePrecision.cpp', - '../../checkout/src/compiler/translator/ExpandIntegerPowExpressions.cpp', '../../checkout/src/compiler/translator/ExtensionBehavior.cpp', '../../checkout/src/compiler/translator/ExtensionGLSL.cpp', - '../../checkout/src/compiler/translator/FindMain.cpp', - '../../checkout/src/compiler/translator/FindSymbolNode.cpp', '../../checkout/src/compiler/translator/FlagStd140Structs.cpp', - '../../checkout/src/compiler/translator/FoldExpressions.cpp', '../../checkout/src/compiler/translator/FunctionLookup.cpp', '../../checkout/src/compiler/translator/glslang_lex.cpp', '../../checkout/src/compiler/translator/glslang_tab.cpp', @@ -147,11 +133,7 @@ SOURCES += [ '../../checkout/src/compiler/translator/InfoSink.cpp', '../../checkout/src/compiler/translator/Initialize.cpp', '../../checkout/src/compiler/translator/InitializeDll.cpp', - '../../checkout/src/compiler/translator/InitializeVariables.cpp', '../../checkout/src/compiler/translator/IntermNode.cpp', - '../../checkout/src/compiler/translator/IntermNode_util.cpp', - '../../checkout/src/compiler/translator/IntermNodePatternMatcher.cpp', - '../../checkout/src/compiler/translator/IntermTraverse.cpp', '../../checkout/src/compiler/translator/IsASTDepthBelowLimit.cpp', '../../checkout/src/compiler/translator/Operator.cpp', '../../checkout/src/compiler/translator/OutputESSL.cpp', @@ -161,48 +143,67 @@ SOURCES += [ '../../checkout/src/compiler/translator/OutputTree.cpp', '../../checkout/src/compiler/translator/ParseContext.cpp', '../../checkout/src/compiler/translator/PoolAlloc.cpp', - '../../checkout/src/compiler/translator/PruneNoOps.cpp', '../../checkout/src/compiler/translator/QualifierTypes.cpp', - '../../checkout/src/compiler/translator/RecordConstantPrecision.cpp', - '../../checkout/src/compiler/translator/RegenerateStructNames.cpp', - '../../checkout/src/compiler/translator/RemoveArrayLengthMethod.cpp', - '../../checkout/src/compiler/translator/RemoveDynamicIndexing.cpp', - '../../checkout/src/compiler/translator/RemoveEmptySwitchStatements.cpp', - '../../checkout/src/compiler/translator/RemoveInvariantDeclaration.cpp', - '../../checkout/src/compiler/translator/RemoveNoOpCasesFromEndOfSwitchStatements.cpp', - '../../checkout/src/compiler/translator/RemovePow.cpp', - '../../checkout/src/compiler/translator/RemoveSwitchFallThrough.cpp', - '../../checkout/src/compiler/translator/RemoveUnreferencedVariables.cpp', - '../../checkout/src/compiler/translator/ReplaceVariable.cpp', - '../../checkout/src/compiler/translator/RewriteDoWhile.cpp', - '../../checkout/src/compiler/translator/RewriteElseBlocks.cpp', - '../../checkout/src/compiler/translator/RewriteTexelFetchOffset.cpp', - '../../checkout/src/compiler/translator/RewriteUnaryMinusOperatorFloat.cpp', - '../../checkout/src/compiler/translator/RewriteUnaryMinusOperatorInt.cpp', - '../../checkout/src/compiler/translator/RunAtTheEndOfShader.cpp', - '../../checkout/src/compiler/translator/ScalarizeVecAndMatConstructorArgs.cpp', - '../../checkout/src/compiler/translator/SeparateArrayConstructorStatements.cpp', - '../../checkout/src/compiler/translator/SeparateArrayInitialization.cpp', - '../../checkout/src/compiler/translator/SeparateDeclarations.cpp', - '../../checkout/src/compiler/translator/SeparateExpressionsReturningArrays.cpp', '../../checkout/src/compiler/translator/ShaderLang.cpp', '../../checkout/src/compiler/translator/ShaderVars.cpp', - '../../checkout/src/compiler/translator/SimplifyLoopConditions.cpp', - '../../checkout/src/compiler/translator/SplitSequenceOperator.cpp', - '../../checkout/src/compiler/translator/StaticType.cpp', '../../checkout/src/compiler/translator/StructureHLSL.cpp', '../../checkout/src/compiler/translator/Symbol.cpp', '../../checkout/src/compiler/translator/SymbolTable.cpp', + '../../checkout/src/compiler/translator/SymbolTable_autogen.cpp', '../../checkout/src/compiler/translator/SymbolUniqueId.cpp', '../../checkout/src/compiler/translator/TextureFunctionHLSL.cpp', '../../checkout/src/compiler/translator/TranslatorESSL.cpp', '../../checkout/src/compiler/translator/TranslatorGLSL.cpp', '../../checkout/src/compiler/translator/TranslatorHLSL.cpp', + '../../checkout/src/compiler/translator/tree_ops/AddAndTrueToLoopCondition.cpp', + '../../checkout/src/compiler/translator/tree_ops/AddDefaultReturnStatements.cpp', + '../../checkout/src/compiler/translator/tree_ops/ArrayReturnValueToOutParameter.cpp', + '../../checkout/src/compiler/translator/tree_ops/BreakVariableAliasingInInnerLoops.cpp', + '../../checkout/src/compiler/translator/tree_ops/ClampFragDepth.cpp', + '../../checkout/src/compiler/translator/tree_ops/ClampPointSize.cpp', + '../../checkout/src/compiler/translator/tree_ops/DeclareAndInitBuiltinsForInstancedMultiview.cpp', + '../../checkout/src/compiler/translator/tree_ops/DeferGlobalInitializers.cpp', + '../../checkout/src/compiler/translator/tree_ops/EmulateGLFragColorBroadcast.cpp', + '../../checkout/src/compiler/translator/tree_ops/EmulatePrecision.cpp', + '../../checkout/src/compiler/translator/tree_ops/ExpandIntegerPowExpressions.cpp', + '../../checkout/src/compiler/translator/tree_ops/FoldExpressions.cpp', + '../../checkout/src/compiler/translator/tree_ops/InitializeVariables.cpp', + '../../checkout/src/compiler/translator/tree_ops/PruneEmptyCases.cpp', + '../../checkout/src/compiler/translator/tree_ops/PruneNoOps.cpp', + '../../checkout/src/compiler/translator/tree_ops/RecordConstantPrecision.cpp', + '../../checkout/src/compiler/translator/tree_ops/RegenerateStructNames.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemoveArrayLengthMethod.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemoveDynamicIndexing.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemoveInvariantDeclaration.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemovePow.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemoveSwitchFallThrough.cpp', + '../../checkout/src/compiler/translator/tree_ops/RemoveUnreferencedVariables.cpp', + '../../checkout/src/compiler/translator/tree_ops/RewriteDoWhile.cpp', + '../../checkout/src/compiler/translator/tree_ops/RewriteElseBlocks.cpp', + '../../checkout/src/compiler/translator/tree_ops/RewriteTexelFetchOffset.cpp', + '../../checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorFloat.cpp', + '../../checkout/src/compiler/translator/tree_ops/RewriteUnaryMinusOperatorInt.cpp', + '../../checkout/src/compiler/translator/tree_ops/ScalarizeVecAndMatConstructorArgs.cpp', + '../../checkout/src/compiler/translator/tree_ops/SeparateArrayConstructorStatements.cpp', + '../../checkout/src/compiler/translator/tree_ops/SeparateArrayInitialization.cpp', + '../../checkout/src/compiler/translator/tree_ops/SeparateDeclarations.cpp', + '../../checkout/src/compiler/translator/tree_ops/SeparateExpressionsReturningArrays.cpp', + '../../checkout/src/compiler/translator/tree_ops/SimplifyLoopConditions.cpp', + '../../checkout/src/compiler/translator/tree_ops/SplitSequenceOperator.cpp', + '../../checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitAST.cpp', + '../../checkout/src/compiler/translator/tree_ops/UnfoldShortCircuitToIf.cpp', + '../../checkout/src/compiler/translator/tree_ops/UseInterfaceBlockFields.cpp', + '../../checkout/src/compiler/translator/tree_ops/VectorizeVectorScalarArithmetic.cpp', + '../../checkout/src/compiler/translator/tree_ops/WrapSwitchStatementsInBlocks.cpp', + '../../checkout/src/compiler/translator/tree_util/FindMain.cpp', + '../../checkout/src/compiler/translator/tree_util/FindSymbolNode.cpp', + '../../checkout/src/compiler/translator/tree_util/IntermNode_util.cpp', + '../../checkout/src/compiler/translator/tree_util/IntermNodePatternMatcher.cpp', + '../../checkout/src/compiler/translator/tree_util/IntermTraverse.cpp', + '../../checkout/src/compiler/translator/tree_util/ReplaceVariable.cpp', + '../../checkout/src/compiler/translator/tree_util/RunAtTheEndOfShader.cpp', '../../checkout/src/compiler/translator/Types.cpp', - '../../checkout/src/compiler/translator/UnfoldShortCircuitAST.cpp', - '../../checkout/src/compiler/translator/UnfoldShortCircuitToIf.cpp', '../../checkout/src/compiler/translator/UniformHLSL.cpp', - '../../checkout/src/compiler/translator/UseInterfaceBlockFields.cpp', '../../checkout/src/compiler/translator/util.cpp', '../../checkout/src/compiler/translator/UtilsHLSL.cpp', '../../checkout/src/compiler/translator/ValidateGlobalInitializer.cpp', @@ -212,9 +213,7 @@ SOURCES += [ '../../checkout/src/compiler/translator/ValidateSwitch.cpp', '../../checkout/src/compiler/translator/ValidateVaryingLocations.cpp', '../../checkout/src/compiler/translator/VariablePacker.cpp', - '../../checkout/src/compiler/translator/VectorizeVectorScalarArithmetic.cpp', '../../checkout/src/compiler/translator/VersionGLSL.cpp', - '../../checkout/src/compiler/translator/WrapSwitchStatementsInBlocks.cpp', '../../checkout/src/third_party/compiler/ArrayBoundsClamper.cpp', ]