Add compute program compilation and linking support
Compute shaders can be now compiled and linked to create programs.
Some tests are added to verify successful and unsuccessful compute
shader linking.
The patch also replaces std::array<int, 3> with a custom struct
WorkGroupSize.
BUG=angleproject:1442
TEST=angle_end2end_tests
TEST=angle_unittests
Change-Id: I4ab0ac05755d0167a6d2a798f8d7f1516cf54d84
Reviewed-on: https://chromium-review.googlesource.com/366740
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Reviewed-by: Olli Etuaho <oetuaho@nvidia.com>
Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index 66fdceb..3edabe4 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -1044,12 +1044,12 @@
bool TParseContext::checkWorkGroupSizeIsNotSpecified(const TSourceLoc &location,
const TLayoutQualifier &layoutQualifier)
{
- const TLocalSize &localSize = layoutQualifier.localSize;
+ const sh::WorkGroupSize &localSize = layoutQualifier.localSize;
for (size_t i = 0u; i < localSize.size(); ++i)
{
if (localSize[i] != -1)
{
- error(location, "invalid layout qualifier:", getLocalSizeString(i),
+ error(location, "invalid layout qualifier:", getWorkGroupSizeString(i),
"only valid when used with 'in' in a compute shader global layout declaration");
return false;
}
@@ -1119,9 +1119,9 @@
mDirectiveHandler.handlePragma(srcLoc, name, value, stdgl);
}
-TLocalSize TParseContext::getComputeShaderLocalSize() const
+sh::WorkGroupSize TParseContext::getComputeShaderLocalSize() const
{
- TLocalSize result;
+ sh::WorkGroupSize result;
for (size_t i = 0u; i < result.size(); ++i)
{
if (mComputeShaderLocalSizeDeclared && mComputeShaderLocalSize[i] == -1)
@@ -1895,7 +1895,7 @@
return;
}
- if (!layoutQualifier.isGroupSizeSpecified())
+ if (!layoutQualifier.localSize.isAnyValueSet())
{
error(typeQualifier.line, "No local work group size specified", "layout");
return;
@@ -1921,7 +1921,7 @@
<< maxComputeWorkGroupSizeValue;
const std::string &errorMessage = errorMessageStream.str();
- error(typeQualifier.line, "invalid value:", getLocalSizeString(i),
+ error(typeQualifier.line, "invalid value:", getWorkGroupSizeString(i),
errorMessage.c_str());
return;
}
@@ -3052,12 +3052,12 @@
const TSourceLoc &intValueLine,
const std::string &intValueString,
size_t index,
- TLocalSize *localSize)
+ sh::WorkGroupSize *localSize)
{
checkLayoutQualifierSupported(qualifierTypeLine, qualifierType, 310);
if (intValue < 1)
{
- std::string errorMessage = std::string(getLocalSizeString(index)) + " must be positive";
+ std::string errorMessage = std::string(getWorkGroupSizeString(index)) + " must be positive";
error(intValueLine, "out of range:", intValueString.c_str(), errorMessage.c_str());
}
(*localSize)[index] = intValue;
@@ -3136,7 +3136,7 @@
{
error(rightQualifierLocation,
"Cannot have multiple different work group size specifiers",
- getLocalSizeString(i));
+ getWorkGroupSizeString(i));
}
joinedQualifier.localSize[i] = rightQualifier.localSize[i];
}