Fix code style

This commit is contained in:
Wojtek Figat
2020-12-30 22:56:17 +01:00
parent 5e469a0ae3
commit 05790ab9a1
62 changed files with 300 additions and 456 deletions

View File

@@ -114,8 +114,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Input macro specified by the material: DECAL_BLEND_MODE
@@ -160,12 +159,9 @@ void PS_Decal(
float3 positionWS = positionHS.xyz / positionHS.w;
float3 positionOS = mul(float4(positionWS, 1), InvWorld).xyz;
// Clip content outside the decal
clip(0.5 - abs(positionOS.xyz));
// By default, map textures using the vectors perpendicular to the projection direction
float2 decalUVs = positionOS.xz + 0.5f;
// Setup material input
MaterialInput materialInput = (MaterialInput)0;
materialInput.WorldPosition = positionWS;

View File

@@ -197,8 +197,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Vertex Shader function for GUI materials rendering

View File

@@ -330,8 +330,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Calculates the transform matrix from mesh tangent space to local space
@@ -834,7 +833,7 @@ float4 PS_Distortion(PixelInput input) : SV_Target0
// Scale up for better precision in low/subtle refractions at the expense of artefacts at higher refraction
distortion *= 4.0f;
// Store positive and negative offsets separately
// Use separate storage for positive and negative offsets
float2 addOffset = max(distortion, 0);
float2 subOffset = abs(min(distortion, 0));
return float4(addOffset.x, addOffset.y, subOffset.x, subOffset.y);

View File

@@ -134,8 +134,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Pixel Shader function for PostFx materials rendering

View File

@@ -340,8 +340,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Calculates the transform matrix from mesh tangent space to local space
@@ -500,7 +499,7 @@ float3x4 GetBoneMatrix(int index)
}
// Calculates the transposed transform matrix for the given vertex (uses blending)
float3x4 CalcBoneMatrix(ModelInput_Skinned input)
float3x4 GetBoneMatrix(ModelInput_Skinned input)
{
float3x4 boneMatrix = input.BlendWeights.x * GetBoneMatrix(input.BlendIndices.x);
boneMatrix += input.BlendWeights.y * GetBoneMatrix(input.BlendIndices.y);
@@ -549,7 +548,7 @@ VertexOutput VS_Skinned(ModelInput_Skinned input)
// Perform skinning
SkinningData data;
data.BlendMatrix = CalcBoneMatrix(input);
data.BlendMatrix = GetBoneMatrix(input);
float3 position = SkinPosition(input, data);
float3x3 tangentToLocal = SkinTangents(input, data);
@@ -808,7 +807,6 @@ TessalationDSToPS DS(TessalationPatch constantData, float3 barycentricCoords : S
#define COPY(thing) output.thing = input[0].thing
INTERPOLATE(Position);
#if MATERIAL_TESSELLATION == MATERIAL_TESSELLATION_PN
// Precompute squares and squares * 3
float UU = U * U;
float VV = V * V;
float WW = W * W;

View File

@@ -337,8 +337,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Calculates the transform matrix from mesh tangent space to local space
@@ -474,7 +473,7 @@ float3x4 GetBoneMatrix(int index)
}
// Calculates the transposed transform matrix for the given vertex (uses blending)
float3x4 CalcBoneMatrix(ModelInput_Skinned input)
float3x4 GetBoneMatrix(ModelInput_Skinned input)
{
float3x4 boneMatrix = input.BlendWeights.x * GetBoneMatrix(input.BlendIndices.x);
boneMatrix += input.BlendWeights.y * GetBoneMatrix(input.BlendIndices.y);
@@ -521,7 +520,7 @@ VertexOutput VS_Skinned(ModelInput_Skinned input)
// Perform skinning
SkinningData data;
data.BlendMatrix = CalcBoneMatrix(input);
data.BlendMatrix = GetBoneMatrix(input);
float3 position = SkinPosition(input, data);
half3x3 tangentToLocal = SkinTangents(input, data);
@@ -755,7 +754,6 @@ TessalationDSToPS DS(TessalationPatch constantData, float3 barycentricCoords : S
#define COPY(thing) output.thing = input[0].thing
INTERPOLATE(Position);
#if MATERIAL_TESSELLATION == MATERIAL_TESSELLATION_PN
// Precompute squares and squares * 3
float UU = U * U;
float VV = V * V;
float WW = W * W;
@@ -977,8 +975,8 @@ float4 PS_Distortion(PixelInput input) : SV_Target0
// Scale up for better precision in low/subtle refractions at the expense of artefacts at higher refraction
distortion *= 4.0f;
// Store positive and negative offsets separately
// Use separate storage for positive and negative offsets
float2 addOffset = max(distortion, 0);
float2 subOffset = abs(min(distortion, 0));
return float4(addOffset.x, addOffset.y, subOffset.x, subOffset.y);

View File

@@ -234,8 +234,7 @@ Material GetMaterialPS(MaterialInput input)
@4
}
// Programmatically set the line number after all the material inputs which have a variable number of line endings
// This allows shader error line numbers after this point to be the same regardless of which material is being compiled
// Fix line for errors/warnings for shader code from template
#line 1000
// Calculates LOD value (with fractional part for blending)
@@ -595,7 +594,6 @@ TessalationDSToPS DS(TessalationPatch constantData, float3 barycentricCoords : S
#define COPY(thing) output.thing = input[0].thing
INTERPOLATE(Position);
#if MATERIAL_TESSELLATION == MATERIAL_TESSELLATION_PN
// Precompute squares and squares * 3
float UU = U * U;
float VV = V * V;
float WW = W * W;