-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[HLSL][Sema] Fix Struct Size Calculation containing 16/32 bit scalars #128086
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
// RUN: %clang_cc1 -std=hlsl2021 -finclude-default-header -x hlsl -triple \ | ||
// RUN: dxil-pc-shadermodel6.3-library %s -fnative-half-type \ | ||
// RUN: -fsyntax-only -verify -verify-ignore-unexpected=warning | ||
|
||
struct S0 { | ||
half a; | ||
half b; | ||
half c; | ||
half d; | ||
half e; | ||
half f; | ||
half g; | ||
half h; | ||
}; | ||
|
||
cbuffer CB0Pass { | ||
S0 s0p : packoffset(c0.x); | ||
float f0p : packoffset(c1.x); | ||
} | ||
|
||
cbuffer CB0Fail { | ||
S0 s0f : packoffset(c0.x); | ||
float f0f : packoffset(c0.w); | ||
// expected-error@-1 {{packoffset overlap between 'f0f', 's0f'}} | ||
} | ||
|
||
hekota marked this conversation as resolved.
Show resolved
Hide resolved
|
||
struct S1 { | ||
float a; | ||
double b; | ||
float c; | ||
}; | ||
|
||
cbuffer CB1Pass { | ||
S1 s1p : packoffset(c0.x); | ||
float f1p : packoffset(c1.y); | ||
} | ||
|
||
cbuffer CB1Fail { | ||
S1 s1f : packoffset(c0.x); | ||
float f1f : packoffset(c1.x); | ||
// expected-error@-1 {{packoffset overlap between 'f1f', 's1f'}} | ||
} | ||
|
||
struct S2 { | ||
float3 a; | ||
float2 b; | ||
}; | ||
|
||
cbuffer CB2Pass { | ||
S2 s2p : packoffset(c0.x); | ||
float f2p : packoffset(c1.z); | ||
} | ||
|
||
cbuffer CB2Fail { | ||
S2 s2f : packoffset(c0.x); | ||
float f2f : packoffset(c1.y); | ||
// expected-error@-1 {{packoffset overlap between 'f2f', 's2f'}} | ||
} | ||
|
||
struct S3 { | ||
float3 a; | ||
float b; | ||
}; | ||
|
||
cbuffer CB3Pass { | ||
S3 s3p : packoffset(c0.x); | ||
float f3p : packoffset(c1.x); | ||
} | ||
|
||
cbuffer CB3Fail { | ||
S3 s3f : packoffset(c0.x); | ||
float f3f : packoffset(c0.w); | ||
// expected-error@-1 {{packoffset overlap between 'f3f', 's3f'}} | ||
} | ||
|
||
struct S4 { | ||
float2 a; | ||
float2 b; | ||
}; | ||
|
||
cbuffer CB4Pass { | ||
S4 s4p : packoffset(c0.x); | ||
float f4p : packoffset(c1.x); | ||
} | ||
|
||
cbuffer CB4Fail { | ||
S4 s4f : packoffset(c0.x); | ||
float f4f : packoffset(c0.w); | ||
// expected-error@-1 {{packoffset overlap between 'f4f', 's4f'}} | ||
} | ||
|
||
struct S5 { | ||
float a[3]; | ||
}; | ||
|
||
cbuffer CB5Pass { | ||
S5 s5p : packoffset(c0.x); | ||
float f5p : packoffset(c2.y); | ||
} | ||
|
||
cbuffer CB5Fail { | ||
S5 s5f : packoffset(c0.x); | ||
float f5f : packoffset(c2.x); | ||
// expected-error@-1 {{packoffset overlap between 'f5f', 's5f'}} | ||
} | ||
|
||
struct S6 { | ||
float a; | ||
float2 b; | ||
}; | ||
|
||
cbuffer CB6Pass { | ||
S6 s6p : packoffset(c0.x); | ||
float f6p : packoffset(c0.w); | ||
} | ||
|
||
cbuffer CB6Fail { | ||
S6 s6f : packoffset(c0.x); | ||
float f6f : packoffset(c0.y); | ||
// expected-error@-1 {{packoffset overlap between 'f6f', 's6f'}} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.