-
Notifications
You must be signed in to change notification settings - Fork 160
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
SPIR-V SV_InstanceId
support in pixel shader
#4368
Merged
csyonghe
merged 10 commits into
shader-slang:master
from
ArielG-NV:HLSL-SV_InstanceId-not-supported-in-pixel-shader-#3087
Jun 13, 2024
Merged
Changes from 3 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fef8f00
solve issue by making 'non SV for SPIRV' system semantics, no longer …
ArielG-NV 673f64e
Merge branch 'master' into HLSL-SV_InstanceId-not-supported-in-pixel-…
ArielG-NV 6c69fed
fix compile warnings
ArielG-NV 5492caa
address review comments and reimplement operand removal
ArielG-NV 313e8ec
Merge branch 'master' into HLSL-SV_InstanceId-not-supported-in-pixel-…
ArielG-NV 25f0b92
address review
ArielG-NV e87b2df
Merge branch 'HLSL-SV_InstanceId-not-supported-in-pixel-shader-#3087'…
ArielG-NV 1cb22e4
address review
ArielG-NV a38ec4a
Merge branch 'master' into HLSL-SV_InstanceId-not-supported-in-pixel-…
ArielG-NV 3b6493b
Merge branch 'master' into HLSL-SV_InstanceId-not-supported-in-pixel-…
ArielG-NV 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 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 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 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 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 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,34 @@ | ||
//TEST:SIMPLE(filecheck=CHECK): -target spirv -fvk-use-entrypoint-name -emit-spirv-directly | ||
|
||
// CHECK-DAG: OpEntryPoint Vertex | ||
// CHECK-DAG: OpEntryPoint Fragment | ||
|
||
// we should only have 1 'BuiltIn InstanceIndex' since the `Output` and `Input` semantic | ||
// for `InstanceIndex` should be converted to a non-builtin | ||
// CHECK: BuiltIn InstanceIndex | ||
// CHECK-NOT: BuiltIn InstanceIndex | ||
|
||
struct VIn | ||
{ | ||
uint instanceID : SV_InstanceID; | ||
} | ||
|
||
struct VSOutput | ||
{ | ||
uint instanceID : SV_InstanceID; | ||
float4 color : COLOR; | ||
}; | ||
|
||
[shader("vertex")] | ||
VSOutput vmain(VIn vin) { | ||
VSOutput t; | ||
t.instanceID = vin.instanceID; | ||
t.color = float4(0, 0, 0, 0); | ||
return t; | ||
} | ||
|
||
[shader("pixel")] | ||
float4 pmain(VSOutput input) : SV_TARGET | ||
{ | ||
return float4(float(input.instanceID), input.color.xyz); | ||
} |
This file contains 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,24 @@ | ||
//TEST:SIMPLE(filecheck=HLSL): -allow-glsl -entry main -target hlsl | ||
//TEST:SIMPLE(filecheck=GLSL): -allow-glsl -entry main -target glsl | ||
//TEST:SIMPLE(filecheck=SPIRV): -allow-glsl -entry main -target spirv | ||
jkwak-work marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
// HLSL-DAG: main | ||
// HLSL-DAG: SV_InstanceID | ||
|
||
// GLSL-DAG: main | ||
// GLSL-DAG: gl_InstanceIndex | ||
|
||
// SPIRV: OpEntryPoint | ||
// SPIRV-NOT: BuiltIn InstanceIndex | ||
|
||
struct PSInput | ||
{ | ||
uint vInstance : SV_InstanceID; | ||
float4 color : COLOR; | ||
}; | ||
|
||
[shader("pixel")] | ||
float4 main(PSInput input) : SV_TARGET | ||
{ | ||
return input.color + float(input.vInstance).xxxx; | ||
} |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
systemSemantic = inVarLayout->findSystemValueSemanticAttr()l