Fix minor shader compilation warnings

This commit is contained in:
Wojtek Figat
2025-01-07 21:55:31 +01:00
parent edaed7bda1
commit 7f0d852f49

View File

@@ -299,18 +299,18 @@ half3x3 CalcTangentToLocal(ModelInput input)
float3 normal = input.Normal.xyz * 2.0 - 1.0; float3 normal = input.Normal.xyz * 2.0 - 1.0;
float3 tangent = input.Tangent.xyz * 2.0 - 1.0; float3 tangent = input.Tangent.xyz * 2.0 - 1.0;
float3 bitangent = cross(normal, tangent) * bitangentSign; float3 bitangent = cross(normal, tangent) * bitangentSign;
return float3x3(tangent, bitangent, normal); return (half3x3)float3x3(tangent, bitangent, normal);
} }
half3x3 CalcTangentToWorld(in float4x4 world, in half3x3 tangentToLocal) half3x3 CalcTangentToWorld(in float4x4 world, in half3x3 tangentToLocal)
{ {
half3x3 localToWorld = RemoveScaleFromLocalToWorld((float3x3)world); half3x3 localToWorld = (half3x3)RemoveScaleFromLocalToWorld((float3x3)world);
return mul(tangentToLocal, localToWorld); return mul(tangentToLocal, localToWorld);
} }
float3 GetParticlePosition(uint ParticleIndex) float3 GetParticlePosition(uint particleIndex)
{ {
return TransformParticlePosition(GetParticleVec3(ParticleIndex, PositionOffset)); return TransformParticlePosition(GetParticleVec3(particleIndex, PositionOffset));
} }
// Vertex Shader function for Sprite Rendering // Vertex Shader function for Sprite Rendering
@@ -405,7 +405,7 @@ VertexOutput VS_Sprite(SpriteInput input, uint particleIndex : SV_InstanceID)
output.InstanceParams = PerInstanceRandom; output.InstanceParams = PerInstanceRandom;
// Calculate tanget space to world space transformation matrix for unit vectors // Calculate tanget space to world space transformation matrix for unit vectors
half3x3 tangentToLocal = float3x3(axisX, axisY, axisZ); half3x3 tangentToLocal = half3x3(axisX, axisY, axisZ);
half3x3 tangentToWorld = CalcTangentToWorld(world, tangentToLocal); half3x3 tangentToWorld = CalcTangentToWorld(world, tangentToLocal);
output.TBN = tangentToWorld; output.TBN = tangentToWorld;
@@ -610,7 +610,7 @@ VertexOutput VS_Ribbon(RibbonInput input, uint vertexIndex : SV_VertexID)
{ {
output.TexCoord.x = (float)input.Order / (float)RibbonSegmentCount; output.TexCoord.x = (float)input.Order / (float)RibbonSegmentCount;
} }
output.TexCoord.y = (vertexIndex + 1) & 0x1; output.TexCoord.y = (float)((vertexIndex + 1) & 0x1);
output.TexCoord = output.TexCoord * RibbonUVScale + RibbonUVOffset; output.TexCoord = output.TexCoord * RibbonUVScale + RibbonUVOffset;
// Compute world space vertex position // Compute world space vertex position
@@ -629,7 +629,7 @@ VertexOutput VS_Ribbon(RibbonInput input, uint vertexIndex : SV_VertexID)
output.InstanceParams = PerInstanceRandom; output.InstanceParams = PerInstanceRandom;
// Calculate tanget space to world space transformation matrix for unit vectors // Calculate tanget space to world space transformation matrix for unit vectors
half3x3 tangentToLocal = float3x3(tangentRight, tangentUp, cross(tangentRight, tangentUp)); half3x3 tangentToLocal = half3x3(tangentRight, tangentUp, cross(tangentRight, tangentUp));
half3x3 tangentToWorld = CalcTangentToWorld(world, tangentToLocal); half3x3 tangentToWorld = CalcTangentToWorld(world, tangentToLocal);
output.TBN = tangentToWorld; output.TBN = tangentToWorld;