Skip to content

Commit

Permalink
Based on feedback rename checkShaderStageForNVExtensions to checkExte…
Browse files Browse the repository at this point in the history
…nsionStage

Also continue error checking post requireStage() check
  • Loading branch information
sparmarNV committed Sep 27, 2018
1 parent 251344f commit 80b9872
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
20 changes: 5 additions & 15 deletions glslang/MachineIndependent/Versions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,8 @@ void TParseVersions::updateExtensionBehavior(int line, const char* extension, co
return;
}

#ifdef NV_EXTENSIONS
if (!checkShaderStageForNVExtensions(getCurrentLoc(), extension))
return;
#endif
// check if extension is used with correct shader stage
checkExtensionStage(getCurrentLoc(), extension);

// update the requested extension
updateExtensionBehavior(extension, behavior);
Expand Down Expand Up @@ -839,24 +837,16 @@ void TParseVersions::updateExtensionBehavior(const char* extension, TExtensionBe
}
}

#ifdef NV_EXTENSIONS
// Check if extension is used with correct shader stage.
bool TParseVersions::checkShaderStageForNVExtensions(const TSourceLoc& loc, const char * const extension)
void TParseVersions::checkExtensionStage(const TSourceLoc& loc, const char * const extension)
{
int lNumErrors = getNumErrors();

#ifdef NV_EXTENSIONS
// GL_NV_mesh_shader extension is only allowed in task/mesh shaders
if (strcmp(extension, "GL_NV_mesh_shader") == 0)
requireStage(loc, (EShLanguageMask)(EShLangTaskNVMask | EShLangMeshNVMask),
"#extension GL_NV_mesh_shader");

// TODO: need to add error checks for other nvidia turing extensions

if (getNumErrors() > lNumErrors)
return false;
return true;
}
#endif
}

// Call for any operation needing full GLSL integer data-type support.
void TParseVersions::fullIntegerCheck(const TSourceLoc& loc, const char* op)
Expand Down
4 changes: 1 addition & 3 deletions glslang/MachineIndependent/parseVersions.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ class TParseVersions {
virtual void requireSpv(const TSourceLoc&, const char* op);
virtual bool checkExtensionsRequested(const TSourceLoc&, int numExtensions, const char* const extensions[], const char* featureDesc);
virtual void updateExtensionBehavior(const char* const extension, TExtensionBehavior);
#ifdef NV_EXTENSIONS
virtual bool checkShaderStageForNVExtensions(const TSourceLoc&, const char* const extension);
#endif
virtual void checkExtensionStage(const TSourceLoc&, const char* const extension);

virtual void C_DECL error(const TSourceLoc&, const char* szReason, const char* szToken,
const char* szExtraInfoFormat, ...) = 0;
Expand Down

0 comments on commit 80b9872

Please sign in to comment.