Skip to content

Commit

Permalink
Fix compile error due to slang change
Browse files Browse the repository at this point in the history
  • Loading branch information
kaizhangNV committed Jan 16, 2025
1 parent c74eb31 commit 7b99d12
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 54 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
echo "tag:$TAG_NAME"
export OS_NAME=linux
export ARCH_NAME=`uname -p`
export FALCOR_PERF_TEST_PACKAGE=falcor_perf_test-${TAG_NAME}-${OS_NAME}-${ARCH_NAME}.zip
export FALCOR_PERF_TEST_PACKAGE=falcor_perf_test-${TAG_NAME}-${OS_NAME}-${ARCH_NAME}-beta.zip
echo "creating zip at ${FALCOR_PERF_TEST_PACKAGE}"
cd build/linux-gcc
zip -r ${FALCOR_PERF_TEST_PACKAGE} bin/Release/*
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
echo "build app"
cmake --build build/windows-ninja-msvc --config Release --verbose
$tagName = & git describe --tags
$binArchive = "falcor_perf_test-$tagName-win-64.zip"
$binArchive = "falcor_perf_test-$tagName-win-64-beta.zip"
echo "package name=$binArchive"
cd build/windows-ninja-msvc
Expand Down
36 changes: 18 additions & 18 deletions source/shaders/RenderPasses/PathTracer/PathState.slang
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,27 @@ enum class BounceType
*/
struct PathState
{
uint id; ///< Path ID encodes (pixel, sampleIdx) with 12 bits each for pixel x|y and 8 bits for sample index.
uint id = 0; ///< Path ID encodes (pixel, sampleIdx) with 12 bits each for pixel x|y and 8 bits for sample index.

uint flagsAndVertexIndex; ///< Higher kPathFlagsBitCount bits: Flags indicating the current status. This can be multiple PathFlags flags OR'ed together.
///< Lower kVertexIndexBitCount bits: Current vertex index (0 = camera, 1 = primary hit, 2 = secondary hit, etc.).
uint16_t rejectedHits; ///< Number of false intersections rejected along the path. This is used as a safeguard to avoid deadlock in pathological cases.
float16_t sceneLength; ///< Path length in scene units (0.f at primary hit).
uint bounceCounters; ///< Packed counters for different types of bounces (see BounceType).
uint flagsAndVertexIndex = 0; ///< Higher kPathFlagsBitCount bits: Flags indicating the current status. This can be multiple PathFlags flags OR'ed together.
///< Lower kVertexIndexBitCount bits: Current vertex index (0 = camera, 1 = primary hit, 2 = secondary hit, etc.).
uint16_t rejectedHits = 0; ///< Number of false intersections rejected along the path. This is used as a safeguard to avoid deadlock in pathological cases.
float16_t sceneLength = 0; ///< Path length in scene units (0.f at primary hit).
uint bounceCounters = 0; ///< Packed counters for different types of bounces (see BounceType).

// Scatter ray
float3 origin; ///< Origin of the scatter ray.
float3 dir; ///< Scatter ray normalized direction.
float pdf; ///< Pdf for generating the scatter ray.
float3 normal; ///< Shading normal at the scatter ray origin.
HitInfo hit; ///< Hit information for the scatter ray. This is populated at committed triangle hits.

float3 thp; ///< Path throughput.
float3 L; ///< Accumulated path contribution.

GuideData guideData; ///< Denoiser guide data.
InteriorList interiorList; ///< Interior list. Keeping track of a stack of materials with medium properties.
SampleGenerator sg; ///< Sample generator state. Typically 4-16B.
float3 origin = 0; ///< Origin of the scatter ray.
float3 dir = 0; ///< Scatter ray normalized direction.
float pdf = 0; ///< Pdf for generating the scatter ray.
float3 normal = 0; ///< Shading normal at the scatter ray origin.
HitInfo hit = {}; ///< Hit information for the scatter ray. This is populated at committed triangle hits.

float3 thp = 0; ///< Path throughput.
float3 L = 0; ///< Accumulated path contribution.

GuideData guideData = {uint4(0), float3(0), 0.0f};///< Denoiser guide data.
InteriorList interiorList = {}; ///< Interior list. Keeping track of a stack of materials with medium properties.
SampleGenerator sg = {uint2(0), 0}; ///< Sample generator state. Typically 4-16B.

// Accessors

Expand Down
2 changes: 1 addition & 1 deletion source/shaders/Rendering/Materials/InteriorList.slang
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ struct InteriorList

static const uint kMaxNestedPriority = ((1 << kNestedPriorityBits) - 1);

uint slots[INTERIOR_LIST_SLOT_COUNT];
uint slots[INTERIOR_LIST_SLOT_COUNT] = {};

/** Make an active material slot given the material and priority.
\param[in] materialID Material ID.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct PBRTCoatedConductorMaterialInstance : MaterialInstanceBase, IMaterialInst
if (!isValidHemisphereReflection(sd, sf, wiLocal, woLocal, wo)) return float3(0.f);

PBRTDielectricBSDF top = {interfaceD, interfaceEta};
PBRTConductorBSDF bottom = {conductorD, conductorEta, conductorK};
PBRTConductorBSDF bottom = {DiffMaterialData()};

return LayeredBSDF(top, bottom).eval(wiLocal, woLocal, sg);
}
Expand All @@ -43,7 +43,7 @@ struct PBRTCoatedConductorMaterialInstance : MaterialInstanceBase, IMaterialInst
float3 woLocal = {};

PBRTDielectricBSDF top = {interfaceD, interfaceEta};
PBRTConductorBSDF bottom = {conductorD, conductorEta, conductorK};
PBRTConductorBSDF bottom = {DiffMaterialData()};

bool valid = LayeredBSDF(top, bottom).sample(wiLocal, woLocal, result.pdf, result.weight, result.lobeType, sg);
result.wo = sf.fromLocal(woLocal);
Expand All @@ -61,7 +61,7 @@ struct PBRTCoatedConductorMaterialInstance : MaterialInstanceBase, IMaterialInst
if (!isValidHemisphereReflection(sd, sf, wiLocal, woLocal, wo)) return 0.f;

PBRTDielectricBSDF top = {interfaceD, interfaceEta};
PBRTConductorBSDF bottom = {conductorD, conductorEta, conductorK};
PBRTConductorBSDF bottom = {DiffMaterialData()};

return LayeredBSDF(top, bottom).evalPdf(wiLocal, woLocal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,14 @@ struct PBRTConductorMaterial : MaterialBase, IMaterial
adjustShadingNormal(sd, sf);
}

PBRTConductorMaterialInstance mi = {sf, {AnisotropicGGX(roughness), baseColor, transColor}};
DiffMaterialData diffData;

uint offset = 0;
diffData.write(baseColor, offset);
diffData.write(transColor, offset);
diffData.write(roughness, offset);

PBRTConductorMaterialInstance mi = {sf, PBRTConductorBSDF(diffData)};

return mi;
}
Expand Down Expand Up @@ -73,8 +80,6 @@ struct PBRTConductorMaterial : MaterialBase, IMaterial
no_diff adjustShadingNormal(sd, sf);
}

PBRTConductorMaterialInstance mi = { sf, { AnisotropicGGX(roughness), baseColor, transColor } };
diffData.sf = sf;

uint offset = 0;
// 0--3: eta (baseColor)
Expand All @@ -84,6 +89,7 @@ struct PBRTConductorMaterial : MaterialBase, IMaterial
// 6--8: roughness
diffData.write(roughness, offset);

PBRTConductorMaterialInstance mi = {sf, PBRTConductorBSDF(diffData)};
return mi;
}
};
4 changes: 2 additions & 2 deletions source/shaders/Rendering/Materials/StandardMaterial.slang
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ struct StandardMaterial : MaterialBase, IMaterial
{
SamplerState s = ms.getTextureSampler(header.getDefaultTextureSamplerID());

StandardBSDFData d = {};
StandardBSDFData d = {DiffMaterialData()};

float16_t IoR = header.getIoR();
d.eta = sd.frontFacing ? (sd.IoR / IoR) : (IoR / sd.IoR);
Expand Down Expand Up @@ -114,7 +114,7 @@ struct StandardMaterial : MaterialBase, IMaterial
{
SamplerState s = ms.getTextureSampler(header.getDefaultTextureSamplerID());

StandardBSDFData d = {};
StandardBSDFData d = {DiffMaterialData()};

uint hashIndex = hashFunction(sd.threadID, gSceneGradients.getHashSize(GradientType::Material));
GradientIOWrapper gradIO = GradientIOWrapper(GradientType::Material, sd.materialGradOffset, hashIndex);
Expand Down
14 changes: 3 additions & 11 deletions source/shaders/Scene/HitInfo.slang
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ typedef uint4 PackedHitInfo;
*/
struct GeometryHit
{
GeometryInstanceID instanceID;
uint primitiveIndex;
float2 barycentrics;
GeometryInstanceID instanceID = {0, 0};
uint primitiveIndex = 0;
float2 barycentrics = float2(0.f, 0.f);

/** Return the barycentric weights.
*/
Expand Down Expand Up @@ -78,8 +78,6 @@ struct TriangleHit : GeometryHit
barycentrics.x = asfloat(packed[2]);
barycentrics.y = asfloat(packed[3]);
#endif
#else
this = {};
#endif
}

Expand Down Expand Up @@ -117,8 +115,6 @@ struct DisplacedTriangleHit : GeometryHit
const uint uy = ((packed[2] & 0xff) << 16) | (packed[3] >> 16);
barycentrics = float2(ux, uy) * (1.f / 16777215);
displacement = f16tof32(packed[3]);
#else
this = {};
#endif
}

