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
16static const uint UAV_MEMORY = 0x1;
17static const uint GROUP_SHARED_MEMORY = 0x2;
18static const uint NODE_INPUT_MEMORY = 0x4;
19static const uint NODE_OUTPUT_MEMORY = 0x8;
20static const uint ALL_MEMORY = 0xf;
21
22static const uint GROUP_SYNC = 0x1;
23static const uint GROUP_SCOPE = 0x2;
24static const uint DEVICE_SCOPE = 0x4;
25
26#define _HLSL_RESOURCE_BARRIER(resource) \
27 _HLSL_AVAILABILITY(shadermodel, 6.8) \
28 _HLSL_BUILTIN_ALIAS(__builtin_hlsl_barrier) \
29 __attribute__((convergent)) void Barrier(resource Object, uint SemanticFlags)
30
31#define _HLSL_TEMPLATE_RESOURCE_BARRIER(resource) \
32 template <typename T> _HLSL_RESOURCE_BARRIER(resource<T>)
33
34// These overloads apply the barrier only to the specified UAV resource.
35// Barrier(uint, uint) applies the barrier to the selected memory types.
42_HLSL_TEMPLATE_RESOURCE_BARRIER(RasterizerOrderedBuffer);
44_HLSL_TEMPLATE_RESOURCE_BARRIER(AppendStructuredBuffer);
45_HLSL_TEMPLATE_RESOURCE_BARRIER(ConsumeStructuredBuffer);
46_HLSL_TEMPLATE_RESOURCE_BARRIER(RasterizerOrderedStructuredBuffer);
47_HLSL_RESOURCE_BARRIER(RWByteAddressBuffer);
48_HLSL_RESOURCE_BARRIER(RasterizerOrderedByteAddressBuffer);
49
50// TODO: Add node record overloads when Clang supports node record types.
51// https://github.com/llvm/llvm-project/issues/229258
52
53#undef _HLSL_TEMPLATE_RESOURCE_BARRIER
54#undef _HLSL_RESOURCE_BARRIER
55
56_HLSL_AVAILABILITY(shadermodel, 6.6)
57static __detail::resource_descriptor_heap_struct ResourceDescriptorHeap;
58
59_HLSL_AVAILABILITY(shadermodel, 6.6)
60static __detail::sampler_descriptor_heap_struct SamplerDescriptorHeap;
61
62} // namespace hlsl
63#endif //_HLSL_HLSL_RESOURCES_H_
#define _HLSL_AVAILABILITY(platform, version)
Definition hlsl.h:19
#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