Diligent Engine  v.2.4.g
ShaderResourceVariable.h
Go to the documentation of this file.
1 /*
2  * Copyright 2019-2021 Diligent Graphics LLC
3  * Copyright 2015-2019 Egor Yusov
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  * In no event and under no legal theory, whether in tort (including negligence),
18  * contract, or otherwise, unless required by applicable law (such as deliberate
19  * and grossly negligent acts) or agreed to in writing, shall any Contributor be
20  * liable for any damages, including any direct, indirect, special, incidental,
21  * or consequential damages of any character arising as a result of this License or
22  * out of the use or inability to use the software (including but not limited to damages
23  * for loss of goodwill, work stoppage, computer failure or malfunction, or any and
24  * all other commercial damages or losses), even if such Contributor has been advised
25  * of the possibility of such damages.
26  */
27 
28 #pragma once
29 
32 
33 #include "../../../Primitives/interface/BasicTypes.h"
34 #include "../../../Primitives/interface/Object.h"
35 #include "DeviceObject.h"
36 #include "Shader.h"
37 
39 
40 
41 // {0D57DF3F-977D-4C8F-B64C-6675814BC80C}
42 static const INTERFACE_ID IID_ShaderResourceVariable =
43  {0xd57df3f, 0x977d, 0x4c8f, {0xb6, 0x4c, 0x66, 0x75, 0x81, 0x4b, 0xc8, 0xc}};
44 
45 // clang-format off
46 
49 {
53 
59 
63 
66 };
67 
68 #ifdef __cplusplus
69 static_assert(SHADER_RESOURCE_VARIABLE_TYPE_STATIC == 0 && SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE == 1 && SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC == 2 && SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES == 3, "BIND_SHADER_RESOURCES_UPDATE_* flags rely on shader variable SHADER_RESOURCE_VARIABLE_TYPE_* values being 0,1,2");
70 #endif
71 
74 {
77 
80 
83 
89 
95 
103 };
104 
105 // clang-format on
106 
107 #define DILIGENT_INTERFACE_NAME IShaderResourceVariable
108 #include "../../../Primitives/interface/DefineInterfaceHelperMacros.h"
109 
110 #define IShaderResourceVariableInclusiveMethods \
111  IObjectInclusiveMethods; \
112  IShaderResourceVariableMethods ShaderResourceVariable
113 
114 // clang-format off
115 
118 {
120 
124  VIRTUAL void METHOD(Set)(THIS_
125  IDeviceObject* pObject) PURE;
126 
128 
136  VIRTUAL void METHOD(SetArray)(THIS_
137  IDeviceObject* const* ppObjects,
138  Uint32 FirstElement,
139  Uint32 NumElements) PURE;
140 
143 
145  VIRTUAL void METHOD(GetResourceDesc)(THIS_
146  ShaderResourceDesc REF ResourceDesc) CONST PURE;
147 
149  VIRTUAL Uint32 METHOD(GetIndex)(THIS) CONST PURE;
150 
152 
155  VIRTUAL bool METHOD(IsBound)(THIS_
156  Uint32 ArrayIndex) CONST PURE;
157 };
159 
160 #include "../../../Primitives/interface/UndefInterfaceHelperMacros.h"
161 
162 #if DILIGENT_C_INTERFACE
163 
164 // clang-format off
165 
166 # define IShaderResourceVariable_Set(This, ...) CALL_IFACE_METHOD(ShaderResourceVariable, Set, This, __VA_ARGS__)
167 # define IShaderResourceVariable_SetArray(This, ...) CALL_IFACE_METHOD(ShaderResourceVariable, SetArray, This, __VA_ARGS__)
168 # define IShaderResourceVariable_GetType(This) CALL_IFACE_METHOD(ShaderResourceVariable, GetType, This)
169 # define IShaderResourceVariable_GetResourceDesc(This, ...) CALL_IFACE_METHOD(ShaderResourceVariable, GetResourceDesc, This, __VA_ARGS__)
170 # define IShaderResourceVariable_GetIndex(This) CALL_IFACE_METHOD(ShaderResourceVariable, GetIndex, This)
171 # define IShaderResourceVariable_IsBound(This, ...) CALL_IFACE_METHOD(ShaderResourceVariable, IsBound, This, __VA_ARGS__)
172 
173 // clang-format on
174 
175 #endif
176 
177 DILIGENT_END_NAMESPACE // namespace Diligent
DILIGENT_END_INTERFACE
#define DILIGENT_END_INTERFACE
Definition: DefineInterfaceHelperMacros.h:88
Diligent::BIND_SHADER_RESOURCES_UPDATE_STATIC
@ BIND_SHADER_RESOURCES_UPDATE_STATIC
Indicates that static shader variable bindings are to be updated.
Definition: ShaderResourceVariable.h:76
Diligent::INTERFACE_ID
struct INTERFACE_ID INTERFACE_ID
Definition: InterfaceID.h:54
VIRTUAL
#define VIRTUAL
Definition: DefineInterfaceHelperMacros.h:83
Diligent::IShaderResourceVariable
Shader resource variable.
Definition: ShaderResourceVariable.h:117
DILIGENT_BEGIN_INTERFACE
#define DILIGENT_BEGIN_INTERFACE(Name, Base)
Definition: CommonDefinitions.h:97
Shader.h
Diligent::IObject
Base interface for all dynamic objects in the engine.
Definition: Object.h:41
Diligent::SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES
@ SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES
Total number of shader variable types.
Definition: ShaderResourceVariable.h:65
Diligent::SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC
@ SHADER_RESOURCE_VARIABLE_TYPE_DYNAMIC
Shader variable binding is dynamic. It can be set multiple times for every instance of shader resourc...
Definition: ShaderResourceVariable.h:62
Diligent::IDeviceObject
Base interface for all objects created by the render device Diligent::IRenderDevice.
Definition: DeviceObject.h:52
THIS
#define THIS
Definition: DefineInterfaceHelperMacros.h:81
Diligent::BIND_SHADER_RESOURCES_UPDATE_MUTABLE
@ BIND_SHADER_RESOURCES_UPDATE_MUTABLE
Indicates that mutable shader variable bindings are to be updated.
Definition: ShaderResourceVariable.h:79
PURE
#define PURE
Definition: DefineInterfaceHelperMacros.h:85
Diligent::BIND_SHADER_RESOURCES_FLAGS
BIND_SHADER_RESOURCES_FLAGS
Shader resource binding flags.
Definition: ShaderResourceVariable.h:73
Diligent::SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE
@ SHADER_RESOURCE_VARIABLE_TYPE_MUTABLE
Shader resource bound to the variable is specific to the shader resource binding instance (see Dilige...
Definition: ShaderResourceVariable.h:58
DILIGENT_END_NAMESPACE
#define DILIGENT_END_NAMESPACE
Definition: CommonDefinitions.h:86
CONST
#define CONST
Definition: DefineInterfaceHelperMacros.h:84
Diligent::BIND_SHADER_RESOURCES_KEEP_EXISTING
@ BIND_SHADER_RESOURCES_KEEP_EXISTING
If this flag is specified, all existing bindings will be preserved and only unresolved ones will be u...
Definition: ShaderResourceVariable.h:94
Diligent::Uint32
uint32_t Uint32
32-bit unsigned integer
Definition: BasicTypes.h:51
DeviceObject.h
Diligent::SHADER_RESOURCE_VARIABLE_TYPE_STATIC
@ SHADER_RESOURCE_VARIABLE_TYPE_STATIC
Shader resource bound to the variable is the same for all SRB instances. It must be set once directly...
Definition: ShaderResourceVariable.h:52
REF
#define REF
Definition: DefineGlobalFuncHelperMacros.h:39
METHOD
#define METHOD(Name)
Definition: DefineInterfaceHelperMacros.h:87
DILIGENT_TYPED_ENUM
#define DILIGENT_TYPED_ENUM(EnumName, EnumType)
Definition: CommonDefinitions.h:88
Diligent::ShaderResourceDesc
Shader resource description.
Definition: Shader.h:390
Diligent::BIND_SHADER_RESOURCES_UPDATE_DYNAMIC
@ BIND_SHADER_RESOURCES_UPDATE_DYNAMIC
Indicates that dynamic shader variable bindings are to be updated.
Definition: ShaderResourceVariable.h:82
Diligent::BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED
@ BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED
If this flag is specified, all shader bindings are expected to be resolved after the call....
Definition: ShaderResourceVariable.h:102
Diligent::Uint8
uint8_t Uint8
8-bit unsigned integer
Definition: BasicTypes.h:53
DILIGENT_BEGIN_NAMESPACE
#define DILIGENT_BEGIN_NAMESPACE(Name)
Definition: CommonDefinitions.h:82
Diligent::BIND_SHADER_RESOURCES_UPDATE_ALL
@ BIND_SHADER_RESOURCES_UPDATE_ALL
Indicates that all shader variable types (static, mutable and dynamic) are to be updated.
Definition: ShaderResourceVariable.h:88
Diligent
The library uses Direct3D-style math:
Definition: AdvancedMath.hpp:37
THIS_
#define THIS_
Definition: DefineInterfaceHelperMacros.h:82
Diligent::SHADER_RESOURCE_VARIABLE_TYPE
SHADER_RESOURCE_VARIABLE_TYPE
Describes the type of the shader resource variable.
Definition: ShaderResourceVariable.h:48