Skip to content

Commit

Permalink
Revert D50436128: Multisect successfully blamed "D50436125: [IGL] Sim…
Browse files Browse the repository at this point in the history
…plify `ShaderUniforms::setFloat3x3`" for test or build failures

Summary:
This diff is reverting D50436128
Depends on D50483445
D50436125: [IGL] Simplify `ShaderUniforms::setFloat3x3` by AmesingFlank has been identified to be causing the following test or build failures:

Tests affected:
- [//fbandroid/instrumentation_tests/com/facebook/msqrd:block_inputs_every_type_via_patches-64bit - testDefault[base_gles2_hermes_vEffect_uncompressed] (com.facebook.msqrd.unified_runner.AREngineScreenshotTest)](https://www.internalfb.com/intern/test/281475070193663/)

Here's the Multisect link:
https://www.internalfb.com/multisect/3348209
Here are the tasks that are relevant to this breakage:

We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it.

If you believe this diff has been generated in error you may Commandeer and Abandon it.

Reviewed By: syeh1

Differential Revision: D50483453

fbshipit-source-id: 7052e647820c558d7df6b85bae1969823d9b748e
  • Loading branch information
Dark Knight authored and facebook-github-bot committed Oct 20, 2023
1 parent 522a60e commit ec72563
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion IGLU/simple_renderer/ShaderUniforms.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,26 @@ void ShaderUniforms::setFloat3x3Array(const igl::NameHandle& uniformName,
const iglu::simdtypes::float3x3* value,
size_t count,
size_t arrayIndex) {
setUniformBytes(uniformName, value, sizeof(iglu::simdtypes::float3x3), count, arrayIndex);
if (device_.getBackendType() == igl::BackendType::Metal ||
device_.getBackendType() == igl::BackendType::Vulkan) {
setUniformBytes(uniformName, value, sizeof(iglu::simdtypes::float3x3), count, arrayIndex);
} else {
// simdtypes::float3x3 has an extra float per float-vector.
// Remove it so we can send the packed version to OpenGL
auto paddedMatrixPtr = reinterpret_cast<const float*>(value);
auto packedMatrix = new float[9 * count];
auto packedMatrixPtr = packedMatrix;
for (int n = 0; n < count; n++) {
for (int i = 0; i < 3; i++) {
for (int j = 0; j < 3; j++) {
*packedMatrixPtr++ = *paddedMatrixPtr++;
}
paddedMatrixPtr++; // skip over padded float
}
}
setUniformBytes(uniformName, packedMatrix, sizeof(float) * 9, count, arrayIndex);
delete[] packedMatrix;
}
}

void ShaderUniforms::setFloat4x4(const igl::NameHandle& uniformName,
Expand Down

0 comments on commit ec72563

Please sign in to comment.