Search Issue Tracker
Fixed in 2021.3.31f1
Fixed in 2021.3.X, 2022.3.X, 2023.1.X, 2023.2.X, 2023.3.X, 7000.0.0a1, future release
Votes
0
Found in
2021.3.26f1
2022.2.21f1
2023.1.0b18
2023.2.0a16
2023.3.0a2
Issue ID
UUM-37067
Regression
No
[DX12] ShaderData.VariantCompileInfo.ShaderData contains 38 extra bytes on DirectX 12
On DirectX 12, when calling ShaderData.Pass.CompileVariant, the returned data contains 38 extra bytes in ShaderData.VariantCompileInfo.ShaderData before the actual compiled shader begins.
Repro
- Open the attached project ("Shader Compile") on a Windows machine
- Select one of the shaders ("NewUnlitShader" or "NewSurfaceShader", or both)
- In the top menu, select "Dump -> Dump DXIL". This creates one file per shader stage / pass in the project's root folder (e.g. "Custom_NewSurfaceShader_sub0_pass0_fragment.dxil"). The file is a straight dump of the ShaderData.VariantCompileInfo.ShaderData content
Expected behavior: The dumped file contains a valid DXIL shader
Actual behavior: There are 38 extra bytes of garbage in the beginning before the actual DXIL shader.
For illustration, I attached screenshots from a hex editor. Notice that the shader compiled by DXC ("dxc_.png") starts with the magic "DXBC". The shader compiled by Unity ("unity.png") has this magic at byte 38 instead.
Reproducible on 2021.3+
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- “InvalidOperationException: Trying to set the parent for HierarchyNodeHandle” errors spammed in the Console when converting Sample Scene to Sub Scene and Entities Hierarchy window is open
- Using Physics.ComputePenetration on a Capsule collider causes it to sometimes return incorrect value when dragging it through the Mesh collider
- Sprite is rendered incorrectly in Web Build when it is set as a Splash Image Logo
- Cinemachine Camera with Position Composer causes visual jitter when following a moving target
- Errors thrown in console when entering Play mode if an object with an Audio Source component is selected
Add comment