Created
September 24, 2022 22:54
-
-
Save troughton/7111a56ffe084bb8c1b796180656d3ce to your computer and use it in GitHub Desktop.
DebugDraw.hlsl
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
struct DebugVertex { | |
float3 position : POSITION; | |
float4 colour : COLOR; | |
}; | |
struct DebugVertexUniforms { | |
float4x4 worldToProjection; | |
}; | |
[[vk::push_constant]] DebugVertexUniforms uniforms; | |
struct DebugVertexInOut { | |
float4 position : SV_Position; | |
float4 colour : COLOR0; | |
}; | |
[shader("vertex")] | |
DebugVertexInOut DebugDrawPass_Vertex(DebugVertex debugVertex) { | |
DebugVertexInOut output; | |
output.position = mul(uniforms.worldToProjection, float4(debugVertex.position, 1)); | |
output.colour = debugVertex.colour; // inverseToneMap(debugVertex.colour); | |
return output; | |
} | |
[shader("pixel")] | |
float4 DebugDrawPass_Fragment(DebugVertexInOut input) : SV_Target { | |
return input.colour; | |
} | |
struct DebugPointVertex { | |
float3 position : POSITION; | |
float4 colour : COLOR; | |
float size : PSIZE; | |
}; | |
struct DebugPointVertexInOut { | |
float4 position : SV_Position; | |
float4 colour : COLOR0; | |
[[vk::builtin("PointSize")]] float size : PSIZE; | |
}; | |
[shader("vertex")] | |
DebugPointVertexInOut DebugDrawPass_VertexPoint(DebugPointVertex debugVertex) { | |
DebugPointVertexInOut output; | |
output.position = mul(uniforms.worldToProjection, float4(debugVertex.position, 1)); | |
output.colour = debugVertex.colour; // inverseToneMap(debugVertex.colour); | |
output.size = debugVertex.size; | |
return output; | |
} | |
[shader("pixel")] | |
float4 DebugDrawPass_FragmentPoint(DebugPointVertexInOut input) : SV_Target { | |
return input.colour; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment