Skip to content

Commit dd1a50e

Browse files
Add empty constructors to structs with resource fields
This change adds empty __init() {} constructors to DirectPathTextures and IndirectPathTextures structs to fix compilation errors with recent versions of the Slang shader compiler. Slang versions (2025.23+) introduced stricter validation (error 41024) that prevents default-initialization of structs containing resource types. Changes: - Added __init() {} to DirectPathTextures struct - Added __init() {} to IndirectPathTextures struct The empty constructors allow these structs to be instantiated without attempting to default-initialize their resource fields. The existing code pattern of declaring the struct and then assigning individual fields continues to work correctly.
1 parent ca6bd3e commit dd1a50e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/dxvk/shaders/rtx/algorithm/path_state.slangh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -514,6 +514,8 @@ struct PathState : IBasePayloadState
514514

515515
struct DirectPathTextures
516516
{
517+
__init() {} // Empty constructor is required by Slang to avoid the error 41024
518+
517519
RWTexture2D<uint16_t> SharedFlags;
518520
RWTexture2D<uint16_t> SharedMediumMaterialIndex;
519521
RWTexture2D<float4> PrimaryDirectDiffuseLobeRadianceHitDistance;
@@ -528,6 +530,8 @@ struct DirectPathTextures
528530

529531
struct IndirectPathTextures
530532
{
533+
__init() {} // Empty constructor is required by Slang to avoid the error 41024
534+
531535
Texture2D<float4> PrimaryWorldPositionWorldTriangleNormal;
532536
RWTexture2D<float4> IndirectRadianceHitDistance;
533537
};

0 commit comments

Comments
 (0)