Commit 94a23a4ed65278805ce4e95e4945e50e67e0cc52

Cody Northrop 2022-08-21T19:52:50

FrameCapture: Fix separable shader uniform locs Uniform locations are tracked by traced program ID, not remapped program ID. This was creating code that used incorrect locations and would immediately crash. For instance, the following code: glProgramUniform4fv(gShaderProgramMap[92], gUniformLocations[gShaderProgramMap[92]][12], 1, reinterpret_cast<const GLfloat *>(&gBinaryData[0])); gShaderProgramMap[92] happens to remap to 54 during replay. But if you look in UpdateUniformLocation, we track uniform locations based on the trace program (92): // Example call: UpdateUniformLocation(92, "fullmatrix", 0, 1); void UpdateUniformLocation(GLuint program, const char *name, GLint location, GLint count) { ... gUniformLocations[program] = programLocations.data(); } So when gUniformLocations[gShaderProgramMap[92]] is used, it tries to look up uniform locations for 54, which don't exist, and returns nullptr. To fix, don't use gShaderProgramMap when looking up locations of uniforms. This only affects separable programs. Normal glUniform calls use gCurrentProgram which is already the trace program (92). The new code looks like this: glProgramUniform4fv(gShaderProgramMap[92], gUniformLocations[92][12], 1, reinterpret_cast<const GLfloat *>(&gBinaryData[0])); Test: Antutu Refinery MEC Bug: angleproject:7590 Change-Id: I079923ec8d938356e72e929d61f80c7fc371a95b Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/3844642 Reviewed-by: Yuxin Hu <yuxinhu@google.com> Commit-Queue: Cody Northrop <cnorthrop@google.com>