Skip to content

Commit

Permalink
Add test for multiple stage IO locations
Browse files Browse the repository at this point in the history
This verifies part of issue #5633.
  • Loading branch information
aleino-nv committed Nov 22, 2024
1 parent 9e44a07 commit 568072b
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 0 deletions.
76 changes: 76 additions & 0 deletions tests/render/multiple-stage-io-locations.slang
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
//TEST(smoke,render):COMPARE_HLSL_RENDER:

cbuffer Uniforms
{
float4x4 modelViewProjection;
}

struct AssembledVertex
{
float3 position;
float3 color;
};

struct Fragment
{
float4 color;
};

// Vertex Shader

struct VertexStageInput
{
AssembledVertex assembledVertex : A;
};

struct VertexStageOutput
{
float3 color : VERTEX_COLOR;
float3 localPosition : VERTEX_LOCAL_POSITION;
float4 sv_position : SV_Position;
};

VertexStageOutput vertexMain(VertexStageInput input)
{
VertexStageOutput output;

float3 position = input.assembledVertex.position;
float3 color = input.assembledVertex.color;

output.color = color;
output.sv_position = mul(modelViewProjection, float4(position, 1.0));
output.localPosition = position;

return output;
}

// Fragment Shader

struct FragmentStageInput
{
float3 color : VERTEX_COLOR;
float3 localPosition : VERTEX_LOCAL_POSITION;
};

struct FragmentStageOutput
{
Fragment fragment : SV_Target;
};

FragmentStageOutput fragmentMain(FragmentStageInput input)
{
FragmentStageOutput output;

float3 color = input.color;

if (input.color.y < input.color.z)
{
output.fragment.color = float4(input.localPosition, 1.0);
}
else
{
output.fragment.color = float4(input.color, 1.0);
}

return output;
}
5 changes: 5 additions & 0 deletions tests/render/multiple-stage-io-locations.slang.1.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/multiple-stage-io-locations.slang.2.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions tests/render/multiple-stage-io-locations.slang.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
result code = 0
standard error = {
}
standard output = {
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 568072b

Please sign in to comment.