workaround for Intel OpCompositeConstruct bug
The SPIR-V spec permits constructing a vector from mixed vectors and scalars, e.g. vec3(vec2, float). Intel's Vulkan driver does not handle this correctly. We already have a workaround in place for vector construction (writing the code as vec3(vec2.x, vec2.y, float) instead), but missed that matrix construction can produce the same problem, as each column requires a vector to be constructed for it. This CL extends the workaround to handle matrix construction as well. Bug: skia:7851 Change-Id: I0fe5d300ec7ad5db87bcc6662cf8371bcd6deed8 Reviewed-on: https://skia-review.googlesource.com/124321 Reviewed-by: Chris Dalton <csmartdalton@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
This commit is contained in:
parent
0c51c21343
commit
be850adc53
@ -1247,7 +1247,17 @@ SpvId SPIRVCodeGenerator::writeMatrixConstructor(const Constructor& c, OutputStr
|
||||
ASSERT(currentCount == 0);
|
||||
columnIds.push_back(arguments[i]);
|
||||
} else {
|
||||
if (c.fArguments[i]->fType.columns() == 1) {
|
||||
currentColumn.push_back(arguments[i]);
|
||||
} else {
|
||||
SpvId componentType = this->getType(c.fArguments[i]->fType.componentType());
|
||||
for (int j = 0; j < c.fArguments[j]->fType.columns(); ++j) {
|
||||
SpvId swizzle = this->nextId();
|
||||
this->writeInstruction(SpvOpCompositeExtract, componentType, swizzle,
|
||||
arguments[i], j, out);
|
||||
currentColumn.push_back(swizzle);
|
||||
}
|
||||
}
|
||||
currentCount += c.fArguments[i]->fType.columns();
|
||||
if (currentCount == rows) {
|
||||
currentCount = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user