Skip to content

[HLSL] DXC and Clang handle cbuffer in namespace differently #124064

@hekota

Description

@hekota

Constant buffers declared by cbuffer blocks can occur inside a namespace scope. DXC ignores the namespace and the constant buffer elements must be referenced without the namespace qualifier while in Clang the element names must use fully qualified name.

For example this constant buffer:

namespace ns {
  cbuffer CB {
    float a;
  }
}

The float value must be referenced as a in DXC and as ns::a in Clang, otherwise it fails to compile.
https://godbolt.org/z/GMzzMnh6s

This task was filed to track this difference between DXC and Clang and to determine which behavior we want to support.

Once we do that, we need to document it in the language spec (tracked here ) and make sure the implementation matches the spec (tracked here).

Metadata

Metadata

Assignees

Labels

HLSLHLSL Language Support

Type

No type

Projects

Status

Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions