Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for overriding HLSL register/spaces #180

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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