Skip to content

Commit

Permalink
[REMIX-2983] Cleanup unreachable shader code
Browse files Browse the repository at this point in the history
Several functions in polymorphic surface material interaction were remnants from the original design, and were never actually called anywhere. I went through all of the functions in the various surface_material_interaction classes and removed the ones that are never referenced in the dxvk-remix codebase.

See merge request lightspeedrtx/dxvk-remix-nv!879
  • Loading branch information
MarkEHenderson committed Jun 25, 2024
1 parent a1ee2d4 commit 07626a6
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 517 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1334,23 +1334,6 @@ SurfaceMaterialInteractionSample thinOpaqueSurfaceMaterialInteractionCalcDiffuse
return materialSample;
}

SurfaceMaterialInteractionSample opaqueSurfaceMaterialInteractionCalcSpecularTransmissionSample(
OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
inout bool insideMedium, inout bool penetrateSurface)
{
SurfaceMaterialInteractionSample materialSample;

materialSample.inputDirection = f16vec3(0.0, 0.0, 0.0);
materialSample.throughput = f16vec3(0.0, 0.0, 0.0);
materialSample.solidAnglePdf = 0.0f;

// Note: Transmission rays penetrate the surface like translucent materials.
penetrateSurface = true;

return materialSample;
}

// Note: Special case lobe for opacity.
SurfaceMaterialInteractionSample opaqueSurfaceMaterialInteractionCalcOpacityTransmissionSample(
OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction,
Expand Down Expand Up @@ -1648,15 +1631,6 @@ float opaqueSurfaceMaterialInteractionCalcDiffuseTransmissionSolidAnglePdf(
return solidAnglePdf;
}

float opaqueSurfaceMaterialInteractionCalcSpecularTransmissionSolidAnglePdf(
OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
// Note: Specular Transmission never possible for Opaque materials
return 0.0f;
}

float opaqueSurfaceMaterialInteractionCalcSolidAnglePdf(
OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,142 +130,6 @@ PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteractionCreat
}
}

SurfaceMaterialInteractionLobeInformation polymorphicSurfaceMaterialInteractionGetLobeInformation(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionGetLobeInformation(opaqueSurfaceMaterialInteraction);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionGetLobeInformation(translucentSurfaceMaterialInteraction);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionGetLobeInformation(rayPortalSurfaceMaterialInteraction);
}
}

SurfaceMaterialInteractionSample polymorphicSurfaceMaterialInteractionCalcDiffuseReflectionSample(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
inout RNG randomState,
MinimalRayInteraction minimalRayInteraction)
{
const f16vec4 tangentToWorldSpaceQuaternion =
quaternionCreateOrientation(materialTangentSpaceNormal, polymorphicSurfaceMaterialInteraction.shadingNormal);

const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcDiffuseReflectionSample(opaqueSurfaceMaterialInteraction, randomState, tangentToWorldSpaceQuaternion, minimalRayInteraction);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcDiffuseReflectionSample(translucentSurfaceMaterialInteraction, minimalRayInteraction);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcDiffuseReflectionSample(rayPortalSurfaceMaterialInteraction, minimalRayInteraction);
}
}

SurfaceMaterialInteractionSample polymorphicSurfaceMaterialInteractionCalcSpecularReflectionSample(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
inout RNG randomState,
MinimalRayInteraction minimalRayInteraction,
bool insideMedium)
{
const f16vec4 tangentToWorldSpaceQuaternion =
quaternionCreateOrientation(materialTangentSpaceNormal, polymorphicSurfaceMaterialInteraction.shadingNormal);

const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcSpecularReflectionSample(opaqueSurfaceMaterialInteraction, randomState, tangentToWorldSpaceQuaternion, minimalRayInteraction);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcSpecularReflectionSample(translucentSurfaceMaterialInteraction, tangentToWorldSpaceQuaternion, minimalRayInteraction, insideMedium);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcSpecularReflectionSample(rayPortalSurfaceMaterialInteraction, minimalRayInteraction);
}
}

SurfaceMaterialInteractionSample polymorphicSurfaceMaterialInteractionCalcDiffuseTransmissionSample(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
inout RNG randomState,
MinimalRayInteraction minimalRayInteraction,
inout bool insideMedium, inout bool penetrateSurface)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const f16vec4 tangentToWorldSpaceQuaternion =
quaternionCreateOrientation(materialTangentSpaceNormal, polymorphicSurfaceMaterialInteraction.shadingNormal);

const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcDiffuseTransmissionSample(
opaqueSurfaceMaterialInteraction, randomState, tangentToWorldSpaceQuaternion, minimalRayInteraction, insideMedium, penetrateSurface);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcDiffuseTransmissionSample(translucentSurfaceMaterialInteraction, minimalRayInteraction, insideMedium, penetrateSurface);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcDiffuseTransmissionSample(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, insideMedium, penetrateSurface);
}
}

SurfaceMaterialInteractionSample polymorphicSurfaceMaterialInteractionCalcSpecularTransmissionSample(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
inout RNG randomState,
MinimalRayInteraction minimalRayInteraction,
inout bool insideMedium, inout bool penetrateSurface)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcSpecularTransmissionSample(opaqueSurfaceMaterialInteraction, minimalRayInteraction, insideMedium, penetrateSurface);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcSpecularTransmissionSample(translucentSurfaceMaterialInteraction, minimalRayInteraction, insideMedium, penetrateSurface);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcSpecularTransmissionSample(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, insideMedium, penetrateSurface);
}
}

void polymorphicSurfaceMaterialInteractionCalcSample(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
inout RNG randomState,
Expand Down Expand Up @@ -374,131 +238,6 @@ void polymorphicSurfaceMaterialInteractionCalcPSRSample(
}
}

float polymorphicSurfaceMaterialInteractionCalcDiffuseReflectionSolidAnglePdf(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcDiffuseReflectionSolidAnglePdf(opaqueSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcDiffuseReflectionSolidAnglePdf(translucentSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcDiffuseReflectionSolidAnglePdf(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
}
}

float polymorphicSurfaceMaterialInteractionCalcSpecularReflectionSolidAnglePdf(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcSpecularReflectionSolidAnglePdf(opaqueSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcSpecularReflectionSolidAnglePdf(translucentSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcSpecularReflectionSolidAnglePdf(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
}
}

float polymorphicSurfaceMaterialInteractionCalcDiffuseTransmissionSolidAnglePdf(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcDiffuseTransmissionSolidAnglePdf(opaqueSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcDiffuseTransmissionSolidAnglePdf(translucentSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcDiffuseTransmissionSolidAnglePdf(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
}
}

float polymorphicSurfaceMaterialInteractionCalcSpecularTransmissionSolidAnglePdf(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcSpecularTransmissionSolidAnglePdf(opaqueSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcSpecularTransmissionSolidAnglePdf(translucentSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcSpecularTransmissionSolidAnglePdf(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
}
}

float polymorphicSurfaceMaterialInteractionCalcSolidAnglePdf(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction,
MinimalRayInteraction minimalRayInteraction,
f16vec3 inputDirection)
{
const uint8_t polymorphicType = polymorphicSurfaceMaterialInteractionGetTypeHelper(polymorphicSurfaceMaterialInteraction);

switch (uint(polymorphicType))
{
default:
case uint(surfaceMaterialTypeOpaque):
const OpaqueSurfaceMaterialInteraction opaqueSurfaceMaterialInteraction = opaqueSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return opaqueSurfaceMaterialInteractionCalcSolidAnglePdf(opaqueSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeTranslucent):
const TranslucentSurfaceMaterialInteraction translucentSurfaceMaterialInteraction = translucentSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return translucentSurfaceMaterialInteractionCalcSolidAnglePdf(translucentSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
case uint(surfaceMaterialTypeRayPortal):
const RayPortalSurfaceMaterialInteraction rayPortalSurfaceMaterialInteraction = rayPortalSurfaceMaterialInteractionCreate(polymorphicSurfaceMaterialInteraction);

return rayPortalSurfaceMaterialInteractionCalcSolidAnglePdf(rayPortalSurfaceMaterialInteraction, minimalRayInteraction, inputDirection);
}
}

f16vec3 polymorphicSurfaceMaterialInteractionEvalEmissiveRadiance(
PolymorphicSurfaceMaterialInteraction polymorphicSurfaceMaterialInteraction)
{
Expand Down
Loading

0 comments on commit 07626a6

Please sign in to comment.