Add support for VK_EXT_fragment_shader_barycentric

This commit is contained in:
stusmith 2022-05-13 17:23:29 +01:00
parent 86ff4bca1d
commit ebf45697be
22 changed files with 3959 additions and 3710 deletions

View File

@ -29,7 +29,7 @@
#define GLSLextKHR_H
static const int GLSLextKHRVersion = 100;
static const int GLSLextKHRRevision = 2;
static const int GLSLextKHRRevision = 3;
static const char* const E_SPV_KHR_shader_ballot = "SPV_KHR_shader_ballot";
static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vote";
@ -52,5 +52,6 @@ static const char* const E_SPV_KHR_fragment_shading_rate = "SPV_KHR_fragm
static const char* const E_SPV_KHR_terminate_invocation = "SPV_KHR_terminate_invocation";
static const char* const E_SPV_KHR_workgroup_memory_explicit_layout = "SPV_KHR_workgroup_memory_explicit_layout";
static const char* const E_SPV_KHR_subgroup_uniform_control_flow = "SPV_KHR_subgroup_uniform_control_flow";
static const char* const E_SPV_KHR_fragment_shader_barycentric = "SPV_KHR_fragment_shader_barycentric";
#endif // #ifndef GLSLextKHR_H

View File

@ -1050,6 +1050,15 @@ spv::BuiltIn TGlslangToSpvTraverser::TranslateBuiltInDecoration(glslang::TBuiltI
builder.addCapability(spv::CapabilityFragmentBarycentricNV);
return spv::BuiltInBaryCoordNoPerspNV;
case glslang::EbvBaryCoordEXT:
builder.addExtension(spv::E_SPV_KHR_fragment_shader_barycentric);
builder.addCapability(spv::CapabilityFragmentBarycentricKHR);
return spv::BuiltInBaryCoordKHR;
case glslang::EbvBaryCoordNoPerspEXT:
builder.addExtension(spv::E_SPV_KHR_fragment_shader_barycentric);
builder.addCapability(spv::CapabilityFragmentBarycentricKHR);
return spv::BuiltInBaryCoordNoPerspKHR;
// mesh shaders
case glslang::EbvTaskCountNV:
return spv::BuiltInTaskCountNV;
@ -8866,6 +8875,12 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol
builder.addExtension(spv::E_SPV_NV_fragment_shader_barycentric);
}
if (symbol->getQualifier().pervertexEXT) {
builder.addDecoration(id, spv::DecorationPerVertexKHR);
builder.addCapability(spv::CapabilityFragmentBarycentricKHR);
builder.addExtension(spv::E_SPV_KHR_fragment_shader_barycentric);
}
if (glslangIntermediate->getHlslFunctionality1() && symbol->getType().getQualifier().semanticName != nullptr) {
builder.addExtension("SPV_GOOGLE_hlsl_functionality1");
builder.addDecoration(id, (spv::Decoration)spv::DecorationHlslSemanticGOOGLE,

View File

@ -305,7 +305,8 @@ const char* DecorationString(int decoration)
case DecorationPerPrimitiveNV: return "PerPrimitiveNV";
case DecorationPerViewNV: return "PerViewNV";
case DecorationPerTaskNV: return "PerTaskNV";
case DecorationPerVertexNV: return "PerVertexNV";
case DecorationPerVertexKHR: return "PerVertexKHR";
case DecorationNonUniformEXT: return "DecorationNonUniformEXT";
case DecorationHlslCounterBufferGOOGLE: return "DecorationHlslCounterBufferGOOGLE";
@ -407,8 +408,8 @@ const char* BuiltInString(int builtIn)
case BuiltInViewportMaskPerViewNV: return "ViewportMaskPerViewNV";
// case BuiltInFragmentSizeNV: return "FragmentSizeNV"; // superseded by BuiltInFragSizeEXT
// case BuiltInInvocationsPerPixelNV: return "InvocationsPerPixelNV"; // superseded by BuiltInFragInvocationCountEXT
case BuiltInBaryCoordNV: return "BaryCoordNV";
case BuiltInBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
case BuiltInBaryCoordKHR: return "BaryCoordKHR";
case BuiltInBaryCoordNoPerspKHR: return "BaryCoordNoPerspKHR";
case BuiltInFragSizeEXT: return "FragSizeEXT";
case BuiltInFragInvocationCountEXT: return "FragInvocationCountEXT";
@ -932,7 +933,7 @@ const char* CapabilityString(int info)
case CapabilityRayTraversalPrimitiveCullingKHR: return "RayTraversalPrimitiveCullingKHR";
case CapabilityComputeDerivativeGroupQuadsNV: return "ComputeDerivativeGroupQuadsNV";
case CapabilityComputeDerivativeGroupLinearNV: return "ComputeDerivativeGroupLinearNV";
case CapabilityFragmentBarycentricNV: return "FragmentBarycentricNV";
case CapabilityFragmentBarycentricKHR: return "FragmentBarycentricKHR";
case CapabilityMeshShadingNV: return "MeshShadingNV";
case CapabilityImageFootprintNV: return "ImageFootprintNV";
// case CapabilityShadingRateNV: return "ShadingRateNV"; // superseded by FragmentDensityEXT

View File

@ -4,7 +4,7 @@ spv.fragmentShaderBarycentric.frag
// Id's are bound by 43
Capability Shader
Capability FragmentBarycentricNV
Capability FragmentBarycentricKHR
Extension "SPV_NV_fragment_shader_barycentric"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
@ -19,10 +19,10 @@ spv.fragmentShaderBarycentric.frag
MemberName 17(vertices) 0 "attrib"
Name 21 "v"
Decorate 8(value) Location 1
Decorate 11(gl_BaryCoordNV) BuiltIn BaryCoordNV
Decorate 11(gl_BaryCoordNV) BuiltIn BaryCoordKHR
Decorate 17(vertices) Block
Decorate 21(v) Location 0
Decorate 21(v) PerVertexNV
Decorate 21(v) PerVertexKHR
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@ -4,7 +4,7 @@ spv.fragmentShaderBarycentric2.frag
// Id's are bound by 42
Capability Shader
Capability FragmentBarycentricNV
Capability FragmentBarycentricKHR
Extension "SPV_NV_fragment_shader_barycentric"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
@ -17,9 +17,9 @@ spv.fragmentShaderBarycentric2.frag
Name 11 "gl_BaryCoordNoPerspNV"
Name 20 "vertexIDs"
Decorate 8(value) Location 1
Decorate 11(gl_BaryCoordNoPerspNV) BuiltIn BaryCoordNoPerspNV
Decorate 11(gl_BaryCoordNoPerspNV) BuiltIn BaryCoordNoPerspKHR
Decorate 20(vertexIDs) Location 0
Decorate 20(vertexIDs) PerVertexNV
Decorate 20(vertexIDs) PerVertexKHR
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@ -0,0 +1,69 @@
spv.fragmentShaderBarycentric3.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 43
Capability Shader
Capability FragmentBarycentricKHR
Extension "SPV_KHR_fragment_shader_barycentric"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 11 21
ExecutionMode 4 OriginUpperLeft
Source GLSL 450
SourceExtension "GL_EXT_fragment_shader_barycentric"
Name 4 "main"
Name 8 "value"
Name 11 "gl_BaryCoordEXT"
Name 17 "vertices"
MemberName 17(vertices) 0 "attrib"
Name 21 "v"
Decorate 8(value) Location 1
Decorate 11(gl_BaryCoordEXT) BuiltIn BaryCoordKHR
Decorate 17(vertices) Block
Decorate 21(v) Location 0
Decorate 21(v) PerVertexKHR
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Output 6(float)
8(value): 7(ptr) Variable Output
9: TypeVector 6(float) 3
10: TypePointer Input 9(fvec3)
11(gl_BaryCoordEXT): 10(ptr) Variable Input
12: TypeInt 32 0
13: 12(int) Constant 0
14: TypePointer Input 6(float)
17(vertices): TypeStruct 6(float)
18: 12(int) Constant 3
19: TypeArray 17(vertices) 18
20: TypePointer Input 19
21(v): 20(ptr) Variable Input
22: TypeInt 32 1
23: 22(int) Constant 0
27: 12(int) Constant 1
30: 22(int) Constant 1
35: 12(int) Constant 2
38: 22(int) Constant 2
4(main): 2 Function None 3
5: Label
15: 14(ptr) AccessChain 11(gl_BaryCoordEXT) 13
16: 6(float) Load 15
24: 14(ptr) AccessChain 21(v) 23 23
25: 6(float) Load 24
26: 6(float) FMul 16 25
28: 14(ptr) AccessChain 11(gl_BaryCoordEXT) 27
29: 6(float) Load 28
31: 14(ptr) AccessChain 21(v) 30 23
32: 6(float) Load 31
33: 6(float) FMul 29 32
34: 6(float) FAdd 26 33
36: 14(ptr) AccessChain 11(gl_BaryCoordEXT) 35
37: 6(float) Load 36
39: 14(ptr) AccessChain 21(v) 38 23
40: 6(float) Load 39
41: 6(float) FMul 37 40
42: 6(float) FAdd 34 41
Store 8(value) 42
Return
FunctionEnd

View File

@ -0,0 +1,65 @@
spv.fragmentShaderBarycentric4.frag
// Module Version 10000
// Generated by (magic number): 8000a
// Id's are bound by 42
Capability Shader
Capability FragmentBarycentricKHR
Extension "SPV_KHR_fragment_shader_barycentric"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 8 11 20
ExecutionMode 4 OriginUpperLeft
Source ESSL 320
SourceExtension "GL_EXT_fragment_shader_barycentric"
Name 4 "main"
Name 8 "value"
Name 11 "gl_BaryCoordNoPerspEXT"
Name 20 "vertexIDs"
Decorate 8(value) Location 1
Decorate 11(gl_BaryCoordNoPerspEXT) BuiltIn BaryCoordNoPerspKHR
Decorate 20(vertexIDs) Location 0
Decorate 20(vertexIDs) PerVertexKHR
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypePointer Output 6(float)
8(value): 7(ptr) Variable Output
9: TypeVector 6(float) 3
10: TypePointer Input 9(fvec3)
11(gl_BaryCoordNoPerspEXT): 10(ptr) Variable Input
12: TypeInt 32 0
13: 12(int) Constant 0
14: TypePointer Input 6(float)
17: 12(int) Constant 3
18: TypeArray 6(float) 17
19: TypePointer Input 18
20(vertexIDs): 19(ptr) Variable Input
21: TypeInt 32 1
22: 21(int) Constant 0
26: 12(int) Constant 1
29: 21(int) Constant 1
34: 12(int) Constant 2
37: 21(int) Constant 2
4(main): 2 Function None 3
5: Label
15: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspEXT) 13
16: 6(float) Load 15
23: 14(ptr) AccessChain 20(vertexIDs) 22
24: 6(float) Load 23
25: 6(float) FMul 16 24
27: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspEXT) 26
28: 6(float) Load 27
30: 14(ptr) AccessChain 20(vertexIDs) 29
31: 6(float) Load 30
32: 6(float) FMul 28 31
33: 6(float) FAdd 25 32
35: 14(ptr) AccessChain 11(gl_BaryCoordNoPerspEXT) 34
36: 6(float) Load 35
38: 14(ptr) AccessChain 20(vertexIDs) 37
39: 6(float) Load 38
40: 6(float) FMul 36 39
41: 6(float) FAdd 33 40
Store 8(value) 41
Return
FunctionEnd

