This PR introduces new HLSL resource type attribute `[[hlsl::raw_buffer]]`. Presence of this attribute on a resource handle means that the resource does not require typed element access. The attribute will be used on resource handles that represent buffers like `StructuredBuffer` or `ByteAddressBuffer` and in DXIL it will be translated to target extension type `dx.RawBuffer`. Fixes #107907
14 lines
687 B
HLSL
14 lines
687 B
HLSL
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -x hlsl -o - %s -verify
|
|
|
|
// expected-error@+1{{'raw_buffer' attribute cannot be applied to a declaration}}
|
|
[[hlsl::raw_buffer]] __hlsl_resource_t res0;
|
|
|
|
// expected-error@+1{{'raw_buffer' attribute takes no arguments}}
|
|
__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(3)]] res2;
|
|
|
|
// expected-error@+1{{use of undeclared identifier 'gibberish'}}
|
|
__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer(gibberish)]] res3;
|
|
|
|
// expected-warning@+1{{attribute 'raw_buffer' is already applied}}
|
|
__hlsl_resource_t [[hlsl::resource_class(UAV)]] [[hlsl::raw_buffer]] [[hlsl::raw_buffer]] res4;
|