Fragment output fix

Fragment outputs weren't given a proper index, so a
fragment output array has been added to fix this.

Change-Id: Id9be21f60cc23528bf1af078a8b3ca2df28e7ee4
Reviewed-on: https://swiftshader-review.googlesource.com/4295
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
index dec9c30..bbfadf4 100644
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ b/src/OpenGL/compiler/OutputASM.cpp
@@ -2199,7 +2199,7 @@
 		case EvqVaryingIn:           return varyingRegister(operand);

 		case EvqVaryingOut:          return varyingRegister(operand);

 		case EvqVertexIn:            return attributeRegister(operand);

-		case EvqFragmentOut:         return 0;

+		case EvqFragmentOut:         return fragmentOutputRegister(operand);

 		case EvqVertexOut:           return varyingRegister(operand);

 		case EvqFragmentIn:          return varyingRegister(operand);

 		case EvqInvariantVaryingIn:  return varyingRegister(operand);

@@ -2527,6 +2527,11 @@
 		return index;

 	}

 

+	int OutputASM::fragmentOutputRegister(TIntermTyped *fragmentOutput)

+	{

+		return allocate(fragmentOutputs, fragmentOutput);

+	}

+

 	int OutputASM::samplerRegister(TIntermTyped *sampler)

 	{

 		ASSERT(IsSampler(sampler->getType().getBasicType()));

diff --git a/src/OpenGL/compiler/OutputASM.h b/src/OpenGL/compiler/OutputASM.h
index 0ea4811..acb981b 100644
--- a/src/OpenGL/compiler/OutputASM.h
+++ b/src/OpenGL/compiler/OutputASM.h
@@ -199,6 +199,7 @@
 		void declareVarying(TIntermTyped *varying, int reg);

 		int uniformRegister(TIntermTyped *uniform);

 		int attributeRegister(TIntermTyped *attribute);

+		int fragmentOutputRegister(TIntermTyped *fragmentOutput);

 		int samplerRegister(TIntermTyped *sampler);

 		int samplerRegister(TIntermSymbol *sampler);

 

@@ -228,6 +229,7 @@
 		VariableArray varyings;

 		VariableArray attributes;

 		VariableArray samplers;

+		VariableArray fragmentOutputs;

 

 		Scope emitScope;

 		Scope currentScope;