-
Notifications
You must be signed in to change notification settings - Fork 718
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 barycentrics ordering check onto existing barycentrics test #4635
Merged
Merged
Changes from 2 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
15dfc73
add barycentrics ordering check onto existing barycentrics test, with…
bob80905 73ffc28
shrink RT dimensions for both barycentrics tests, remove unused var i…
bob80905 b3ba4cc
factor out test code, remove commented code.
bob80905 ed349d1
merge ordering and old bary shaders into one, increase tolerance
bob80905 4158953
Merge branch 'main' of https://github.com/microsoft/DirectXShaderComp…
bob80905 ed53264
remove redefinition in other test to make build pass
bob80905 872b3c3
prevent early truncation in division op
bob80905 7e6feba
remove comment, simplify shader
bob80905 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1498,7 +1498,7 @@ | |
{ { 1.0f, -1.0f , 0.0f }, { 0.0f, 1.0f, 0.0f, 1.0f } }, | ||
{ { -1.0f, -1.0f , 0.0f }, { 0.0f, 0.0f, 1.0f, 1.0f } } | ||
</Resource> | ||
<Resource Name="RTarget" Dimension="TEXTURE2D" Width="1280" Height="2400" Format="R32G32B32A32_FLOAT" Flags="ALLOW_RENDER_TARGET" InitialResourceState="COPY_DEST" ReadBack="true" /> | ||
<Resource Name="RTarget" Dimension="TEXTURE2D" Width="1280" Height="1280" Format="R32G32B32A32_FLOAT" Flags="ALLOW_RENDER_TARGET" InitialResourceState="COPY_DEST" ReadBack="true" /> | ||
<DescriptorHeap Name="RtvHeap" NumDescriptors="1" Type="RTV"> | ||
<Descriptor Name="RTarget" Kind="RTV"/> | ||
</DescriptorHeap> | ||
|
@@ -1539,6 +1539,66 @@ | |
</Shader> | ||
</ShaderOp> | ||
|
||
|
||
<ShaderOp Name="BarycentricsCheckOrder" PS="PS61" VS="VS61"> | ||
<RootSignature>RootFlags(ALLOW_INPUT_ASSEMBLER_INPUT_LAYOUT)</RootSignature> | ||
<Resource Name="VBuffer" Dimension="BUFFER" Width="1024" Flags="ALLOW_UNORDERED_ACCESS" InitialResourceState="COPY_DEST" Init="ByName" ReadBack="true"> | ||
</Resource> | ||
<Resource Name="RTarget" Dimension="TEXTURE2D" Width="64" Height="64" Format="R32G32B32A32_FLOAT" Flags="ALLOW_RENDER_TARGET" InitialResourceState="COPY_DEST" ReadBack="true" /> | ||
|
||
<DescriptorHeap Name="RtvHeap" NumDescriptors="1" Type="RTV"> | ||
<Descriptor Name="RTarget" Kind="RTV"/> | ||
</DescriptorHeap> | ||
|
||
<InputElements> | ||
<InputElement SemanticName="POSITION" Format="R32G32B32_FLOAT" AlignedByteOffset="0" /> | ||
<InputElement SemanticName="COLOR" Format="R32G32B32A32_FLOAT" AlignedByteOffset="12" /> | ||
</InputElements> | ||
<RenderTargets> | ||
<RenderTarget Name="RTarget" /> | ||
</RenderTargets> | ||
|
||
<Shader Name="PS61" Target="ps_6_1" EntryPoint="PSMain" Text="@MAIN"/> | ||
<Shader Name="VS61" Target="vs_6_1" EntryPoint="VSMain" Text="@MAIN"/> | ||
|
||
|
||
<Shader Name="MAIN" Target="vs_6_1" EntryPoint="VSMain"> | ||
<![CDATA[ | ||
struct PSInput { | ||
float4 position : SV_POSITION; | ||
nointerpolation float4 color : COLOR; | ||
uint svid : SVertexID; | ||
}; | ||
|
||
PSInput VSMain(float4 position : POSITION, float4 color : COLOR, uint svid : SV_VertexID) { | ||
PSInput result; | ||
result.position = position; | ||
result.color = color; | ||
result.svid = svid; | ||
|
||
return result; | ||
} | ||
|
||
float4 PSMain(PSInput input) : SV_Target { | ||
// check to make sure that the pixel shader will see the barycentric weight associated | ||
// with the first vertex in the x component of the SV_Barycentric vector, and likewise for subsequent vertices | ||
|
||
if (0 == GetAttributeAtVertex(input.svid, 0) && | ||
1 == GetAttributeAtVertex(input.svid, 1) && | ||
2 == GetAttributeAtVertex(input.svid, 2)) | ||
{ | ||
// special value of all 1's in a float4 will be returned if the ordering is maintained for this pixel. | ||
return float4(1.0, 1.0, 1.0, 1.0); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. An alternative way to do this (without the
|
||
} | ||
|
||
// special value of all 0's in a float 4 will be returned otherwise | ||
return float4(0.0, 0.0, 0.0, 0.0); | ||
} | ||
|
||
]]> | ||
</Shader> | ||
</ShaderOp> | ||
|
||
<ShaderOp Name="ComputeRawBufferLdSt32Bit" CS="CS"> | ||
<RootSignature>RootFlags(0), SRV(t0), SRV(t1), UAV(u0), UAV(u1), DescriptorTable(SRV(t2,numDescriptors=2), UAV(u2,numDescriptors=2))</RootSignature> | ||
<Resource Name="SRVBuffer0" Dimension="BUFFER" Width="40" InitialResourceState="COPY_DEST" Init="ByName" Format="R32_TYPELESS"/> | ||
|
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
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.
If we can make the render targets the same size, you can use different entry point targets to make one ubershader and prevent duplicating the shader code above with slight modifications.