Skip to content

Conversation

@Dolkar
Copy link
Contributor

@Dolkar Dolkar commented Dec 10, 2025

See #7894 for context.

Note that this is a backwards incompatible change and may break code that relies on the current odd behavior of -fvk-use-scalar-layout. It also fixes a case found by @s-perron that currently generates invalid SPIR-V (scalar.layout.struct.array test) because structs don't get properly aligned inside arrays.

@s-perron
Copy link
Collaborator

Thanks for the contribution. That is great.

We'll have to see if this causes regressions for anyone. It could be that people depend on the old behaviour, and this could break them. If that is significant, then we will have to add a new option.

@gjaegy, @devshgraphicsprogramming, @sajjadmirzanv, @LukasBanana, @EpicJeanNoeMorissette

If any of you use the scalar layout option in DXC, let me know if this will cause problems for you. I think this is the right direction in spirit, but it might not be pragmatic.

@gjaegy
Copy link

gjaegy commented Dec 10, 2025

We don't use the "vk-use-scalar-layout" option, so not a problem for us, thanks for asking !

@devshgraphicsprogramming

Thanks for the contribution. That is great.

We'll have to see if this causes regressions for anyone. It could be that people depend on the old behaviour, and this could break them. If that is significant, then we will have to add a new option.

@gjaegy, @devshgraphicsprogramming, @sajjadmirzanv, @LukasBanana, @EpicJeanNoeMorissette

If any of you use the scalar layout option in DXC, let me know if this will cause problems for you. I think this is the right direction in spirit, but it might not be pragmatic.

It actually fixes stuff for us, LGTM

@LukasBanana
Copy link
Contributor

Following the description in #7894, this makes sense to me. If the intention was to have C-like structures, this sounds like a reasonable fix. We do use this layout in UE5 as the extension VK_EXT_scalar_block_layout is required for ray-tracing and Nanite, so we'll keep an eye on this extension when we merge our next update from this mainstream. @EpicJeanNoeMorissette for vis.

@s-perron
Copy link
Collaborator

/AzurePiplines run

@Dolkar
Copy link
Contributor Author

Dolkar commented Dec 16, 2025

@microsoft-github-policy-service agree company="BAE Systems OneArc"

@s-perron
Copy link
Collaborator

/AzurePipelines run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Collaborator

@s-perron s-perron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. just a minor issue, and then I will be able to merge it.

// CHECK: [[buf_0:%[0-9]+]] = OpAccessChain %_ptr_Uniform_ulong %buffer %int_0 %uint_0 %int_1
// CHECK-NEXT: OpStore [[buf_0]] %ulong_56
buffer[0].c = sizeof(Bar);
} No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a new line here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@s-perron
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@s-perron s-perron enabled auto-merge (squash) December 16, 2025 21:45
@s-perron s-perron merged commit 28dc9f7 into microsoft:main Dec 16, 2025
12 checks passed
@github-project-automation github-project-automation bot moved this from New to Done in HLSL Roadmap Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants