CCPR: Add WAR for an Intel GLSL compiler assertion

Bug: skia:
Change-Id: I8056f10292c28e243a2b9e7c9fa6a4a0705fbab9
Reviewed-on: https://skia-review.googlesource.com/54021
Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
Commit-Queue: Chris Dalton <csmartdalton@google.com>
This commit is contained in:
Chris Dalton 2017-10-02 13:17:33 -06:00 committed by Skia Commit-Bot
parent 73f7e1dbdd
commit 29f642a952

View File

@ -16,9 +16,12 @@ void GrCCPRTriangleProcessor::onEmitVertexShader(const GrCCPRCoverageProcessor&
const TexelBufferHandle& pointsBuffer,
const char* atlasOffset, const char* rtAdjust,
GrGPArgs* gpArgs) const {
// Copy the input attrib to an intermediate array. The Intel GLSL compiler hits an internal
// assertion if we index the input attrib itself with sk_VertexID.
v->codeAppendf("int indices[3] = int[3](%s.x, %s.y, %s.z);",
proc.instanceAttrib(), proc.instanceAttrib(), proc.instanceAttrib());
v->codeAppend ("float2 self = ");
v->appendTexelFetch(pointsBuffer,
SkStringPrintf("%s[sk_VertexID]", proc.instanceAttrib()).c_str());
v->appendTexelFetch(pointsBuffer, "indices[sk_VertexID]");
v->codeAppendf(".xy + %s;", atlasOffset);
gpArgs->fPositionVar.set(kFloat2_GrSLType, "self");
}