The following code is from ps_main of RasterizedGBuffer.hlsl
#ifdef SPIRV
GeometrySample gs = (GeometrySample)0;
gs.instance = t_InstanceData[g_Instance.instance];
gs.geometry = t_GeometryData[gs.instance.firstGeometryIndex + g_Instance.geometryIndex];
gs.material = t_MaterialConstants[gs.geometry.materialIndex];
gs.texcoord = i_texcoord;
gs.objectSpacePosition = i_objectPos;
gs.prevObjectSpacePosition = i_prevObjectPos;
gs.geometryNormal = normalize(i_normal);
gs.tangent.xyz = normalize(i_tangent.xyz);
gs.tangent.w = i_tangent.w;
#else
GeometrySample gs = getGeometryFromHit(g_Instance.instance, g_Instance.geometryIndex, i_primitiveID, i_bary.yz,
GeomAttr_All, t_InstanceData, t_GeometryData, t_MaterialConstants);
#endif
Within the getGeometryFromHit, we transform the normal and tangent from object space to world space. But for SPIRV version, we keep using the object space normal and tangent.
The following code is from ps_main of RasterizedGBuffer.hlsl
Within the getGeometryFromHit, we transform the normal and tangent from object space to world space. But for SPIRV version, we keep using the object space normal and tangent.