View File

@ -0,0 +1,15 @@
#version 450
#extension GL_EXT_fragment_shader_barycentric : require
layout(location = 0) pervertexEXT in vertices {
float attrib;
} v[];
layout(location = 1) out float value;
void main () {
value = (gl_BaryCoordEXT.x * v[0].attrib +
gl_BaryCoordEXT.y * v[1].attrib +
gl_BaryCoordEXT.z * v[2].attrib);
}

View File

@ -0,0 +1,15 @@
#version 320 es
#extension GL_EXT_fragment_shader_barycentric : require
precision highp float;
layout(location = 0) pervertexEXT in float vertexIDs[3];
layout(location = 1) out float value;
void main () {
value = (gl_BaryCoordNoPerspEXT.x * vertexIDs[0] +
gl_BaryCoordNoPerspEXT.y * vertexIDs[1] +
gl_BaryCoordNoPerspEXT.z * vertexIDs[2]);
}

View File

@ -275,6 +275,8 @@ enum TBuiltInVariable {
// barycentrics
EbvBaryCoordNV,
EbvBaryCoordNoPerspNV,
EbvBaryCoordEXT,
EbvBaryCoordNoPerspEXT,
// mesh shaders
EbvTaskCountNV,
EbvPrimitiveCountNV,
@ -479,8 +481,10 @@ __inline const char* GetBuiltInVariableString(TBuiltInVariable v)
case EbvWorldToObject: return "WorldToObjectNV";
case EbvCurrentRayTimeNV: return "CurrentRayTimeNV";
case EbvBaryCoordNV: return "BaryCoordNV";
case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspNV";
case EbvBaryCoordEXT:
case EbvBaryCoordNV: return "BaryCoordKHR";
case EbvBaryCoordNoPerspEXT:
case EbvBaryCoordNoPerspNV: return "BaryCoordNoPerspKHR";
case EbvTaskCountNV: return "TaskCountNV";
case EbvPrimitiveCountNV: return "PrimitiveCountNV";

View File

@ -552,6 +552,7 @@ public:
perViewNV = false;
perTaskNV = false;
#endif
pervertexEXT = false;
}
void clearMemory()
@ -604,7 +605,8 @@ public:
bool isNoContraction() const { return false; }
void setNoContraction() { }
bool isPervertexNV() const { return false; }
void setNullInit() { }
bool isPervertexEXT() const { return pervertexEXT; }
void setNullInit() {}
bool isNullInit() const { return false; }
void setSpirvByReference() { }
bool isSpirvByReference() { return false; }
@ -615,6 +617,7 @@ public:
bool nopersp : 1;
bool explicitInterp : 1;
bool pervertexNV : 1;
bool pervertexEXT : 1;
bool perPrimitiveNV : 1;
bool perViewNV : 1;
bool perTaskNV : 1;
@ -663,12 +666,13 @@ public:
}
bool isAuxiliary() const
{
return centroid || patch || sample || pervertexNV;
return centroid || patch || sample || pervertexNV || pervertexEXT;
}
bool isPatch() const { return patch; }
bool isNoContraction() const { return noContraction; }
void setNoContraction() { noContraction = true; }
bool isPervertexNV() const { return pervertexNV; }
bool isPervertexEXT() const { return pervertexEXT; }
void setNullInit() { nullInit = true; }
bool isNullInit() const { return nullInit; }
void setSpirvByReference() { spirvByReference = true; }
@ -856,7 +860,7 @@ public:
case EShLangTessEvaluation:
return ! patch && isPipeInput();
case EShLangFragment:
return pervertexNV && isPipeInput();
return (pervertexNV || pervertexEXT) && isPipeInput();
case EShLangMeshNV:
return ! perTaskNV && isPipeOutput();
@ -2266,6 +2270,8 @@ public:
appendStr(" __explicitInterpAMD");
if (qualifier.pervertexNV)
appendStr(" pervertexNV");
if (qualifier.pervertexEXT)
appendStr(" pervertexEXT");
if (qualifier.perPrimitiveNV)
appendStr(" perprimitiveNV");
if (qualifier.perViewNV)

