Skip to content

Commit 99a81ee

Browse files
committed
Merge branch 'private/adunn/fix-pipeline-1100' into 'main'
[pipeline-1100] Guard particle spawn texcoord fetch against missing UVs See merge request lightspeedrtx/dxvk-remix-nv!2261
2 parents 0773bfb + 4c8b2ad commit 99a81ee

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

src/dxvk/shaders/rtx/pass/particles/particle_system_spawn.comp.slang

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,19 @@ GpuParticle respawn(uint particleIdx, uint spawnCtxIdx, const GpuParticleSystem
106106
color += unorm4x8ToFloat4x32(colorBits).zyxw * randomBary[i];
107107
}
108108

109-
const uint baseSrcTexcoordOffset = (spawnCtx.spawnMeshTexcoordsOffset + index * spawnCtx.spawnMeshTexcoordsStride) / 4;
110-
float2 texcoord = float2(BUFFER_ARRAY(geometries, (uint)spawnCtx.spawnMeshTexcoordsIdx, baseSrcTexcoordOffset + 0),
111-
BUFFER_ARRAY(geometries, (uint)spawnCtx.spawnMeshTexcoordsIdx, baseSrcTexcoordOffset + 1));
109+
// Only fetch emitter UVs when a valid texcoord buffer is bound. For a mesh without UVs,
110+
// spawnMeshTexcoordsIdx == BINDING_INDEX_INVALID (0xFFFF); reading geometries[0xFFFF] is an
111+
// out-of-range bindless descriptor access and faults the GPU (device loss). Mirrors the
112+
// existing guards on the color and prev-position reads above.
113+
float2 texcoord = float2(0.0f, 0.0f);
114+
if (spawnCtx.spawnMeshTexcoordsIdx != BINDING_INDEX_INVALID)
115+
{
116+
const uint baseSrcTexcoordOffset = (spawnCtx.spawnMeshTexcoordsOffset + index * spawnCtx.spawnMeshTexcoordsStride) / 4;
117+
texcoord = float2(BUFFER_ARRAY(geometries, (uint)spawnCtx.spawnMeshTexcoordsIdx, baseSrcTexcoordOffset + 0),
118+
BUFFER_ARRAY(geometries, (uint)spawnCtx.spawnMeshTexcoordsIdx, baseSrcTexcoordOffset + 1));
119+
}
112120

113-
if (particleSystem.desc.useSpawnTexcoords)
121+
if (particleSystem.desc.useSpawnTexcoords && spawnCtx.spawnMeshTexcoordsIdx != BINDING_INDEX_INVALID)
114122
{
115123
if (i == 0)
116124
{

0 commit comments

Comments
 (0)