clang 24.0.0git
hlsl_resources.h
Go to the documentation of this file.
1//===----- hlsl_resources.h - HLSL definitions for resources ----------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef _HLSL_HLSL_RESOURCES_H_
10#define _HLSL_HLSL_RESOURCES_H_
11
12#include "hlsl_detail.h"
13
14namespace hlsl {
15
16#define _HLSL_AVAILABILITY(platform, version) \
17 __attribute__((availability(platform, introduced = version)))
18#define _HLSL_BUILTIN_ALIAS(builtin) \
19 __attribute__((clang_builtin_alias(builtin)))
20
21static const uint UAV_MEMORY = 0x1;
22static const uint GROUP_SHARED_MEMORY = 0x2;
23static const uint NODE_INPUT_MEMORY = 0x4;
24static const uint NODE_OUTPUT_MEMORY = 0x8;
25static const uint ALL_MEMORY = 0xf;
26
27static const uint GROUP_SYNC = 0x1;
28static const uint GROUP_SCOPE = 0x2;
29static const uint DEVICE_SCOPE = 0x4;
30
31#define _HLSL_RESOURCE_BARRIER(resource) \
32 _HLSL_AVAILABILITY(shadermodel, 6.8) \
33 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_barrier) \
34 __attribute__((convergent)) void Barrier(resource Object, uint SemanticFlags)
35
36#define _HLSL_TEMPLATE_RESOURCE_BARRIER(resource) \
37 template <typename T> _HLSL_RESOURCE_BARRIER(resource<T>)
38
39// These overloads apply the barrier only to the specified UAV resource.
40// Barrier(uint, uint) applies the barrier to the selected memory types.
47_HLSL_TEMPLATE_RESOURCE_BARRIER(RasterizerOrderedBuffer);
49_HLSL_TEMPLATE_RESOURCE_BARRIER(AppendStructuredBuffer);
50_HLSL_TEMPLATE_RESOURCE_BARRIER(ConsumeStructuredBuffer);
51_HLSL_TEMPLATE_RESOURCE_BARRIER(RasterizerOrderedStructuredBuffer);
52_HLSL_RESOURCE_BARRIER(RWByteAddressBuffer);
53_HLSL_RESOURCE_BARRIER(RasterizerOrderedByteAddressBuffer);
54
55// TODO: Add node record overloads when Clang supports node record types.
56// https://github.com/llvm/llvm-project/issues/229258
57
58#undef _HLSL_TEMPLATE_RESOURCE_BARRIER
59#undef _HLSL_RESOURCE_BARRIER
60
61_HLSL_AVAILABILITY(shadermodel, 6.6)
62static __detail::resource_descriptor_heap_struct ResourceDescriptorHeap;
63
64_HLSL_AVAILABILITY(shadermodel, 6.6)
65static __detail::sampler_descriptor_heap_struct SamplerDescriptorHeap;
66
67} // namespace hlsl
68#endif //_HLSL_HLSL_RESOURCES_H_
#define _HLSL_AVAILABILITY(platform, version)
#define _HLSL_TEMPLATE_RESOURCE_BARRIER(resource)
#define _HLSL_RESOURCE_BARRIER(resource)
static const uint GROUP_SHARED_MEMORY
unsigned int uint
An unsigned 32-bit integer.
static const uint GROUP_SCOPE
static const uint GROUP_SYNC
static const uint ALL_MEMORY
static __detail::resource_descriptor_heap_struct ResourceDescriptorHeap
static const uint NODE_OUTPUT_MEMORY
static __detail::sampler_descriptor_heap_struct SamplerDescriptorHeap
static const uint UAV_MEMORY
static const uint DEVICE_SCOPE
static const uint NODE_INPUT_MEMORY