Tidy up vertex-fragment structures in HLSL shaders

* Fix a few mismatches and delete wireframeV2F which is not needed in any other
  shaders but the mesh rendering path. Others just need SV_Position.
This commit is contained in:
baldurk
2018-08-01 12:04:26 +01:00
parent 196daacfb4
commit 0b6f735ad2
3 changed files with 27 additions and 53 deletions
+8 -26
View File
@@ -195,36 +195,18 @@ struct MultipleOutput
float4 col7 : SV_Target7;
};
struct wireframeV2F
float4 RENDERDOC_FullscreenVS(uint id : SV_VertexID) : SV_Position
{
float4 pos : SV_Position;
float3 norm : Normal;
float4 secondary : Secondary;
};
wireframeV2F RENDERDOC_FullscreenVS(uint id : SV_VertexID)
{
wireframeV2F OUT = (wireframeV2F)0;
float4 pos[] = {
float4( -1.0f, 1.0f, 0.0f, 1.0f),
float4( 3.0f, 1.0f, 0.0f, 1.0f),
float4( -1.0f, -3.0f, 0.0f, 1.0f)
};
float2 uv[] = {
float2(0.0f, 0.0f),
float2(2.0f, 0.0f),
float2(0.0f, 2.0f)
};
OUT.pos = pos[id];
OUT.secondary = float4(uv[id].xy, 0, 1);
return OUT;
return pos[id];
}
MultipleOutput RENDERDOC_WireframePS(wireframeV2F IN)
MultipleOutput RENDERDOC_WireframePS()
{
MultipleOutput OUT = (MultipleOutput)0;
@@ -246,7 +228,7 @@ cbuffer overlayconsts : register(b0)
float4 overlaycol;
};
MultipleOutput RENDERDOC_FixedColPS(float4 IN : SV_Position)
MultipleOutput RENDERDOC_FixedColPS()
{
MultipleOutput OUT = (MultipleOutput)0;
@@ -263,11 +245,11 @@ MultipleOutput RENDERDOC_FixedColPS(float4 IN : SV_Position)
return OUT;
}
float4 RENDERDOC_OutlinePS(float4 IN : SV_Position) : SV_Target0
float4 RENDERDOC_OutlinePS(float4 pos : SV_Position) : SV_Target0
{
float4 ret = Channels;
float2 rectPos = IN.xy - float2(RangeMinimum, InverseRangeSize);
float2 rectPos = pos.xy - float2(RangeMinimum, InverseRangeSize);
float2 rectSize = TextureResolutionPS.xy;
float2 ab = fmod(rectPos.xy, 32.0.xx);
@@ -302,9 +284,9 @@ float4 RENDERDOC_OutlinePS(float4 IN : SV_Position) : SV_Target0
return ret;
}
float4 RENDERDOC_CheckerboardPS(float4 IN : SV_Position) : SV_Target0
float4 RENDERDOC_CheckerboardPS(float4 pos : SV_Position) : SV_Target0
{
float2 ab = fmod(IN.xy, 128.0.xx);
float2 ab = fmod(pos.xy, 128.0.xx);
if(
(ab.x < 64 && ab.y < 64) ||
+7 -7
View File
@@ -22,7 +22,7 @@
* THE SOFTWARE.
******************************************************************************/
struct wireframeV2F
struct meshV2F
{
float4 pos : SV_Position;
float3 norm : Normal;
@@ -35,9 +35,9 @@ struct meshA2V
float4 secondary : sec;
};
wireframeV2F RENDERDOC_MeshVS(meshA2V IN, uint vid : SV_VertexID)
meshV2F RENDERDOC_MeshVS(meshA2V IN, uint vid : SV_VertexID)
{
wireframeV2F OUT = (wireframeV2F)0;
meshV2F OUT = (meshV2F)0;
float2 psprite[4] =
{
@@ -67,7 +67,7 @@ cbuffer viewportCBuf : register(b0)
};
[maxvertexcount(3)]
void RENDERDOC_TriangleSizeGS(triangle wireframeV2F input[3], inout TriangleStream<triSizeV2F> TriStream)
void RENDERDOC_TriangleSizeGS(triangle meshV2F input[3], inout TriangleStream<triSizeV2F> TriStream)
{
triSizeV2F output;
@@ -114,9 +114,9 @@ float4 RENDERDOC_TriangleSizePS(triSizeV2F IN) : SV_Target0
}
[maxvertexcount(3)]
void RENDERDOC_MeshGS(triangle wireframeV2F input[3], inout TriangleStream<wireframeV2F> TriStream)
void RENDERDOC_MeshGS(triangle meshV2F input[3], inout TriangleStream<meshV2F> TriStream)
{
wireframeV2F output;
meshV2F output;
float4 faceEdgeA = mul(input[1].pos, InvProj) - mul(input[0].pos, InvProj);
float4 faceEdgeB = mul(input[2].pos, InvProj) - mul(input[0].pos, InvProj);
@@ -137,7 +137,7 @@ cbuffer MeshColourPush : register(b2)
float4 MeshColour;
}
float4 RENDERDOC_MeshPS(wireframeV2F IN) : SV_Target0
float4 RENDERDOC_MeshPS(meshV2F IN) : SV_Target0
{
uint type = OutputDisplayFormat;
+12 -20
View File
@@ -27,14 +27,6 @@
// (or serialising it back in, for that matter), we copy each sample to a slice in a
// 2DArray texture, and vice-versa. These shaders do that copy as appropriate.
struct wireframeV2F
{
float4 pos : SV_Position;
float3 norm : Normal;
float3 color : COLOR;
float2 tex : TEXCOORD0;
};
cbuffer msarraycopyconsts : register(b0)
{
uint sampleCount;
@@ -49,9 +41,9 @@ Texture2DMSArray<uint4, 8> sourceMS8 : register(t3);
Texture2DMSArray<uint4, 16> sourceMS16 : register(t4);
Texture2DMSArray<uint4, 32> sourceMS32 : register(t5);
uint4 RENDERDOC_CopyMSToArray(wireframeV2F IN) : SV_Target0
uint4 RENDERDOC_CopyMSToArray(float4 pos : SV_Position) : SV_Target0
{
uint3 srcCoord = uint3(IN.pos.x, IN.pos.y, currentSlice);
uint3 srcCoord = uint3(pos.x, pos.y, currentSlice);
if(sampleCount == 2)
{
@@ -83,9 +75,9 @@ Texture2DMSArray<float4, 8> sourceFloatMS8 : register(t3);
Texture2DMSArray<float4, 16> sourceFloatMS16 : register(t4);
Texture2DMSArray<float4, 32> sourceFloatMS32 : register(t5);
float4 RENDERDOC_FloatCopyMSToArray(wireframeV2F IN) : SV_Target0
float4 RENDERDOC_FloatCopyMSToArray(float4 pos : SV_Position) : SV_Target0
{
uint3 srcCoord = uint3(IN.pos.x, IN.pos.y, currentSlice);
uint3 srcCoord = uint3(pos.x, pos.y, currentSlice);
if(sampleCount == 2)
{
@@ -123,9 +115,9 @@ Texture2DMSArray<uint2, 8> sourceStencilMS8 : register(t13);
Texture2DMSArray<uint2, 16> sourceStencilMS16 : register(t14);
Texture2DMSArray<uint2, 32> sourceStencilMS32 : register(t15);
float RENDERDOC_DepthCopyMSToArray(wireframeV2F IN) : SV_Depth
float RENDERDOC_DepthCopyMSToArray(float4 pos : SV_Position) : SV_Depth
{
uint3 srcCoord = uint3(IN.pos.x, IN.pos.y, currentSlice);
uint3 srcCoord = uint3(pos.x, pos.y, currentSlice);
if(currentStencil < 256)
{
@@ -182,18 +174,18 @@ float RENDERDOC_DepthCopyMSToArray(wireframeV2F IN) : SV_Depth
Texture2DArray<uint4> sourceArray : register(t0);
uint4 RENDERDOC_CopyArrayToMS(wireframeV2F IN, uint curSample : SV_SampleIndex) : SV_Target0
uint4 RENDERDOC_CopyArrayToMS(float4 pos : SV_Position, uint curSample : SV_SampleIndex) : SV_Target0
{
uint4 srcCoord = uint4(IN.pos.x, IN.pos.y, currentSlice*sampleCount + curSample, 0);
uint4 srcCoord = uint4(pos.x, pos.y, currentSlice*sampleCount + curSample, 0);
return sourceArray.Load(srcCoord);
}
Texture2DArray<float4> sourceFloatArray : register(t0);
float4 RENDERDOC_FloatCopyArrayToMS(wireframeV2F IN, uint curSample : SV_SampleIndex) : SV_Target0
float4 RENDERDOC_FloatCopyArrayToMS(float4 pos : SV_Position, uint curSample : SV_SampleIndex) : SV_Target0
{
uint4 srcCoord = uint4(IN.pos.x, IN.pos.y, currentSlice*sampleCount + curSample, 0);
uint4 srcCoord = uint4(pos.x, pos.y, currentSlice*sampleCount + curSample, 0);
return sourceFloatArray.Load(srcCoord);
}
@@ -201,9 +193,9 @@ float4 RENDERDOC_FloatCopyArrayToMS(wireframeV2F IN, uint curSample : SV_SampleI
Texture2DArray<float2> sourceDepthArray : register(t0);
Texture2DArray<uint2> sourceStencilArray : register(t1);
float RENDERDOC_DepthCopyArrayToMS(wireframeV2F IN, uint curSample : SV_SampleIndex) : SV_Depth
float RENDERDOC_DepthCopyArrayToMS(float4 pos : SV_Position, uint curSample : SV_SampleIndex) : SV_Depth
{
uint4 srcCoord = uint4(IN.pos.x, IN.pos.y, currentSlice*sampleCount + curSample, 0);
uint4 srcCoord = uint4(pos.x, pos.y, currentSlice*sampleCount + curSample, 0);
if(currentStencil < 1000)
{