Expand Down Expand Up @@ -149,8 +145,6 @@ struct CurveHit : GeometryHit
HitInfo::unpackHeader(packed, instanceID, primitiveIndex);
barycentrics.x = asfloat(packed[2]);
barycentrics.y = asfloat(packed[3]);
#else
this = {};
#endif
}

Expand Down Expand Up @@ -194,8 +188,6 @@ struct SDFGridHit
hitData.hitT = asfloat(packed[2]);
#endif

#else
this = {};
#endif // SCENE_HAS_GEOMETRY_TYPE(GEOMETRY_TYPE_SDF_GRID)
}

Expand Down
28 changes: 14 additions & 14 deletions source/shaders/Scene/ShadingData.slang
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,24 @@ import Utils.Math.ShadingFrame;
struct ShadingData : IDifferentiable
{
// Geometry data
float3 posW; ///< Shading hit position in world space.
float3 V; ///< View direction, -incident direction (-ray.dir)
float2 uv; ///< Texture mapping coordinates.
float3 posW = float3(0.0); ///< Shading hit position in world space.
float3 V = float3(0.0f); ///< View direction, -incident direction (-ray.dir)
float2 uv = float2(0.0f); ///< Texture mapping coordinates.

ShadingFrame frame; ///< Smooth interpolated shading frame in world space at the shading point. The normal is *not* automatically flipped for backfacing hits.
no_diff float3 faceN; ///< Face normal in world space, always on the front-facing side.
no_diff float4 tangentW; ///< Geometric tangent (xyz) and sign (w) in world space. This is used for orthogonalization. Not normalized, but it is guaranteed to be nonzero and sign (w) is +-1.0.
bool frontFacing; ///< True if primitive seen from the front-facing side, i.e., dot(V, faceN) >= 0.0.
no_diff float curveRadius; ///< Curve cross-sectional radius. Valid only for geometry generated from curves.
ShadingFrame frame = ShadingFrame(float3(0.0), float4(0.0));///< Smooth interpolated shading frame in world space at the shading point. The normal is *not* automatically flipped for backfacing hits.
no_diff float3 faceN = float3(0.0); ///< Face normal in world space, always on the front-facing side.
no_diff float4 tangentW = float4(0.0); ///< Geometric tangent (xyz) and sign (w) in world space. This is used for orthogonalization. Not normalized, but it is guaranteed to be nonzero and sign (w) is +-1.0.
bool frontFacing = false; ///< True if primitive seen from the front-facing side, i.e., dot(V, faceN) >= 0.0.
no_diff float curveRadius = 0.0f; ///< Curve cross-sectional radius. Valid only for geometry generated from curves.

// Material data
MaterialHeader mtl; ///< Material header data.
uint materialID; ///< Material ID at shading location.
float IoR; ///< Index of refraction for the medium on the front-facing side (i.e. "outside" the material at the hit).
MaterialHeader mtl = MaterialHeader(); ///< Material header data.
uint materialID = 0; ///< Material ID at shading location.
float IoR = 0.0f; ///< Index of refraction for the medium on the front-facing side (i.e. "outside" the material at the hit).

uint materialGradOffset; ///< Offset to the material gradient in the gradient buffer.
uint geometryGradOffset; ///< Offset to the geometry gradient in the gradient buffer.
uint threadID; ///< Thread ID for gradient aggregation with a hash grid.
uint materialGradOffset = 0; ///< Offset to the material gradient in the gradient buffer.
uint geometryGradOffset = 0; ///< Offset to the geometry gradient in the gradient buffer.
uint threadID = 0; ///< Thread ID for gradient aggregation with a hash grid.

// Utility functions

Expand Down

0 comments on commit 7b99d12

Please sign in to comment.