Skip to content

Add empty constructors to resource-containing structs for Slang 2025.23+ compatibility #118

@jvepsalainen-nv

Description

@jvepsalainen-nv

Description

Problem

RTX Remix shaders fail to compile with recent versions of the Slang shader compiler (v2025.23.2+) due to error 41024:

error 41024: cannot default-initialize struct 'DirectPathTextures' with '{}' 
because it contains an uninitialized texture field

This error occurs when attempting to instantiate structs that contain resource types (e.g., Texture2D, RWTexture2D) without providing explicit initialization for those fields.

Root Cause

Slang recently introduced stricter validation to prevent default-initialization of resource types using empty braces {}. This is because downstream compilers like DXC do not support default-initializing resources, making this pattern unsafe and non-portable.

The error triggers when code like this is encountered:

struct DirectPathTextures {
  RWTexture2D<uint16_t> SharedFlags;
  // ... more resource fields
};

// This line triggers error 41024 in Slang 2025.23+:
DirectPathTextures directPathTextures;

Solution

Solution described in #117

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions