Skip to content

Conversation

@aclysma
Copy link
Contributor

@aclysma aclysma commented May 7, 2023

When converting from GLSL to HLSL, automatic register assignment causes bindings that use multiple registers to overlap. This adds support for overriding the assignment by exposing CompilerHLSL::add_hlsl_resource_binding in spirv-cross.

Before (automatic behavior):

Texture2D<float4> shadow_map_images[32] : register(t3, space0);
TextureCube<float4> shadow_map_images_cube[16] : register(t4, space0);

This fails to compile because shadow_map_images overlaps shadow_map_images_cube in this example.

After (behavior provided by calling the added add_resource_binding which calls CompilerHLSL::add_hlsl_resource_binding:

Texture2D<float4> shadow_map_images[32] : register(t3, space0);
TextureCube<float4> shadow_map_images_cube[16] : register(t35, space0);

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.

1 participant