Commit dd8df68e by Alexis Hetu Committed by Alexis Hétu

glInstanceID implementation

Implementation attempt for glInstanceID. Related dEQP tests pass. Change-Id: I6391699a127cc7c159a2a64e3ffeaa528b611f97 Reviewed-on: https://swiftshader-review.googlesource.com/3412Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent ecad519b
......@@ -424,6 +424,11 @@ namespace sw
memcpy(&data->vs.b, VertexProcessor::b, sizeof(bool) * draw->vsDirtyConstB);
draw->vsDirtyConstB = 0;
}
if(context->vertexShader->instanceIdDeclared)
{
data->instanceID = context->instanceID;
}
}
else
{
......
......@@ -665,6 +665,9 @@ namespace sw
reg = r.o[i + relativeAddress(r, src)];
}
break;
case Shader::PARAMETER_MISCTYPE:
reg.x = Float(r.instanceID);
return reg;
default:
ASSERT(false);
}
......
......@@ -52,6 +52,10 @@ namespace sw
Registers r(shader);
r.data = data;
r.constants = *Pointer<Pointer<Byte> >(data + OFFSET(DrawData,constants));
if(shader->instanceIdDeclared)
{
r.instanceID = *Pointer<Int>(data + OFFSET(DrawData, instanceID));
}
Do
{
......
......@@ -67,6 +67,8 @@ namespace sw
Int4 enableBreak;
Int4 enableContinue;
Int4 enableLeave;
Int instanceID;
};
public:
......
......@@ -41,6 +41,7 @@ namespace sw
memcpy(input, vs->input, sizeof(input));
positionRegister = vs->positionRegister;
pointSizeRegister = vs->pointSizeRegister;
instanceIdDeclared = vs->instanceIdDeclared;
usedSamplers = vs->usedSamplers;
optimize();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment