Skip to content

Commit

Permalink
Merge branch 'dev/adunn/pom_fix_2' into 'main'
Browse files Browse the repository at this point in the history
[REMIX-3574] Make sure we disable POM in situations where its not used

See merge request lightspeedrtx/dxvk-remix-nv!1005
  • Loading branch information
nsubtil committed Oct 8, 2024
2 parents 0cd9b66 + 62761b4 commit fd48377
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/dxvk/shaders/rtx/algorithm/integrator_direct.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void evalNEEPrimary(
// is disabled, we must also handle that user choice gracefully.
const bool pomOpaqueSurfaceEncountered = geometryFlags.pomOpaqueSurfaceEncountered && cb.pomEnableDirectLighting;

const uint16_t primarySurfaceIndex = pomOpaqueSurfaceEncountered ? uint16_t(SharedSurfaceIndex[pixelCoordinate]) : BINDING_INDEX_INVALID;
const uint16_t primarySurfaceIndex = uint16_t(SharedSurfaceIndex[pixelCoordinate]);

const bool isSubsurface = isSubsurfaceMaterial(opaqueSurfaceMaterialInteraction);

Expand Down
4 changes: 1 addition & 3 deletions src/dxvk/shaders/rtx/algorithm/integrator_indirect.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -638,13 +638,11 @@ void integratePathVertex(
{
const bool isViewModel = pathState.rayMask & OBJECT_MASK_ALL_VIEWMODEL;

uint16_t surfaceIndex = pomOpaqueSurfaceEncountered ? uint(rayInteraction.surfaceIndex) : BINDING_INDEX_INVALID;

// Todo: Ray Portal transport sampling in the future.
evalNEESecondary(
lightSample, invalidRayPortalIndex, pathState.portalSpace, pathState.rayMask, pomOpaqueSurfaceEncountered,
isViewModel, ray, rayInteraction, surfaceInteraction, opaqueSurfaceMaterialInteraction,
diffuseLight, specularLight, surfaceIndex, surfaceInteraction.textureCoordinates);
diffuseLight, specularLight, rayInteraction.surfaceIndex, surfaceInteraction.textureCoordinates);

// Create a NEE Cache task for lights with non-zero contributions.
// Both light task and emissive triangle task are using the same buffer, skip some pixels so that triangle tasks on them won't be overwritten by light tasks.
Expand Down
3 changes: 3 additions & 0 deletions src/dxvk/shaders/rtx/algorithm/resolve.slangh
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ void resolveVertex<T: IBasePayloadState>(
bool teleport = false;
mat4 teleportMatrix = mat4(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1);

// Set the default value we want to use when nothing opaque is hit
pomOpaqueSurfaceEncountered = false;

// Create a Ray and Ray Interaction from the hit

// Todo: Use minimal ray or something else when we have generic functions as this has
Expand Down
3 changes: 1 addition & 2 deletions src/dxvk/shaders/rtx/pass/integrate/integrate_nee.comp.slang
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,11 @@ void main(uint2 threadIndex : SV_DispatchThreadID, uint2 LocalIndex : SV_GroupTh

uint8_t rayMask = OBJECT_MASK_OPAQUE | (geometryFlags.objectMask & OBJECT_MASK_ALL_DYNAMIC);
bool pomOpaqueSurfaceEncountered = cb.pomEnableNEECache && opaqueSurfaceMaterialInteractionHasHeightTexture(opaqueSurfaceMaterialInteraction);
uint16_t surfaceIndex = pomOpaqueSurfaceEncountered ? uint16_t(SharedSurfaceIndex[threadIndex]) : BINDING_INDEX_INVALID;
isVisible = evalNEESecondary(
lightSample, invalidRayPortalIndex, surface.portalSpace, rayMask, pomOpaqueSurfaceEncountered,
surface.isViewModel, primaryRay,
minimalRayInteraction, minimalSurfaceInteraction, opaqueSurfaceMaterialInteraction,
diffuseLight, specularLight, surfaceIndex, SharedTextureCoord[threadIndex]);
diffuseLight, specularLight, SharedSurfaceIndex[threadIndex], SharedTextureCoord[threadIndex]);

// Skip some pixels to reduce memory traffic, especially when large screen area is occupied by a single cell.
if (any(diffuseLight + specularLight) > 0 && (threadIndex.x + threadIndex.y) % 4 == 0)
Expand Down

0 comments on commit fd48377

Please sign in to comment.