Fragment output fix
Allow not specifying a fragment output location.
Change-Id: I76c6e6efdff3161586f5d5422e97731969b9396c
Reviewed-on: https://swiftshader-review.googlesource.com/17028
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index 2a72972..fea45f9 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -3183,7 +3183,8 @@
int registerCount = fragmentOutput->totalRegisterCount();
if(requestedLocation < 0)
{
- mContext.error(fragmentOutput->getLine(), "Invalid fragment output location", "fragment shader");
+ ASSERT(requestedLocation == -1); // All other negative values would have been prevented in TParseContext::parseLayoutQualifier
+ return; // No requested location
}
else if((requestedLocation + registerCount) > sw::RENDERTARGETS)
{
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
index 4f6ffff..f2f3089 100644
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ b/src/OpenGL/compiler/ParseHelper.cpp
@@ -2826,7 +2826,7 @@
{
TLayoutQualifier qualifier;
- qualifier.location = -1;
+ qualifier.location = -1; // -1 isn't a valid location, it means the value isn't set. Negative values are checked lower in this function.
qualifier.matrixPacking = EmpUnspecified;
qualifier.blockStorage = EbsUnspecified;