PIX: Account for alignment when computing member offset#4903
PIX: Account for alignment when computing member offset#4903jeffnn merged 2 commits intomicrosoft:mainfrom
Conversation
|
✅ Build DirectXShaderCompiler 1.0.2517 completed (commit 5cb4e5990b by @jeffnn) |
|
Hi! Thanks for the PR. Don't own the DXIL part, so cannot approve, but tried it, and I see no difference between in the generated DXIL for this shader taken from the test between this PR and HEAD (a0b6fc1), is that expected? struct EmbeddedStruct
{
uint32_t TwoDArray[2][2];
};
struct smallPayload
{
uint32_t OneInt;
EmbeddedStruct embeddedStruct;
uint64_t bigOne;
};
[numthreads(1, 1, 1)]
void main()
{
smallPayload p;
p.OneInt = -137;
p.embeddedStruct.TwoDArray[0][0] = 252;
p.embeddedStruct.TwoDArray[0][1] = 253;
p.embeddedStruct.TwoDArray[1][0] = 254;
p.embeddedStruct.TwoDArray[1][1] = 255;
p.bigOne = 123456789;
DispatchMesh(2, 1, 1, p);
}cmd: |
Hi. This isn't expected to produce any difference in generated code. It's related to how debug information is processed, specifically to how that debug information reflects placement (according to the various structure packing rules) for embedded arrays like in the example. |
|
✅ Build DirectXShaderCompiler 1.0.2561 completed (commit ca5f3f6cb4 by @jeffnn) |
* Account for alignment * Use llvm::RoundUpToAlignment
* Account for alignment * Use llvm::RoundUpToAlignment
* Account for alignment * Use llvm::RoundUpToAlignment
This has been a long-standing issue for PIX. Certain structs (with e.g., embedded arrays of structs) don't pay attention to their alignment requirements.