SPIR-V: Move from Version .99 Rev 31 to Version 1.0, Rev 2.
This commit is contained in:
parent
1c77f3a8d2
commit
55e7d11ce8
117 changed files with 6740 additions and 5997 deletions
|
|
@ -66,13 +66,13 @@ enum TSamplerDim {
|
|||
EsdNumDims
|
||||
};
|
||||
|
||||
struct TSampler {
|
||||
struct TSampler { // misnomer now; includes images, textures without sampler, and textures with sampler
|
||||
TBasicType type : 8; // type returned by sampler
|
||||
TSamplerDim dim : 8;
|
||||
bool arrayed : 1;
|
||||
bool shadow : 1;
|
||||
bool ms : 1;
|
||||
bool image : 1;
|
||||
bool image : 1; // image, combined should be false
|
||||
bool external : 1; // GL_OES_EGL_image_external
|
||||
|
||||
void clear()
|
||||
|
|
@ -86,26 +86,27 @@ struct TSampler {
|
|||
external = false;
|
||||
}
|
||||
|
||||
// make a combined sampler and texture
|
||||
void set(TBasicType t, TSamplerDim d, bool a = false, bool s = false, bool m = false)
|
||||
{
|
||||
clear();
|
||||
type = t;
|
||||
dim = d;
|
||||
arrayed = a;
|
||||
shadow = s;
|
||||
ms = m;
|
||||
image = false;
|
||||
external = false;
|
||||
}
|
||||
|
||||
// make an image
|
||||
void setImage(TBasicType t, TSamplerDim d, bool a = false, bool s = false, bool m = false)
|
||||
{
|
||||
clear();
|
||||
type = t;
|
||||
dim = d;
|
||||
arrayed = a;
|
||||
shadow = s;
|
||||
ms = m;
|
||||
image = true;
|
||||
external = false;
|
||||
}
|
||||
|
||||
bool operator==(const TSampler& right) const
|
||||
|
|
@ -119,6 +120,11 @@ struct TSampler {
|
|||
external == right.external;
|
||||
}
|
||||
|
||||
bool operator!=(const TSampler& right) const
|
||||
{
|
||||
return ! operator==(right);
|
||||
}
|
||||
|
||||
TString getString() const
|
||||
{
|
||||
TString s;
|
||||
|
|
@ -129,21 +135,22 @@ struct TSampler {
|
|||
case EbtUint: s.append("u"); break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (image)
|
||||
if (image) {
|
||||
s.append("image");
|
||||
else
|
||||
} else {
|
||||
s.append("sampler");
|
||||
}
|
||||
if (external) {
|
||||
s.append("ExternalOES");
|
||||
return s;
|
||||
}
|
||||
switch (dim) {
|
||||
case Esd1D: s.append("1D"); break;
|
||||
case Esd2D: s.append("2D"); break;
|
||||
case Esd3D: s.append("3D"); break;
|
||||
case EsdCube: s.append("Cube"); break;
|
||||
case EsdRect: s.append("2DRect"); break;
|
||||
case EsdBuffer: s.append("Buffer"); break;
|
||||
case Esd1D: s.append("1D"); break;
|
||||
case Esd2D: s.append("2D"); break;
|
||||
case Esd3D: s.append("3D"); break;
|
||||
case EsdCube: s.append("Cube"); break;
|
||||
case EsdRect: s.append("2DRect"); break;
|
||||
case EsdBuffer: s.append("Buffer"); break;
|
||||
default: break; // some compilers want this
|
||||
}
|
||||
if (ms)
|
||||
|
|
@ -290,7 +297,7 @@ enum TLayoutDepth {
|
|||
EldGreater,
|
||||
EldLess,
|
||||
EldUnchanged,
|
||||
|
||||
|
||||
EldCount
|
||||
};
|
||||
|
||||
|
|
@ -330,37 +337,37 @@ public:
|
|||
// drop qualifiers that don't belong in a temporary variable
|
||||
void makeTemporary()
|
||||
{
|
||||
storage = EvqTemporary;
|
||||
builtIn = EbvNone;
|
||||
centroid = false;
|
||||
smooth = false;
|
||||
flat = false;
|
||||
nopersp = false;
|
||||
patch = false;
|
||||
sample = false;
|
||||
coherent = false;
|
||||
volatil = false;
|
||||
restrict = false;
|
||||
readonly = false;
|
||||
writeonly = false;
|
||||
storage = EvqTemporary;
|
||||
builtIn = EbvNone;
|
||||
centroid = false;
|
||||
smooth = false;
|
||||
flat = false;
|
||||
nopersp = false;
|
||||
patch = false;
|
||||
sample = false;
|
||||
coherent = false;
|
||||
volatil = false;
|
||||
restrict = false;
|
||||
readonly = false;
|
||||
writeonly = false;
|
||||
clearLayout();
|
||||
}
|
||||
|
||||
TStorageQualifier storage : 6;
|
||||
TBuiltInVariable builtIn : 8;
|
||||
TPrecisionQualifier precision : 3;
|
||||
bool invariant : 1;
|
||||
bool centroid : 1;
|
||||
bool smooth : 1;
|
||||
bool flat : 1;
|
||||
bool nopersp : 1;
|
||||
bool patch : 1;
|
||||
bool sample : 1;
|
||||
bool coherent : 1;
|
||||
bool volatil : 1;
|
||||
bool restrict : 1;
|
||||
bool readonly : 1;
|
||||
bool writeonly : 1;
|
||||
bool invariant : 1;
|
||||
bool centroid : 1;
|
||||
bool smooth : 1;
|
||||
bool flat : 1;
|
||||
bool nopersp : 1;
|
||||
bool patch : 1;
|
||||
bool sample : 1;
|
||||
bool coherent : 1;
|
||||
bool volatil : 1;
|
||||
bool restrict : 1;
|
||||
bool readonly : 1;
|
||||
bool writeonly : 1;
|
||||
|
||||
bool isMemory() const
|
||||
{
|
||||
|
|
@ -501,7 +508,7 @@ public:
|
|||
}
|
||||
bool hasLayout() const
|
||||
{
|
||||
return hasUniformLayout() ||
|
||||
return hasUniformLayout() ||
|
||||
hasAnyLocation() ||
|
||||
hasBinding() ||
|
||||
hasStream() ||
|
||||
|
|
@ -513,34 +520,34 @@ public:
|
|||
int layoutOffset;
|
||||
int layoutAlign;
|
||||
|
||||
unsigned int layoutLocation :12;
|
||||
static const unsigned int layoutLocationEnd = 0xFFF;
|
||||
unsigned int layoutLocation :12;
|
||||
static const unsigned int layoutLocationEnd = 0xFFF;
|
||||
|
||||
unsigned int layoutComponent : 3;
|
||||
static const unsigned int layoutComponentEnd = 4;
|
||||
unsigned int layoutComponent : 3;
|
||||
static const unsigned int layoutComponentEnd = 4;
|
||||
|
||||
unsigned int layoutSet : 7;
|
||||
static const unsigned int layoutSetEnd = 0x3F;
|
||||
unsigned int layoutSet : 7;
|
||||
static const unsigned int layoutSetEnd = 0x3F;
|
||||
|
||||
unsigned int layoutBinding : 8;
|
||||
static const unsigned int layoutBindingEnd = 0xFF;
|
||||
unsigned int layoutBinding : 8;
|
||||
static const unsigned int layoutBindingEnd = 0xFF;
|
||||
|
||||
unsigned int layoutIndex : 8;
|
||||
static const unsigned int layoutIndexEnd = 0xFF;
|
||||
unsigned int layoutIndex : 8;
|
||||
static const unsigned int layoutIndexEnd = 0xFF;
|
||||
|
||||
unsigned int layoutStream : 8;
|
||||
static const unsigned int layoutStreamEnd = 0xFF;
|
||||
unsigned int layoutStream : 8;
|
||||
static const unsigned int layoutStreamEnd = 0xFF;
|
||||
|
||||
unsigned int layoutXfbBuffer : 4;
|
||||
static const unsigned int layoutXfbBufferEnd = 0xF;
|
||||
unsigned int layoutXfbBuffer : 4;
|
||||
static const unsigned int layoutXfbBufferEnd = 0xF;
|
||||
|
||||
unsigned int layoutXfbStride : 10;
|
||||
static const unsigned int layoutXfbStrideEnd = 0x3FF;
|
||||
unsigned int layoutXfbStride : 10;
|
||||
static const unsigned int layoutXfbStrideEnd = 0x3FF;
|
||||
|
||||
unsigned int layoutXfbOffset : 10;
|
||||
static const unsigned int layoutXfbOffsetEnd = 0x3FF;
|
||||
unsigned int layoutXfbOffset : 10;
|
||||
static const unsigned int layoutXfbOffsetEnd = 0x3FF;
|
||||
|
||||
TLayoutFormat layoutFormat : 8;
|
||||
TLayoutFormat layoutFormat : 8;
|
||||
|
||||
bool hasUniformLayout() const
|
||||
{
|
||||
|
|
@ -893,10 +900,7 @@ public:
|
|||
return matrixCols == 0 && vectorSize == 1 && arraySizes == nullptr && userDef == nullptr;
|
||||
}
|
||||
|
||||
bool isImage() const
|
||||
{
|
||||
return basicType == EbtSampler && sampler.image;
|
||||
}
|
||||
bool isImage() const { return basicType == EbtSampler && sampler.image; }
|
||||
};
|
||||
|
||||
//
|
||||
|
|
@ -984,7 +988,7 @@ public:
|
|||
typeName = NewPoolTString(n.c_str());
|
||||
}
|
||||
// For interface blocks
|
||||
TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
|
||||
TType(TTypeList* userDef, const TString& n, const TQualifier& q) :
|
||||
basicType(EbtBlock), vectorSize(1), matrixCols(0), matrixRows(0),
|
||||
qualifier(q), arraySizes(nullptr), structure(userDef), fieldName(nullptr)
|
||||
{
|
||||
|
|
@ -992,10 +996,10 @@ public:
|
|||
typeName = NewPoolTString(n.c_str());
|
||||
}
|
||||
virtual ~TType() {}
|
||||
|
||||
|
||||
// Not for use across pool pops; it will cause multiple instances of TType to point to the same information.
|
||||
// This only works if that information (like a structure's list of types) does not change and
|
||||
// the instances are sharing the same pool.
|
||||
// This only works if that information (like a structure's list of types) does not change and
|
||||
// the instances are sharing the same pool.
|
||||
void shallowCopy(const TType& copyOf)
|
||||
{
|
||||
basicType = copyOf.basicType;
|
||||
|
|
@ -1035,7 +1039,7 @@ public:
|
|||
if (copyOf.typeName)
|
||||
typeName = NewPoolTString(copyOf.typeName->c_str());
|
||||
}
|
||||
|
||||
|
||||
TType* clone()
|
||||
{
|
||||
TType *newType = new TType();
|
||||
|
|
@ -1105,6 +1109,7 @@ public:
|
|||
virtual bool isImplicitlySizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage != EvqBuffer; }
|
||||
virtual bool isRuntimeSizedArray() const { return isArray() && getOuterArraySize() == UnsizedArraySize && qualifier.storage == EvqBuffer; }
|
||||
virtual bool isStruct() const { return structure != nullptr; }
|
||||
|
||||
virtual bool isImage() const { return basicType == EbtSampler && getSampler().image; }
|
||||
|
||||
// Recursively checks if the type contains the given basic type
|
||||
|
|
@ -1182,7 +1187,7 @@ public:
|
|||
//
|
||||
// N.B.: Don't share with the shared symbol tables (symbols are
|
||||
// marked as isReadOnly(). Such symbols with arrays that will be
|
||||
// edited need to copyUp() on first use, so that
|
||||
// edited need to copyUp() on first use, so that
|
||||
// A) the edits don't effect the shared symbol table, and
|
||||
// B) the edits are shared across all users.
|
||||
void updateArraySizes(const TType& type)
|
||||
|
|
@ -1220,7 +1225,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
const char* getBasicString() const
|
||||
const char* getBasicString() const
|
||||
{
|
||||
return TType::getBasicString(basicType);
|
||||
}
|
||||
|
|
@ -1401,8 +1406,8 @@ public:
|
|||
// in different places, but still might satisfy the definition of matching.
|
||||
// From the spec:
|
||||
//
|
||||
// "Structures must have the same name, sequence of type names, and
|
||||
// type definitions, and member names to be considered the same type.
|
||||
// "Structures must have the same name, sequence of type names, and
|
||||
// type definitions, and member names to be considered the same type.
|
||||
// This rule applies recursively for nested or embedded types."
|
||||
//
|
||||
bool sameStructType(const TType& right) const
|
||||
|
|
|
|||
|
|
@ -2,5 +2,5 @@
|
|||
// For the version, it uses the latest git tag followed by the number of commits.
|
||||
// For the date, it uses the current date (when then script is run).
|
||||
|
||||
#define GLSLANG_REVISION "3.0.790"
|
||||
#define GLSLANG_DATE "15-Oct-2015"
|
||||
#define GLSLANG_REVISION "3.0.798"
|
||||
#define GLSLANG_DATE "15-Nov-2015"
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@
|
|||
namespace glslang {
|
||||
|
||||
// TODO: ARB_Compatability: do full extension support
|
||||
bool ARBCompatibility = true;
|
||||
const bool ARBCompatibility = true;
|
||||
|
||||
const bool ForwardCompatibility = false;
|
||||
|
||||
|
|
@ -62,9 +62,9 @@ const bool ForwardCompatibility = false;
|
|||
// Using PureOperatorBuiltins=false is deprecated.
|
||||
bool PureOperatorBuiltins = true;
|
||||
|
||||
inline bool IncludeLegacy(int version, EProfile profile)
|
||||
inline bool IncludeLegacy(int version, EProfile profile, int spv)
|
||||
{
|
||||
return profile != EEsProfile && (version <= 130 || ARBCompatibility || profile == ECompatibilityProfile);
|
||||
return profile != EEsProfile && (version <= 130 || (spv == 0 && ARBCompatibility) || profile == ECompatibilityProfile);
|
||||
}
|
||||
|
||||
TBuiltIns::TBuiltIns()
|
||||
|
|
@ -99,7 +99,7 @@ TBuiltIns::~TBuiltIns()
|
|||
// Most built-ins variables can be added as simple text strings. Some need to
|
||||
// be added programmatically, which is done later in IdentifyBuiltIns() below.
|
||||
//
|
||||
void TBuiltIns::initialize(int version, EProfile profile)
|
||||
void TBuiltIns::initialize(int version, EProfile profile, int spv)
|
||||
{
|
||||
//============================================================================
|
||||
//
|
||||
|
|
@ -788,54 +788,60 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
profile == ECompatibilityProfile ||
|
||||
(profile == ECoreProfile && version < 420) ||
|
||||
profile == ENoProfile) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture2D(sampler2D, vec2);"
|
||||
if (spv == 0) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture2D(sampler2D, vec2);"
|
||||
|
||||
"vec4 texture2DProj(sampler2D, vec3);"
|
||||
"vec4 texture2DProj(sampler2D, vec4);"
|
||||
"vec4 texture2DProj(sampler2D, vec3);"
|
||||
"vec4 texture2DProj(sampler2D, vec4);"
|
||||
|
||||
"vec4 texture3D(sampler3D, vec3);" // OES_texture_3D, but caught by keyword check
|
||||
"vec4 texture3DProj(sampler3D, vec4);" // OES_texture_3D, but caught by keyword check
|
||||
"vec4 texture3D(sampler3D, vec3);" // OES_texture_3D, but caught by keyword check
|
||||
"vec4 texture3DProj(sampler3D, vec4);" // OES_texture_3D, but caught by keyword check
|
||||
|
||||
"vec4 textureCube(samplerCube, vec3);"
|
||||
"vec4 textureCube(samplerCube, vec3);"
|
||||
|
||||
"\n");
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ( profile == ECompatibilityProfile ||
|
||||
(profile == ECoreProfile && version < 420) ||
|
||||
profile == ENoProfile) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture1D(sampler1D, float);"
|
||||
if (spv == 0) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture1D(sampler1D, float);"
|
||||
|
||||
"vec4 texture1DProj(sampler1D, vec2);"
|
||||
"vec4 texture1DProj(sampler1D, vec4);"
|
||||
"vec4 texture1DProj(sampler1D, vec2);"
|
||||
"vec4 texture1DProj(sampler1D, vec4);"
|
||||
|
||||
"vec4 shadow1D(sampler1DShadow, vec3);"
|
||||
"vec4 shadow2D(sampler2DShadow, vec3);"
|
||||
"vec4 shadow1DProj(sampler1DShadow, vec4);"
|
||||
"vec4 shadow2DProj(sampler2DShadow, vec4);"
|
||||
"vec4 shadow1D(sampler1DShadow, vec3);"
|
||||
"vec4 shadow2D(sampler2DShadow, vec3);"
|
||||
"vec4 shadow1DProj(sampler1DShadow, vec4);"
|
||||
"vec4 shadow2DProj(sampler2DShadow, vec4);"
|
||||
|
||||
"vec4 texture2DRect(sampler2DRect, vec2);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 texture2DRectProj(sampler2DRect, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 texture2DRectProj(sampler2DRect, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 texture2DRect(sampler2DRect, vec2);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 texture2DRectProj(sampler2DRect, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 texture2DRectProj(sampler2DRect, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 shadow2DRect(sampler2DRectShadow, vec3);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
"vec4 shadow2DRectProj(sampler2DRectShadow, vec4);" // GL_ARB_texture_rectangle, caught by keyword check
|
||||
|
||||
"\n");
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod
|
||||
if (profile == EEsProfile) {
|
||||
if (spv == 0) {
|
||||
commonBuiltins.append(
|
||||
"vec4 texture2D(samplerExternalOES, vec2 coord);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DProj(samplerExternalOES, vec3);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DProj(samplerExternalOES, vec4);" // GL_OES_EGL_image_external, caught by keyword check
|
||||
"vec4 texture2DGradEXT(sampler2D, vec2, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 texture2DProjGradEXT(sampler2D, vec3, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 texture2DProjGradEXT(sampler2D, vec4, vec2, vec2);" // GL_EXT_shader_texture_lod
|
||||
"vec4 textureCubeGradEXT(samplerCube, vec3, vec3, vec3);" // GL_EXT_shader_texture_lod
|
||||
|
||||
"\n");
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
|
@ -977,7 +983,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
//
|
||||
// Geometric Functions.
|
||||
//
|
||||
if (IncludeLegacy(version, profile))
|
||||
if (IncludeLegacy(version, profile, spv))
|
||||
stageBuiltins[EShLangVertex].append("vec4 ftransform();");
|
||||
|
||||
//
|
||||
|
|
@ -991,49 +997,53 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
if ((profile == EEsProfile && version == 100) ||
|
||||
profile == ECompatibilityProfile ||
|
||||
(profile == ECoreProfile && version < 420) ||
|
||||
profile == ENoProfile) {
|
||||
s->append(
|
||||
"vec4 texture2DLod(sampler2D, vec2, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjLod(sampler2D, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjLod(sampler2D, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
|
||||
"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
|
||||
"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
profile == ENoProfile) {
|
||||
if (spv == 0) {
|
||||
s->append(
|
||||
"vec4 texture2DLod(sampler2D, vec2, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjLod(sampler2D, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjLod(sampler2D, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DLod(sampler3D, vec3, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
|
||||
"vec4 texture3DProjLod(sampler3D, vec4, float);" // GL_ARB_shader_texture_lod // OES_texture_3D, but caught by keyword check
|
||||
"vec4 textureCubeLod(samplerCube, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
|
||||
"\n");
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
if ( profile == ECompatibilityProfile ||
|
||||
(profile == ECoreProfile && version < 420) ||
|
||||
profile == ENoProfile) {
|
||||
s->append(
|
||||
"vec4 texture1DLod(sampler1D, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjLod(sampler1D, vec2, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjLod(sampler1D, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DLod(sampler1DShadow, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DLod(sampler2DShadow, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
if (spv == 0) {
|
||||
s->append(
|
||||
"vec4 texture1DLod(sampler1D, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjLod(sampler1D, vec2, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjLod(sampler1D, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DLod(sampler1DShadow, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DLod(sampler2DShadow, vec3, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DProjLod(sampler1DShadow, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DProjLod(sampler2DShadow, vec4, float);" // GL_ARB_shader_texture_lod
|
||||
|
||||
"vec4 texture1DGradARB(sampler1D, float, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjGradARB(sampler1D, vec2, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjGradARB(sampler1D, vec4, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DGradARB(sampler2D, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjGradARB(sampler2D, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjGradARB(sampler2D, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DGradARB(sampler3D, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DProjGradARB(sampler3D, vec4, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 textureCubeGradARB(samplerCube, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DGradARB(sampler1DShadow, vec3, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DProjGradARB( sampler1DShadow, vec4, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DGradARB(sampler2DShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DProjGradARB( sampler2DShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectGradARB(sampler2DRect, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectProjGradARB( sampler2DRect, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectProjGradARB( sampler2DRect, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DRectGradARB( sampler2DRectShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DRectProjGradARB(sampler2DRectShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DGradARB(sampler1D, float, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjGradARB(sampler1D, vec2, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture1DProjGradARB(sampler1D, vec4, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DGradARB(sampler2D, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjGradARB(sampler2D, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DProjGradARB(sampler2D, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DGradARB(sampler3D, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture3DProjGradARB(sampler3D, vec4, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 textureCubeGradARB(samplerCube, vec3, vec3, vec3);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DGradARB(sampler1DShadow, vec3, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow1DProjGradARB( sampler1DShadow, vec4, float, float);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DGradARB(sampler2DShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DProjGradARB( sampler2DShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectGradARB(sampler2DRect, vec2, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectProjGradARB( sampler2DRect, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 texture2DRectProjGradARB( sampler2DRect, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DRectGradARB( sampler2DRectShadow, vec3, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
"vec4 shadow2DRectProjGradARB(sampler2DRectShadow, vec4, vec2, vec2);" // GL_ARB_shader_texture_lod
|
||||
|
||||
"\n");
|
||||
"\n");
|
||||
}
|
||||
}
|
||||
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
|
|
@ -1095,7 +1105,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
//
|
||||
// Original-style texture Functions with bias.
|
||||
//
|
||||
if (profile != EEsProfile || version == 100) {
|
||||
if (spv == 0 && (profile != EEsProfile || version == 100)) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"vec4 texture2D(sampler2D, vec2, float);"
|
||||
"vec4 texture2DProj(sampler2D, vec3, float);"
|
||||
|
|
@ -1106,7 +1116,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
|
||||
"\n");
|
||||
}
|
||||
if (profile != EEsProfile && version > 100) {
|
||||
if (spv == 0 && (profile != EEsProfile && version > 100)) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"vec4 texture1D(sampler1D, float, float);"
|
||||
"vec4 texture1DProj(sampler1D, vec2, float);"
|
||||
|
|
@ -1118,7 +1128,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
|
||||
"\n");
|
||||
}
|
||||
if (profile == EEsProfile) {
|
||||
if (spv == 0 && profile == EEsProfile) {
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"vec4 texture2DLodEXT(sampler2D, vec2, float);" // GL_EXT_shader_texture_lod
|
||||
"vec4 texture2DProjLodEXT(sampler2D, vec3, float);" // GL_EXT_shader_texture_lod
|
||||
|
|
@ -1237,7 +1247,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
"uniform gl_DepthRangeParameters gl_DepthRange;"
|
||||
"\n");
|
||||
|
||||
if (IncludeLegacy(version, profile)) {
|
||||
if (IncludeLegacy(version, profile, spv)) {
|
||||
//
|
||||
// Matrix state. p. 31, 32, 37, 39, 40.
|
||||
//
|
||||
|
|
@ -1400,7 +1410,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
"attribute vec4 gl_MultiTexCoord7;"
|
||||
"attribute float gl_FogCoord;"
|
||||
"\n");
|
||||
} else if (IncludeLegacy(version, profile)) {
|
||||
} else if (IncludeLegacy(version, profile, spv)) {
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"in vec4 gl_Color;"
|
||||
"in vec4 gl_SecondaryColor;"
|
||||
|
|
@ -1429,7 +1439,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
"varying vec4 gl_TexCoord[];"
|
||||
"varying float gl_FogFragCoord;"
|
||||
"\n");
|
||||
} else if (IncludeLegacy(version, profile)) {
|
||||
} else if (IncludeLegacy(version, profile, spv)) {
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
" vec4 gl_ClipVertex;" // needs qualifier fixed later
|
||||
"out vec4 gl_FrontColor;"
|
||||
|
|
@ -1457,7 +1467,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
"float gl_PointSize;" // needs qualifier fixed later
|
||||
"float gl_ClipDistance[];"
|
||||
);
|
||||
if (IncludeLegacy(version, profile))
|
||||
if (IncludeLegacy(version, profile, spv))
|
||||
stageBuiltins[EShLangVertex].append(
|
||||
"vec4 gl_ClipVertex;" // needs qualifier fixed later
|
||||
"vec4 gl_FrontColor;"
|
||||
|
|
@ -1750,7 +1760,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
stageBuiltins[EShLangFragment].append(
|
||||
"vec2 gl_PointCoord;" // needs qualifier fixed later
|
||||
);
|
||||
if (IncludeLegacy(version, profile) || (! ForwardCompatibility && version < 420))
|
||||
if (IncludeLegacy(version, profile, spv) || (! ForwardCompatibility && version < 420))
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"vec4 gl_FragColor;" // needs qualifier fixed later
|
||||
);
|
||||
|
|
@ -1767,7 +1777,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
"in float gl_ClipDistance[];"
|
||||
);
|
||||
|
||||
if (IncludeLegacy(version, profile)) {
|
||||
if (IncludeLegacy(version, profile, spv)) {
|
||||
if (version < 150)
|
||||
stageBuiltins[EShLangFragment].append(
|
||||
"in float gl_FogFragCoord;"
|
||||
|
|
@ -1853,7 +1863,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
stageBuiltins[EShLangFragment].append("\n");
|
||||
|
||||
if (version >= 130)
|
||||
add2ndGenerationSamplingImaging(version, profile);
|
||||
add2ndGenerationSamplingImaging(version, profile, spv);
|
||||
|
||||
//printf("%s\n", commonBuiltins.c_str());
|
||||
//printf("%s\n", stageBuiltins[EShLangFragment].c_str());
|
||||
|
|
@ -1863,7 +1873,7 @@ void TBuiltIns::initialize(int version, EProfile profile)
|
|||
// Helper function for initialize(), to add the second set of names for texturing,
|
||||
// when adding context-independent built-in functions.
|
||||
//
|
||||
void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
|
||||
void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile, int spv)
|
||||
{
|
||||
//
|
||||
// In this function proper, enumerate the types, then calls the next set of functions
|
||||
|
|
@ -1879,7 +1889,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
|
|||
|
||||
for (int shadow = 0; shadow <= 1; ++shadow) { // loop over "bool" shadow or not
|
||||
for (int ms = 0; ms <=1; ++ms) {
|
||||
|
||||
if ((ms || image) && shadow)
|
||||
continue;
|
||||
if (ms && profile != EEsProfile && version < 150)
|
||||
|
|
@ -1891,7 +1900,6 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
|
|||
|
||||
for (int arrayed = 0; arrayed <= 1; ++arrayed) { // loop over "bool" arrayed or not
|
||||
for (int dim = Esd1D; dim < EsdNumDims; ++dim) { // 1D, 2D, ..., buffer
|
||||
|
||||
if ((dim == Esd1D || dim == EsdRect) && profile == EEsProfile)
|
||||
continue;
|
||||
if (dim != Esd2D && ms)
|
||||
|
|
@ -1922,11 +1930,15 @@ void TBuiltIns::add2ndGenerationSamplingImaging(int version, EProfile profile)
|
|||
//
|
||||
|
||||
TSampler sampler;
|
||||
sampler.set(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
|
||||
shadow ? true : false,
|
||||
ms ? true : false);
|
||||
if (image)
|
||||
sampler.image = true;
|
||||
if (image) {
|
||||
sampler.setImage(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
|
||||
shadow ? true : false,
|
||||
ms ? true : false);
|
||||
} else {
|
||||
sampler.set(bTypes[bType], (TSamplerDim)dim, arrayed ? true : false,
|
||||
shadow ? true : false,
|
||||
ms ? true : false);
|
||||
}
|
||||
|
||||
TString typeName = sampler.getString();
|
||||
|
||||
|
|
@ -2374,7 +2386,7 @@ void TBuiltIns::addGatherFunctions(TSampler sampler, TString& typeName, int vers
|
|||
// add stage-specific entries to the commonBuiltins, and only if that stage
|
||||
// was requested.
|
||||
//
|
||||
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, EShLanguage language)
|
||||
void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProfile profile, int spv, EShLanguage language)
|
||||
{
|
||||
//
|
||||
// Initialize the context-dependent (resource-dependent) built-in strings for parsing.
|
||||
|
|
@ -2537,7 +2549,7 @@ void TBuiltIns::initialize(const TBuiltInResource &resources, int version, EProf
|
|||
snprintf(builtInConstant, maxSize, "const int gl_MaxFragmentUniformComponents = %d;", resources.maxFragmentUniformComponents);
|
||||
s.append(builtInConstant);
|
||||
|
||||
if (IncludeLegacy(version, profile)) {
|
||||
if (IncludeLegacy(version, profile, spv)) {
|
||||
//
|
||||
// OpenGL'uniform' state. Page numbers are in reference to version
|
||||
// 1.4 of the OpenGL specification.
|
||||
|
|
@ -2881,7 +2893,7 @@ void BuiltInVariable(const char* blockName, const char* name, TBuiltInVariable b
|
|||
// 3) Tag extension-related symbols added to their base version with their extensions, so
|
||||
// that if an early version has the extension turned off, there is an error reported on use.
|
||||
//
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable)
|
||||
void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage language, TSymbolTable& symbolTable)
|
||||
{
|
||||
//
|
||||
// Tag built-in variables and functions with additional qualifier and extension information
|
||||
|
|
@ -2908,25 +2920,29 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
}
|
||||
|
||||
// Compatibility variables, vertex only
|
||||
BuiltInVariable("gl_Color", EbvColor, symbolTable);
|
||||
BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);
|
||||
BuiltInVariable("gl_Normal", EbvNormal, symbolTable);
|
||||
BuiltInVariable("gl_Vertex", EbvVertex, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord0", EbvMultiTexCoord0, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord1", EbvMultiTexCoord1, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord2", EbvMultiTexCoord2, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord3", EbvMultiTexCoord3, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord4", EbvMultiTexCoord4, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord5", EbvMultiTexCoord5, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord6", EbvMultiTexCoord6, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable);
|
||||
BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable);
|
||||
if (spv == 0) {
|
||||
BuiltInVariable("gl_Color", EbvColor, symbolTable);
|
||||
BuiltInVariable("gl_SecondaryColor", EbvSecondaryColor, symbolTable);
|
||||
BuiltInVariable("gl_Normal", EbvNormal, symbolTable);
|
||||
BuiltInVariable("gl_Vertex", EbvVertex, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord0", EbvMultiTexCoord0, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord1", EbvMultiTexCoord1, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord2", EbvMultiTexCoord2, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord3", EbvMultiTexCoord3, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord4", EbvMultiTexCoord4, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord5", EbvMultiTexCoord5, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord6", EbvMultiTexCoord6, symbolTable);
|
||||
BuiltInVariable("gl_MultiTexCoord7", EbvMultiTexCoord7, symbolTable);
|
||||
BuiltInVariable("gl_FogCoord", EbvFogFragCoord, symbolTable);
|
||||
}
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
|
||||
if (spv == 0) {
|
||||
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
|
||||
}
|
||||
if (version >= 310)
|
||||
symbolTable.setFunctionExtensions("fma", Num_AEP_gpu_shader5, AEP_gpu_shader5);
|
||||
}
|
||||
|
|
@ -3071,13 +3087,15 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
// built-in functions
|
||||
|
||||
if (profile == EEsProfile) {
|
||||
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
|
||||
if (spv == 0) {
|
||||
symbolTable.setFunctionExtensions("texture2DLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeLodEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeGradEXT", 1, &E_GL_EXT_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureGatherOffsets", Num_AEP_gpu_shader5, AEP_gpu_shader5);
|
||||
}
|
||||
if (version == 100) {
|
||||
symbolTable.setFunctionExtensions("dFdx", 1, &E_GL_OES_standard_derivatives);
|
||||
symbolTable.setFunctionExtensions("dFdy", 1, &E_GL_OES_standard_derivatives);
|
||||
|
|
@ -3090,21 +3108,23 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
symbolTable.setFunctionExtensions("interpolateAtOffset", 1, &E_GL_OES_shader_multisample_interpolation);
|
||||
}
|
||||
} else if (version < 130) {
|
||||
symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture3DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow1DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow2DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
if (spv == 0) {
|
||||
symbolTable.setFunctionExtensions("texture1DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture3DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("textureCubeLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture3DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow1DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow2DLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow1DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("shadow2DProjLod", 1, &E_GL_ARB_shader_texture_lod);
|
||||
}
|
||||
}
|
||||
|
||||
// E_GL_ARB_shader_texture_lod functions usable only with the extension enabled
|
||||
if (profile != EEsProfile) {
|
||||
if (profile != EEsProfile && spv == 0) {
|
||||
symbolTable.setFunctionExtensions("texture1DGradARB", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture1DProjGradARB", 1, &E_GL_ARB_shader_texture_lod);
|
||||
symbolTable.setFunctionExtensions("texture2DGradARB", 1, &E_GL_ARB_shader_texture_lod);
|
||||
|
|
@ -3346,7 +3366,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
symbolTable.relateToOperator("textureGatherOffset", EOpTextureGatherOffset);
|
||||
symbolTable.relateToOperator("textureGatherOffsets", EOpTextureGatherOffsets);
|
||||
|
||||
if (IncludeLegacy(version, profile) || (profile == EEsProfile && version == 100)) {
|
||||
if (spv == 0 && (IncludeLegacy(version, profile, spv) || (profile == EEsProfile && version == 100))) {
|
||||
symbolTable.relateToOperator("ftransform", EOpFtransform);
|
||||
|
||||
symbolTable.relateToOperator("texture1D", EOpTexture);
|
||||
|
|
@ -3453,7 +3473,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
// 2) Tag extension-related symbols added to their base version with their extensions, so
|
||||
// that if an early version has the extension turned off, there is an error reported on use.
|
||||
//
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
||||
void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage language, TSymbolTable& symbolTable, const TBuiltInResource &resources)
|
||||
{
|
||||
if (profile != EEsProfile && version >= 430 && version < 440) {
|
||||
symbolTable.setVariableExtensions("gl_MaxTransformFeedbackBuffers", 1, &E_GL_ARB_enhanced_layouts);
|
||||
|
|
@ -3469,7 +3489,7 @@ void IdentifyBuiltIns(int version, EProfile profile, EShLanguage language, TSymb
|
|||
switch(language) {
|
||||
case EShLangFragment:
|
||||
// Set up gl_FragData based on current array size.
|
||||
if (version == 100 || IncludeLegacy(version, profile) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
|
||||
if (version == 100 || IncludeLegacy(version, profile, spv) || (! ForwardCompatibility && profile != EEsProfile && version < 420)) {
|
||||
TPrecisionQualifier pq = profile == EEsProfile ? EpqMedium : EpqNone;
|
||||
TType fragData(EbtFloat, EvqFragColor, pq, 4);
|
||||
TArraySizes& arraySizes = *new TArraySizes;
|
||||
|
|
|
|||
|
|
@ -59,13 +59,13 @@ public:
|
|||
POOL_ALLOCATOR_NEW_DELETE(GetThreadPoolAllocator())
|
||||
TBuiltIns();
|
||||
virtual ~TBuiltIns();
|
||||
void initialize(int version, EProfile);
|
||||
void initialize(const TBuiltInResource& resources, int version, EProfile, EShLanguage);
|
||||
void initialize(int version, EProfile, int spv);
|
||||
void initialize(const TBuiltInResource& resources, int version, EProfile, int spv, EShLanguage);
|
||||
const TString& getCommonString() const { return commonBuiltins; }
|
||||
const TString& getStageString(EShLanguage language) const { return stageBuiltins[language]; }
|
||||
|
||||
protected:
|
||||
void add2ndGenerationSamplingImaging(int version, EProfile profile);
|
||||
void add2ndGenerationSamplingImaging(int version, EProfile profile, int spv);
|
||||
void addQueryFunctions(TSampler, TString& typeName, int version, EProfile profile);
|
||||
void addImageFunctions(TSampler, TString& typeName, int version, EProfile profile);
|
||||
void addSamplingFunctions(TSampler, TString& typeName, int version, EProfile profile);
|
||||
|
|
@ -81,8 +81,8 @@ protected:
|
|||
int dimMap[EsdNumDims];
|
||||
};
|
||||
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage, TSymbolTable&);
|
||||
void IdentifyBuiltIns(int version, EProfile profile, EShLanguage, TSymbolTable&, const TBuiltInResource &resources);
|
||||
void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage, TSymbolTable&);
|
||||
void IdentifyBuiltIns(int version, EProfile profile, int spv, EShLanguage, TSymbolTable&, const TBuiltInResource &resources);
|
||||
|
||||
} // end namespace glslang
|
||||
|
||||
|
|
|
|||
|
|
@ -47,10 +47,10 @@ extern int yyparse(glslang::TParseContext*);
|
|||
|
||||
namespace glslang {
|
||||
|
||||
TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, EShLanguage L, TInfoSink& is,
|
||||
TParseContext::TParseContext(TSymbolTable& symt, TIntermediate& interm, bool pb, int v, EProfile p, int spv, EShLanguage L, TInfoSink& is,
|
||||
bool fc, EShMessages m) :
|
||||
intermediate(interm), symbolTable(symt), infoSink(is), language(L),
|
||||
version(v), profile(p), forwardCompatible(fc),
|
||||
version(v), profile(p), spv(spv), forwardCompatible(fc),
|
||||
contextPragma(true, false), loopNestingLevel(0), structNestingLevel(0), controlFlowNestingLevel(0), statementNestingLevel(0),
|
||||
postMainReturn(false),
|
||||
tokensBeforeEOF(false), limits(resources.limits), messages(m), currentScanner(nullptr),
|
||||
|
|
@ -1674,11 +1674,14 @@ TFunction* TParseContext::handleConstructorCall(const TSourceLoc& loc, const TPu
|
|||
//
|
||||
TOperator TParseContext::mapTypeToConstructorOp(const TType& type) const
|
||||
{
|
||||
if (type.isStruct())
|
||||
return EOpConstructStruct;
|
||||
|
||||
TOperator op = EOpNull;
|
||||
|
||||
switch (type.getBasicType()) {
|
||||
case EbtStruct:
|
||||
op = EOpConstructStruct;
|
||||
break;
|
||||
case EbtSampler:
|
||||
break;
|
||||
case EbtFloat:
|
||||
if (type.isMatrix()) {
|
||||
switch (type.getMatrixCols()) {
|
||||
|
|
@ -2325,8 +2328,9 @@ void TParseContext::samplerCheck(const TSourceLoc& loc, const TType& type, const
|
|||
|
||||
if (type.getBasicType() == EbtStruct && containsFieldWithBasicType(type, EbtSampler))
|
||||
error(loc, "non-uniform struct contains a sampler or image:", type.getBasicTypeString().c_str(), identifier.c_str());
|
||||
else if (type.getBasicType() == EbtSampler && type.getQualifier().storage != EvqUniform)
|
||||
else if (type.getBasicType() == EbtSampler && type.getQualifier().storage != EvqUniform) {
|
||||
error(loc, "sampler/image types can only be used in uniform variables or function parameters:", type.getBasicTypeString().c_str(), identifier.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void TParseContext::atomicUintCheck(const TSourceLoc& loc, const TType& type, const TString& identifier)
|
||||
|
|
@ -3598,6 +3602,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
|||
publicType.qualifier.layoutPacking = ElpStd430;
|
||||
return;
|
||||
}
|
||||
// TODO: compile-time performance: may need to stop doing linear searches
|
||||
for (TLayoutFormat format = (TLayoutFormat)(ElfNone + 1); format < ElfCount; format = (TLayoutFormat)(format + 1)) {
|
||||
if (id == TQualifier::getLayoutFormatString(format)) {
|
||||
if ((format > ElfEsFloatGuard && format < ElfFloatGuard) ||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ typedef std::set<int> TIdSetType;
|
|||
//
|
||||
class TParseContext {
|
||||
public:
|
||||
TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, EShLanguage, TInfoSink&,
|
||||
TParseContext(TSymbolTable&, TIntermediate&, bool parsingBuiltins, int version, EProfile, int spv, EShLanguage, TInfoSink&,
|
||||
bool forwardCompatible = false, EShMessages messages = EShMsgDefault);
|
||||
virtual ~TParseContext();
|
||||
|
||||
|
|
@ -85,8 +85,6 @@ public:
|
|||
|
||||
bool relaxedErrors() const { return (messages & EShMsgRelaxedErrors) != 0; }
|
||||
bool suppressWarnings() const { return (messages & EShMsgSuppressWarnings) != 0; }
|
||||
bool vulkanRules() const { return (messages & EShMsgVulkanRules) != 0; }
|
||||
bool spirvRules() const { return (messages & EShMsgSpvRules) != 0; }
|
||||
|
||||
void reservedErrorCheck(const TSourceLoc&, const TString&);
|
||||
void reservedPpErrorCheck(const TSourceLoc&, const char* name, const char* op);
|
||||
|
|
@ -282,6 +280,7 @@ public:
|
|||
EShLanguage language; // vertex or fragment language
|
||||
int version; // version, updated by #version in the shader
|
||||
EProfile profile; // the declared profile in the shader (core by default)
|
||||
int spv; // SPIR-V version; 0 means not SPIR-V
|
||||
bool forwardCompatible; // true if errors are to be given for use of deprecated features
|
||||
|
||||
// Current state of parsing
|
||||
|
|
|
|||
|
|
@ -345,8 +345,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["mat2"] = MAT2;
|
||||
(*KeywordMap)["mat3"] = MAT3;
|
||||
(*KeywordMap)["mat4"] = MAT4;
|
||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||
(*KeywordMap)["true"] = BOOLCONSTANT;
|
||||
(*KeywordMap)["false"] = BOOLCONSTANT;
|
||||
(*KeywordMap)["attribute"] = ATTRIBUTE;
|
||||
|
|
@ -425,6 +423,13 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["dvec2"] = DVEC2;
|
||||
(*KeywordMap)["dvec3"] = DVEC3;
|
||||
(*KeywordMap)["dvec4"] = DVEC4;
|
||||
(*KeywordMap)["uint"] = UINT;
|
||||
(*KeywordMap)["uvec2"] = UVEC2;
|
||||
(*KeywordMap)["uvec3"] = UVEC3;
|
||||
(*KeywordMap)["uvec4"] = UVEC4;
|
||||
|
||||
(*KeywordMap)["sampler2D"] = SAMPLER2D;
|
||||
(*KeywordMap)["samplerCube"] = SAMPLERCUBE;
|
||||
(*KeywordMap)["samplerCubeArray"] = SAMPLERCUBEARRAY;
|
||||
(*KeywordMap)["samplerCubeArrayShadow"] = SAMPLERCUBEARRAYSHADOW;
|
||||
(*KeywordMap)["isamplerCubeArray"] = ISAMPLERCUBEARRAY;
|
||||
|
|
@ -435,10 +440,6 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["isampler1D"] = ISAMPLER1D;
|
||||
(*KeywordMap)["usampler1DArray"] = USAMPLER1DARRAY;
|
||||
(*KeywordMap)["samplerBuffer"] = SAMPLERBUFFER;
|
||||
(*KeywordMap)["uint"] = UINT;
|
||||
(*KeywordMap)["uvec2"] = UVEC2;
|
||||
(*KeywordMap)["uvec3"] = UVEC3;
|
||||
(*KeywordMap)["uvec4"] = UVEC4;
|
||||
(*KeywordMap)["samplerCubeShadow"] = SAMPLERCUBESHADOW;
|
||||
(*KeywordMap)["sampler2DArray"] = SAMPLER2DARRAY;
|
||||
(*KeywordMap)["sampler2DArrayShadow"] = SAMPLER2DARRAYSHADOW;
|
||||
|
|
@ -467,7 +468,9 @@ void TScanContext::fillInKeywordMap()
|
|||
(*KeywordMap)["sampler2DRect"] = SAMPLER2DRECT;
|
||||
(*KeywordMap)["sampler2DRectShadow"] = SAMPLER2DRECTSHADOW;
|
||||
(*KeywordMap)["sampler1DArray"] = SAMPLER1DARRAY;
|
||||
|
||||
(*KeywordMap)["samplerExternalOES"] = SAMPLEREXTERNALOES; // GL_OES_EGL_image_external
|
||||
|
||||
(*KeywordMap)["noperspective"] = NOPERSPECTIVE;
|
||||
(*KeywordMap)["smooth"] = SMOOTH;
|
||||
(*KeywordMap)["flat"] = FLAT;
|
||||
|
|
|
|||
|
|
@ -124,12 +124,12 @@ TPoolAllocator* PerProcessGPA = 0;
|
|||
//
|
||||
// Parse and add to the given symbol table the content of the given shader string.
|
||||
//
|
||||
bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profile, EShLanguage language, TInfoSink& infoSink,
|
||||
bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profile, int spv, EShLanguage language, TInfoSink& infoSink,
|
||||
TSymbolTable& symbolTable)
|
||||
{
|
||||
TIntermediate intermediate(language, version, profile);
|
||||
|
||||
TParseContext parseContext(symbolTable, intermediate, true, version, profile, language, infoSink);
|
||||
TParseContext parseContext(symbolTable, intermediate, true, version, profile, spv, language, infoSink);
|
||||
TPpContext ppContext(parseContext, TShader::ForbidInclude());
|
||||
TScanContext scanContext(parseContext);
|
||||
parseContext.setScanContext(&scanContext);
|
||||
|
|
@ -152,6 +152,7 @@ bool InitializeSymbolTable(const TString& builtIns, int version, EProfile profil
|
|||
if (! parseContext.parseShaderStrings(ppContext, input) != 0) {
|
||||
infoSink.info.message(EPrefixInternalError, "Unable to parse built-ins");
|
||||
printf("Unable to parse built-ins\n%s\n", infoSink.info.c_str());
|
||||
printf("%s\n", builtInShaders[0]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
@ -167,11 +168,11 @@ int CommonIndex(EProfile profile, EShLanguage language)
|
|||
//
|
||||
// To initialize per-stage shared tables, with the common table already complete.
|
||||
//
|
||||
void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profile, EShLanguage language, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables)
|
||||
void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profile, int spv, EShLanguage language, TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables)
|
||||
{
|
||||
(*symbolTables[language]).adoptLevels(*commonTable[CommonIndex(profile, language)]);
|
||||
InitializeSymbolTable(builtIns.getStageString(language), version, profile, language, infoSink, *symbolTables[language]);
|
||||
IdentifyBuiltIns(version, profile, language, *symbolTables[language]);
|
||||
InitializeSymbolTable(builtIns.getStageString(language), version, profile, spv, language, infoSink, *symbolTables[language]);
|
||||
IdentifyBuiltIns(version, profile, spv, language, *symbolTables[language]);
|
||||
if (profile == EEsProfile && version >= 300)
|
||||
(*symbolTables[language]).setNoBuiltInRedeclarations();
|
||||
if (version == 110)
|
||||
|
|
@ -182,49 +183,49 @@ void InitializeStageSymbolTable(TBuiltIns& builtIns, int version, EProfile profi
|
|||
// Initialize the full set of shareable symbol tables;
|
||||
// The common (cross-stage) and those shareable per-stage.
|
||||
//
|
||||
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile)
|
||||
bool InitializeSymbolTables(TInfoSink& infoSink, TSymbolTable** commonTable, TSymbolTable** symbolTables, int version, EProfile profile, int spv)
|
||||
{
|
||||
TBuiltIns builtIns;
|
||||
builtIns.initialize(version, profile);
|
||||
builtIns.initialize(version, profile, spv);
|
||||
|
||||
// do the common tables
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, EShLangVertex, infoSink, *commonTable[EPcGeneral]);
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, EShLangVertex, infoSink, *commonTable[EPcGeneral]);
|
||||
if (profile == EEsProfile)
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, EShLangFragment, infoSink, *commonTable[EPcFragment]);
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, EShLangFragment, infoSink, *commonTable[EPcFragment]);
|
||||
|
||||
// do the per-stage tables
|
||||
|
||||
// always have vertex and fragment
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangVertex, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangFragment, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangVertex, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangFragment, infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for tessellation
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
(profile == EEsProfile && version >= 310)) {
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangTessControl, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangTessEvaluation, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangTessControl, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangTessEvaluation, infoSink, commonTable, symbolTables);
|
||||
}
|
||||
|
||||
// check for geometry
|
||||
if ((profile != EEsProfile && version >= 150) ||
|
||||
(profile == EEsProfile && version >= 310))
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangGeometry, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangGeometry, infoSink, commonTable, symbolTables);
|
||||
|
||||
// check for compute
|
||||
if ((profile != EEsProfile && version >= 430) ||
|
||||
(profile == EEsProfile && version >= 310))
|
||||
InitializeStageSymbolTable(builtIns, version, profile, EShLangCompute, infoSink, commonTable, symbolTables);
|
||||
InitializeStageSymbolTable(builtIns, version, profile, spv, EShLangCompute, infoSink, commonTable, symbolTables);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version, EProfile profile, EShLanguage language)
|
||||
bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& infoSink, TSymbolTable& symbolTable, int version, EProfile profile, int spv, EShLanguage language)
|
||||
{
|
||||
TBuiltIns builtIns;
|
||||
|
||||
builtIns.initialize(*resources, version, profile, language);
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, language, infoSink, symbolTable);
|
||||
IdentifyBuiltIns(version, profile, language, symbolTable, *resources);
|
||||
builtIns.initialize(*resources, version, profile, spv, language);
|
||||
InitializeSymbolTable(builtIns.getCommonString(), version, profile, spv, language, infoSink, symbolTable);
|
||||
IdentifyBuiltIns(version, profile, spv, language, symbolTable, *resources);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -241,7 +242,7 @@ bool AddContextSpecificSymbols(const TBuiltInResource* resources, TInfoSink& inf
|
|||
// This only gets done the first time any thread needs a particular symbol table
|
||||
// (lazy evaluation).
|
||||
//
|
||||
void SetupBuiltinSymbolTable(int version, EProfile profile)
|
||||
void SetupBuiltinSymbolTable(int version, EProfile profile, int spv)
|
||||
{
|
||||
TInfoSink infoSink;
|
||||
|
||||
|
|
@ -271,7 +272,7 @@ void SetupBuiltinSymbolTable(int version, EProfile profile)
|
|||
stageTables[stage] = new TSymbolTable;
|
||||
|
||||
// Generate the local symbol tables using the new pool
|
||||
InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile);
|
||||
InitializeSymbolTables(infoSink, commonTable, stageTables, version, profile, spv);
|
||||
|
||||
// Switch to the process-global pool
|
||||
SetThreadPoolAllocator(*PerProcessGPA);
|
||||
|
|
@ -542,9 +543,11 @@ bool ProcessDeferred(
|
|||
versionWillBeError = true;
|
||||
}
|
||||
|
||||
int spv = (messages & EShMsgSpvRules) ? 100 : 0;
|
||||
intermediate.setVersion(version);
|
||||
intermediate.setProfile(profile);
|
||||
SetupBuiltinSymbolTable(version, profile);
|
||||
intermediate.setSpv(spv);
|
||||
SetupBuiltinSymbolTable(version, profile, spv);
|
||||
|
||||
TSymbolTable* cachedTable = SharedSymbolTables[MapVersionToIndex(version)]
|
||||
[MapProfileToIndex(profile)]
|
||||
|
|
@ -558,13 +561,13 @@ bool ProcessDeferred(
|
|||
|
||||
// Add built-in symbols that are potentially context dependent;
|
||||
// they get popped again further down.
|
||||
AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, compiler->getLanguage());
|
||||
AddContextSpecificSymbols(resources, compiler->infoSink, symbolTable, version, profile, spv, compiler->getLanguage());
|
||||
|
||||
//
|
||||
// Now we can process the full shader under proper symbols and rules.
|
||||
//
|
||||
|
||||
TParseContext parseContext(symbolTable, intermediate, false, version, profile, compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages);
|
||||
TParseContext parseContext(symbolTable, intermediate, false, version, profile, spv, compiler->getLanguage(), compiler->infoSink, forwardCompatible, messages);
|
||||
glslang::TScanContext scanContext(parseContext);
|
||||
TPpContext ppContext(parseContext, includer);
|
||||
parseContext.setScanContext(&scanContext);
|
||||
|
|
@ -1271,6 +1274,11 @@ const char* GetGlslVersionString()
|
|||
return "4.20 glslang LunarG Khronos." GLSLANG_REVISION " " GLSLANG_DATE;
|
||||
}
|
||||
|
||||
int GetKhronosToolId()
|
||||
{
|
||||
return 8;
|
||||
}
|
||||
|
||||
bool InitializeProcess()
|
||||
{
|
||||
return ShInitialize() != 0;
|
||||
|
|
|
|||
|
|
@ -134,6 +134,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
|
|||
%token <lex> DMAT4X2 DMAT4X3 DMAT4X4
|
||||
%token <lex> ATOMIC_UINT
|
||||
|
||||
// combined image/sampler
|
||||
%token <lex> SAMPLER1D SAMPLER2D SAMPLER3D SAMPLERCUBE SAMPLER1DSHADOW SAMPLER2DSHADOW
|
||||
%token <lex> SAMPLERCUBESHADOW SAMPLER1DARRAY SAMPLER2DARRAY SAMPLER1DARRAYSHADOW
|
||||
%token <lex> SAMPLER2DARRAYSHADOW ISAMPLER1D ISAMPLER2D ISAMPLER3D ISAMPLERCUBE
|
||||
|
|
|
|||
|
|
@ -381,7 +381,7 @@ bool TOutputTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* node
|
|||
case EOpConstructDMat3x4: out.debug << "Construct dmat3x4"; break;
|
||||
case EOpConstructDMat4x2: out.debug << "Construct dmat4x2"; break;
|
||||
case EOpConstructDMat4x3: out.debug << "Construct dmat4x3"; break;
|
||||
case EOpConstructDMat4x4: out.debug << "Construct dmat4"; break;
|
||||
case EOpConstructDMat4x4: out.debug << "Construct dmat4"; break;
|
||||
case EOpConstructStruct: out.debug << "Construct structure"; break;
|
||||
|
||||
case EOpLessThan: out.debug << "Compare Less Than"; break;
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ class TVariable;
|
|||
//
|
||||
class TIntermediate {
|
||||
public:
|
||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v),
|
||||
explicit TIntermediate(EShLanguage l, int v = 0, EProfile p = ENoProfile) : language(l), treeRoot(0), profile(p), version(v), spv(0),
|
||||
numMains(0), numErrors(0), recursive(false),
|
||||
invocations(0), vertices(0), inputPrimitive(ElgNone), outputPrimitive(ElgNone), pixelCenterInteger(false), originUpperLeft(false),
|
||||
vertexSpacing(EvsNone), vertexOrder(EvoNone), pointMode(false), earlyFragmentTests(false), depthLayout(EldNone), depthReplacing(false), blendEquations(0), xfbMode(false)
|
||||
|
|
@ -144,6 +144,8 @@ public:
|
|||
int getVersion() const { return version; }
|
||||
void setProfile(EProfile p) { profile = p; }
|
||||
EProfile getProfile() const { return profile; }
|
||||
void setSpv(int s) { spv = s; }
|
||||
int getSpv() const { return spv; }
|
||||
EShLanguage getStage() const { return language; }
|
||||
void addRequestedExtension(const char* extension) { requestedExtensions.insert(extension); }
|
||||
const std::set<std::string>& getRequestedExtensions() const { return requestedExtensions; }
|
||||
|
|
@ -320,6 +322,7 @@ protected:
|
|||
TIntermNode* treeRoot;
|
||||
EProfile profile;
|
||||
int version;
|
||||
int spv;
|
||||
std::set<std::string> requestedExtensions; // cumulation of all enabled or required extensions; not connected to what subset of the shader used them
|
||||
TBuiltInResource resources;
|
||||
int numMains;
|
||||
|
|
|
|||
|
|
@ -242,7 +242,7 @@ SH_IMPORT_EXPORT int ShGetUniformLocation(const ShHandle uniformMap, const char*
|
|||
// The below is further designed to handle multiple compilation units per stage, where
|
||||
// the intermediate results, including the parse tree, are preserved until link time,
|
||||
// rather than the above interface which is designed to have each compilation unit
|
||||
// lowered at compile time. In above model, linking occurs on the lowered results,
|
||||
// lowered at compile time. In the above model, linking occurs on the lowered results,
|
||||
// whereas in this model intra-stage linking can occur at the parse tree
|
||||
// (treeRoot in TIntermediate) level, and then a full stage can be lowered.
|
||||
//
|
||||
|
|
@ -258,6 +258,7 @@ namespace glslang {
|
|||
|
||||
const char* GetEsslVersionString();
|
||||
const char* GetGlslVersionString();
|
||||
int GetKhronosToolId();
|
||||
|
||||
class TIntermediate;
|
||||
class TProgram;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue