Skip to content

fix SPD_AtomicCounter buffer stride to match with shader src#189

Open
repelliuss wants to merge 1 commit into
GPUOpen-LibrariesAndSDKs:release-FSR3-3.0.4from
repelliuss:fix-spd-counter-stride
Open

fix SPD_AtomicCounter buffer stride to match with shader src#189
repelliuss wants to merge 1 commit into
GPUOpen-LibrariesAndSDKs:release-FSR3-3.0.4from
repelliuss:fix-spd-counter-stride

Conversation

@repelliuss

@repelliuss repelliuss commented Jun 26, 2026

Copy link
Copy Markdown

FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC buffer descriptor stride was 4 bytes while it is defined to be 24 bytes in HLSL. The fix removed the validation errors I encountered with D3D.

     struct SpdGlobalAtomicBuffer { FfxUInt32 counter[6]; };
     globallycoherent RWStructuredBuffer<SpdGlobalAtomicBuffer>  rw_internal_global_atomic       : FFX_SPD_DECLARE_UAV(FFX_SPD_BIND_UAV_INTERNAL_GLOBAL_ATOMIC);

The reason I opened this PR to release branch is that main branch no longer host the SPD source code for some reason.

diff --git a/sdk/src/components/spd/ffx_spd.cpp b/sdk/src/components/spd/ffx_spd.cpp
index 323bd44..b5ac5c6 100644
--- a/sdk/src/components/spd/ffx_spd.cpp
+++ b/sdk/src/components/spd/ffx_spd.cpp
@@ -348,7 +348,7 @@ static FfxErrorCode spdCreate(FfxSpdContext_Private* context, const FfxSpdContex
     // Create the atomic buffer resource used as a counter in SPD
     uint32_t atomicInitData[6] = { 0U, 0U, 0U, 0U, 0U, 0U };
     const FfxInternalResourceDescription internalSurfaceDesc = { FFX_SPD_RESOURCE_IDENTIFIER_INTERNAL_GLOBAL_ATOMIC, L"SPD_AtomicCounter", FFX_RESOURCE_TYPE_BUFFER, FFX_RESOURCE_USAGE_UAV,
-            FFX_SURFACE_FORMAT_UNKNOWN, 6 * sizeof(uint32_t), sizeof(uint32_t), 1, FFX_RESOURCE_FLAGS_NONE, sizeof(atomicInitData),& atomicInitData};
+            FFX_SURFACE_FORMAT_UNKNOWN, 6 * sizeof(uint32_t), 6 * sizeof(uint32_t), 1, FFX_RESOURCE_FLAGS_NONE, sizeof(atomicInitData),& atomicInitData};

     // Clear the SRV resources to NULL.
     memset(context->srvResources, 0, sizeof(context->srvResources));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant