Fix for the remaining vertex array issues
Fixes all failures in dEQP.functional.vertex_arrays.*
In OpenGL ES 3.0, vertex attributes streams can be of a
different type from the vertex attribute in the shader.
For this reason, some conversion may be required. This
cl solves this issue by:
1) Sending the information about the vertex attribute's
type in the shader to the vertex routine.
2) Handling this information by adding conversion where
appropriate.
Change-Id: I04a5a34aea12684209e584aa5f15a3edfd57f956
Reviewed-on: https://swiftshader-review.googlesource.com/7254
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/Shader/VertexShader.cpp b/src/Shader/VertexShader.cpp
index dd62b4b..a98932b 100644
--- a/src/Shader/VertexShader.cpp
+++ b/src/Shader/VertexShader.cpp
@@ -32,6 +32,7 @@
for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
{
input[i] = Semantic();
+ attribType[i] = ATTRIBTYPE_FLOAT;
}
if(vs) // Make a copy
@@ -43,6 +44,7 @@
memcpy(output, vs->output, sizeof(output));
memcpy(input, vs->input, sizeof(input));
+ memcpy(attribType, vs->attribType, sizeof(attribType));
positionRegister = vs->positionRegister;
pointSizeRegister = vs->pointSizeRegister;
instanceIdDeclared = vs->instanceIdDeclared;
@@ -65,6 +67,7 @@
for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
{
input[i] = Semantic();
+ attribType[i] = ATTRIBTYPE_FLOAT;
}
optimize();
@@ -151,9 +154,10 @@
return textureSampling;
}
- void VertexShader::setInput(int inputIdx, const sw::Shader::Semantic& semantic)
+ void VertexShader::setInput(int inputIdx, const sw::Shader::Semantic& semantic, AttribType aType)
{
input[inputIdx] = semantic;
+ attribType[inputIdx] = aType;
}
void VertexShader::setOutput(int outputIdx, int nbComponents, const sw::Shader::Semantic& semantic)
@@ -181,6 +185,11 @@
return input[inputIdx];
}
+ VertexShader::AttribType VertexShader::getAttribType(int inputIdx) const
+ {
+ return attribType[inputIdx];
+ }
+
const sw::Shader::Semantic& VertexShader::getOutput(int outputIdx, int component) const
{
return output[outputIdx][component];