View File

@ -5571,6 +5571,8 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"flat in int gl_InvocationsPerPixelNV;"
"in vec3 gl_BaryCoordNV;" // GL_NV_fragment_shader_barycentric
"in vec3 gl_BaryCoordNoPerspNV;"
"in vec3 gl_BaryCoordEXT;" // GL_EXT_fragment_shader_barycentric
"in vec3 gl_BaryCoordNoPerspEXT;"
);
if (version >= 450)
@ -5635,7 +5637,9 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangFragment].append(
"in vec3 gl_BaryCoordNV;"
"in vec3 gl_BaryCoordNoPerspNV;"
);
"in vec3 gl_BaryCoordEXT;"
"in vec3 gl_BaryCoordNoPerspEXT;"
);
if (version >= 310)
stageBuiltins[EShLangFragment].append(
"flat in highp int gl_ShadingRateEXT;" // GL_EXT_fragment_shading_rate
@ -8321,6 +8325,10 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspNV", 1, &E_GL_NV_fragment_shader_barycentric);
BuiltInVariable("gl_BaryCoordNV", EbvBaryCoordNV, symbolTable);
BuiltInVariable("gl_BaryCoordNoPerspNV", EbvBaryCoordNoPerspNV, symbolTable);
symbolTable.setVariableExtensions("gl_BaryCoordEXT", 1, &E_GL_EXT_fragment_shader_barycentric);
symbolTable.setVariableExtensions("gl_BaryCoordNoPerspEXT", 1, &E_GL_EXT_fragment_shader_barycentric);
BuiltInVariable("gl_BaryCoordEXT", EbvBaryCoordEXT, symbolTable);
BuiltInVariable("gl_BaryCoordNoPerspEXT", EbvBaryCoordNoPerspEXT, symbolTable);
}
if ((profile != EEsProfile && version >= 450) ||

View File

@ -716,7 +716,7 @@ bool TParseContext::isIoResizeArray(const TType& type) const
(language == EShLangTessControl && type.getQualifier().storage == EvqVaryingOut &&
! type.getQualifier().patch) ||
(language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn &&
type.getQualifier().pervertexNV) ||
(type.getQualifier().pervertexNV || type.getQualifier().pervertexEXT)) ||
(language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut &&
!type.getQualifier().perTaskNV));
}
@ -856,7 +856,7 @@ void TParseContext::checkIoArrayConsistency(const TSourceLoc& loc, int requiredS
error(loc, "inconsistent output number of vertices for array size of", feature, name.c_str());
else if (language == EShLangFragment) {
if (type.getOuterArraySize() > requiredSize)
error(loc, " cannot be greater than 3 for pervertexNV", feature, name.c_str());
error(loc, " cannot be greater than 3 for pervertexEXT", feature, name.c_str());
}
else if (language == EShLangMeshNV)
error(loc, "inconsistent output array size of", feature, name.c_str());
@ -3806,7 +3806,7 @@ void TParseContext::globalQualifierTypeCheck(const TSourceLoc& loc, const TQuali
if (isTypeInt(publicType.basicType) || publicType.basicType == EbtDouble)
profileRequires(loc, EEsProfile, 300, nullptr, "shader input/output");
if (!qualifier.flat && !qualifier.isExplicitInterpolation() && !qualifier.isPervertexNV()) {
if (!qualifier.flat && !qualifier.isExplicitInterpolation() && !qualifier.isPervertexNV() && !qualifier.isPervertexEXT()) {
if (isTypeInt(publicType.basicType) ||
publicType.basicType == EbtDouble ||
(publicType.userDef && ( publicType.userDef->containsBasicType(EbtInt)
@ -6069,6 +6069,8 @@ void TParseContext::mergeObjectLayoutQualifiers(TQualifier& dst, const TQualifie
dst.layoutShaderRecord = true;
if (src.pervertexNV)
dst.pervertexNV = true;
if (src.pervertexEXT)
dst.pervertexEXT = true;
#endif
}
}

View File

@ -739,6 +739,7 @@ void TScanContext::fillInKeywordMap()
(*KeywordMap)["f16subpassInputMS"] = F16SUBPASSINPUTMS;
(*KeywordMap)["__explicitInterpAMD"] = EXPLICITINTERPAMD;
(*KeywordMap)["pervertexNV"] = PERVERTEXNV;
(*KeywordMap)["pervertexEXT"] = PERVERTEXEXT;
(*KeywordMap)["precise"] = PRECISE;
(*KeywordMap)["rayPayloadNV"] = PAYLOADNV;
@ -1719,6 +1720,12 @@ int TScanContext::tokenizeIdentifier()
return keyword;
return identifierOrType();
case PERVERTEXEXT:
if ((!parseContext.isEsProfile() && parseContext.version >= 450) ||
parseContext.extensionTurnedOn(E_GL_EXT_fragment_shader_barycentric))
return keyword;
return identifierOrType();
case PRECISE:
if ((parseContext.isEsProfile() &&
(parseContext.version >= 320 || parseContext.extensionsTurnedOn(Num_AEP_gpu_shader5, AEP_gpu_shader5))) ||

View File

@ -259,6 +259,8 @@ void TParseVersions::initializeExtensionBehavior()
extensionBehavior[E_GL_EXT_shader_8bit_storage] = EBhDisable;
extensionBehavior[E_GL_EXT_subgroup_uniform_control_flow] = EBhDisable;
extensionBehavior[E_GL_EXT_fragment_shader_barycentric] = EBhDisable;
// #line and #include
extensionBehavior[E_GL_GOOGLE_cpp_style_line_directive] = EBhDisable;
extensionBehavior[E_GL_GOOGLE_include_directive] = EBhDisable;
@ -554,6 +556,8 @@ void TParseVersions::getPreamble(std::string& preamble)
"#define GL_EXT_shader_atomic_float 1\n"
"#define GL_EXT_shader_atomic_float2 1\n"
"#define GL_EXT_fragment_shader_barycentric 1\n"
;
if (version >= 150) {

View File

@ -210,6 +210,7 @@ const char* const E_GL_EXT_null_initializer = "GL_EXT_null_initi
const char* const E_GL_EXT_shared_memory_block = "GL_EXT_shared_memory_block";
const char* const E_GL_EXT_subgroup_uniform_control_flow = "GL_EXT_subgroup_uniform_control_flow";
const char* const E_GL_EXT_spirv_intrinsics = "GL_EXT_spirv_intrinsics";
const char* const E_GL_EXT_fragment_shader_barycentric = "GL_EXT_fragment_shader_barycentric";
// Arrays of extensions for the above viewportEXTs duplications

View File

@ -315,7 +315,7 @@ GLSLANG_WEB_EXCLUDE_ON
%token <lex> PATCH SAMPLE NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
%token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
%token <lex> PRECISE
GLSLANG_WEB_EXCLUDE_OFF
@ -1290,6 +1290,14 @@ GLSLANG_WEB_EXCLUDE_ON
$$.init($1.loc);
$$.qualifier.pervertexNV = true;
}
| PERVERTEXEXT {
parseContext.globalCheck($1.loc, "pervertexEXT");
parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
$$.init($1.loc);
$$.qualifier.pervertexEXT = true;
}
| PERPRIMITIVENV {
// No need for profile version or extension check. Shader stage already checks both.
parseContext.globalCheck($1.loc, "perprimitiveNV");

View File

@ -315,7 +315,7 @@ extern int yylex(YYSTYPE*, TParseContext&);
%token <lex> PATCH SAMPLE NONUNIFORM
%token <lex> COHERENT VOLATILE RESTRICT READONLY WRITEONLY DEVICECOHERENT QUEUEFAMILYCOHERENT WORKGROUPCOHERENT
%token <lex> SUBGROUPCOHERENT NONPRIVATE SHADERCALLCOHERENT
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
%token <lex> NOPERSPECTIVE EXPLICITINTERPAMD PERVERTEXEXT PERVERTEXNV PERPRIMITIVENV PERVIEWNV PERTASKNV
%token <lex> PRECISE
@ -1290,6 +1290,14 @@ interpolation_qualifier
$$.init($1.loc);
$$.qualifier.pervertexNV = true;
}
| PERVERTEXEXT {
parseContext.globalCheck($1.loc, "pervertexEXT");
parseContext.profileRequires($1.loc, ECoreProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
parseContext.profileRequires($1.loc, ECompatibilityProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
parseContext.profileRequires($1.loc, EEsProfile, 0, E_GL_EXT_fragment_shader_barycentric, "fragment shader barycentric");
$$.init($1.loc);
$$.qualifier.pervertexEXT = true;
}
| PERPRIMITIVENV {
// No need for profile version or extension check. Shader stage already checks both.
parseContext.globalCheck($1.loc, "perprimitiveNV");

File diff suppressed because it is too large Load Diff

View File

@ -501,11 +501,12 @@ extern int yydebug;
SHADERCALLCOHERENT = 702, /* SHADERCALLCOHERENT */
NOPERSPECTIVE = 703, /* NOPERSPECTIVE */
EXPLICITINTERPAMD = 704, /* EXPLICITINTERPAMD */
PERVERTEXNV = 705, /* PERVERTEXNV */
PERPRIMITIVENV = 706, /* PERPRIMITIVENV */
PERVIEWNV = 707, /* PERVIEWNV */
PERTASKNV = 708, /* PERTASKNV */
PRECISE = 709 /* PRECISE */
PERVERTEXEXT = 705, /* PERVERTEXEXT */
PERVERTEXNV = 706, /* PERVERTEXNV */
PERPRIMITIVENV = 707, /* PERPRIMITIVENV */
PERVIEWNV = 708, /* PERVIEWNV */
PERTASKNV = 709, /* PERTASKNV */
PRECISE = 710 /* PRECISE */
};
typedef enum yytokentype yytoken_kind_t;
#endif
@ -553,7 +554,7 @@ union YYSTYPE
glslang::TArraySizes* typeParameters;
} interm;
#line 557 "MachineIndependent/glslang_tab.cpp.h"
#line 558 "MachineIndependent/glslang_tab.cpp.h"
};
typedef union YYSTYPE YYSTYPE;

View File

@ -2337,7 +2337,7 @@ bool TIntermediate::isIoResizeArray(const TType& type, EShLanguage language) {
! type.getQualifier().patch) ||
(language == EShLangTessEvaluation && type.getQualifier().storage == EvqVaryingIn) ||
(language == EShLangFragment && type.getQualifier().storage == EvqVaryingIn &&
type.getQualifier().pervertexNV) ||
(type.getQualifier().pervertexNV || type.getQualifier().pervertexEXT)) ||
(language == EShLangMeshNV && type.getQualifier().storage == EvqVaryingOut &&
!type.getQualifier().perTaskNV));
}

View File

@ -484,7 +484,9 @@ INSTANTIATE_TEST_SUITE_P(
"spv.smBuiltins.frag",
"spv.builtin.PrimitiveShadingRateEXT.vert",
"spv.builtin.ShadingRateEXT.frag",
"spv.atomicAdd.bufferReference.comp"
"spv.atomicAdd.bufferReference.comp",
"spv.fragmentShaderBarycentric3.frag",
"spv.fragmentShaderBarycentric4.frag",
})),
FileNameAsCustomTestSuffix
);