Skip to content

Commit

Permalink
Do not generate shadow map code when there are no shadow maps
Browse files Browse the repository at this point in the history
Fix shader compiler error if all shadow mapped lights are point lights
  • Loading branch information
darksylinc committed Mar 29, 2021
1 parent 1cbdaf3 commit 8d44cac
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
8 changes: 5 additions & 3 deletions Samples/Media/Hlms/Pbs/Any/ShadowMapping_piece_vs.any
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,11 @@
@end
@end
@else
@piece( DoShadowReceiveVS )
outVs.worldPos.xyz = worldPos.xyz;
@property( hlms_pssm_splits )outVs.depth = outVs_Position.z;@end
@property( hlms_num_shadow_map_lights && !hlms_all_point_lights )
@piece( DoShadowReceiveVS )
outVs.worldPos.xyz = worldPos.xyz;
@property( hlms_pssm_splits )outVs.depth = outVs_Position.z;@end
@end
@end
@end
@end
2 changes: 1 addition & 1 deletion Samples/Media/Hlms/Pbs/GLSL/Structs_piece_vs_piece_ps.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ layout_constbuffer(binding = 3) uniform ManualProbe
@end
@end
@else
@property( !hlms_all_point_lights )
@property( hlms_num_shadow_map_lights && !hlms_all_point_lights )
vec3 worldPos;
@end
@end
Expand Down
2 changes: 1 addition & 1 deletion Samples/Media/Hlms/Pbs/HLSL/Structs_piece_vs_piece_ps.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ cbuffer ManualProbe : register(b3)
@end
@end
@else
@property( !hlms_all_point_lights )
@property( hlms_num_shadow_map_lights && !hlms_all_point_lights )
float3 worldPos : TEXCOORD@counter(texcoord);
@end
@end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ struct Material
@end
@end
@else
@property( !hlms_all_point_lights )
@property( hlms_num_shadow_map_lights && !hlms_all_point_lights )
float3 worldPos;
@end
@end
Expand Down

0 comments on commit 8d44cac

Please sign in to comment.