Skip to content

Handle case where shader platforms and shader programs counts don't match. - #137

Merged
K0lb3 merged 1 commit into
K0lb3:masterfrom
sparr:mismatched_shader_platform_counts
Jan 8, 2024
Merged

K0lb3 merged 1 commit into
K0lb3:masterfrom
sparr:mismatched_shader_platform_counts

Conversation

@sparr

@sparr sparr commented Sep 24, 2022

Copy link
Copy Markdown
Contributor

While extracting assets from the game "As Far As The Eye" I encountered some tuple and list index errors due to a shader having two platforms but just one program. This patch bails on the relevant loops when the lengths/programs are exhausted. There may be more appropriate behavior, such as serializing the same program for both platforms?

Here is a little bit of debug output I printed while troubleshooting this, for the problematic shader:

m_Shader.platforms is [<ShaderCompilerPlatform.kShaderCompPlatformOpenGLCore: 15>, <ShaderCompilerPlatform.kShaderCompPlatformVulkan: 18>]
m_shader.compressedLengths is (896,)
m_shader.decompressedLengths is (2504,)
shaderPrograms is [<UnityPy.export.ShaderConverter.ShaderProgram object at 0x7f3d2929dff0>]

@K0lb3
K0lb3 merged commit 2bd6efb into K0lb3:master Jan 8, 2024
@sparr
sparr deleted the mismatched_shader_platform_counts branch January 8, 2024 15:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants