@@ -15,33 +15,32 @@ class IRayTracingPipelineBase : public virtual core::IReferenceCounted
15
15
public:
16
16
struct SShaderGroupsParams
17
17
{
18
- constexpr static inline uint32_t ShaderUnused = 0xffFFffFFu ;
19
-
20
- struct SGeneralShaderGroup
18
+ struct SIndex
21
19
{
22
- uint32_t shaderIndex = ShaderUnused;
20
+ constexpr static inline uint32_t Unused = 0xffFFffFFu ;
21
+ uint32_t index = Unused;
23
22
};
24
23
25
- struct SHitShaderGroup
24
+ struct SHitGroup
26
25
{
27
- uint32_t closestHitShaderIndex = ShaderUnused ;
28
- uint32_t anyHitShaderIndex = ShaderUnused ;
29
- uint32_t intersectionShaderIndex = ShaderUnused ;
26
+ uint32_t closestHit = SIndex::Unused ;
27
+ uint32_t anyHit = SIndex::Unused ;
28
+ uint32_t intersectionShader = SIndex::Unused ;
30
29
};
31
30
32
- SGeneralShaderGroup raygenGroup ;
33
- std::span<SGeneralShaderGroup> missGroups ;
34
- std::span<SHitShaderGroup> hitGroups ;
35
- std::span<SGeneralShaderGroup> callableGroups ;
31
+ SIndex raygen ;
32
+ std::span<SIndex> misses ;
33
+ std::span<SHitGroup> hits ;
34
+ std::span<SIndex> callables ;
36
35
37
36
inline uint32_t getShaderGroupCount () const
38
37
{
39
- return 1 + hitGroups .size () + missGroups .size () + callableGroups .size ();
38
+ return 1 + hits .size () + misses .size () + callables .size ();
40
39
}
41
40
42
41
};
43
- using SGeneralShaderGroup = SShaderGroupsParams::SGeneralShaderGroup ;
44
- using SHitShaderGroup = SShaderGroupsParams::SHitShaderGroup ;
42
+ using SGeneralShaderGroup = SShaderGroupsParams::SIndex ;
43
+ using SHitShaderGroup = SShaderGroupsParams::SHitGroup ;
45
44
46
45
struct SCachedCreationParams final
47
46
{
@@ -86,14 +85,14 @@ class IRayTracingPipeline : public IPipeline<PipelineLayoutType>, public IRayTra
86
85
return shaders[index].shader ->getStage ();
87
86
};
88
87
89
- if (shaderGroups.raygenGroup . shaderIndex >= shaders.size ())
88
+ if (shaderGroups.raygen . index >= shaders.size ())
90
89
return false ;
91
- if (getShaderStage (shaderGroups.raygenGroup . shaderIndex ) != ICPUShader::E_SHADER_STAGE::ESS_RAYGEN)
90
+ if (getShaderStage (shaderGroups.raygen . index ) != ICPUShader::E_SHADER_STAGE::ESS_RAYGEN)
92
91
return false ;
93
92
94
93
auto isValidShaderIndex = [this , getShaderStage](size_t index, ICPUShader::E_SHADER_STAGE expectedStage) -> bool
95
94
{
96
- if (index == SShaderGroupsParams::ShaderUnused )
95
+ if (index == SShaderGroupsParams::SIndex::Unused )
97
96
return true ;
98
97
if (index >= shaders.size ())
99
98
return false ;
@@ -102,27 +101,27 @@ class IRayTracingPipeline : public IPipeline<PipelineLayoutType>, public IRayTra
102
101
return true ;
103
102
};
104
103
105
- for (const auto & shaderGroup : shaderGroups.hitGroups )
104
+ for (const auto & shaderGroup : shaderGroups.hits )
106
105
{
107
- if (!isValidShaderIndex (shaderGroup.anyHitShaderIndex , ICPUShader::E_SHADER_STAGE::ESS_ANY_HIT))
106
+ if (!isValidShaderIndex (shaderGroup.anyHit , ICPUShader::E_SHADER_STAGE::ESS_ANY_HIT))
108
107
return false ;
109
108
110
- if (!isValidShaderIndex (shaderGroup.closestHitShaderIndex , ICPUShader::E_SHADER_STAGE::ESS_CLOSEST_HIT))
109
+ if (!isValidShaderIndex (shaderGroup.closestHit , ICPUShader::E_SHADER_STAGE::ESS_CLOSEST_HIT))
111
110
return false ;
112
111
113
- if (!isValidShaderIndex (shaderGroup.intersectionShaderIndex , ICPUShader::E_SHADER_STAGE::ESS_INTERSECTION))
112
+ if (!isValidShaderIndex (shaderGroup.intersectionShader , ICPUShader::E_SHADER_STAGE::ESS_INTERSECTION))
114
113
return false ;
115
114
}
116
115
117
- for (const auto & shaderGroup : shaderGroups.missGroups )
116
+ for (const auto & shaderGroup : shaderGroups.misses )
118
117
{
119
- if (!isValidShaderIndex (shaderGroup.shaderIndex , ICPUShader::E_SHADER_STAGE::ESS_MISS))
118
+ if (!isValidShaderIndex (shaderGroup.index , ICPUShader::E_SHADER_STAGE::ESS_MISS))
120
119
return false ;
121
120
}
122
121
123
- for (const auto & shaderGroup : shaderGroups.callableGroups )
122
+ for (const auto & shaderGroup : shaderGroups.callables )
124
123
{
125
- if (!isValidShaderIndex (shaderGroup.shaderIndex , ICPUShader::E_SHADER_STAGE::ESS_CALLABLE))
124
+ if (!isValidShaderIndex (shaderGroup.index , ICPUShader::E_SHADER_STAGE::ESS_CALLABLE))
126
125
return false ;
127
126
}
128
127
return true ;
@@ -153,10 +152,10 @@ class IRayTracingPipeline : public IPipeline<PipelineLayoutType>, public IRayTra
153
152
explicit IRayTracingPipeline (const SCreationParams& _params) :
154
153
IPipeline<PipelineLayoutType>(core::smart_refctd_ptr<const PipelineLayoutType>(_params.layout)),
155
154
m_params(_params.cached),
156
- m_raygenShaderGroup(_params.shaderGroups.raygenGroup ),
157
- m_missShaderGroups(core::make_refctd_dynamic_array<SGeneralShaderGroupContainer>(_params.shaderGroups.missGroups )),
158
- m_hitShaderGroups(core::make_refctd_dynamic_array<SHitShaderGroupContainer>(_params.shaderGroups.hitGroups )),
159
- m_callableShaderGroups(core::make_refctd_dynamic_array<SGeneralShaderGroupContainer>(_params.shaderGroups.callableGroups ))
155
+ m_raygenShaderGroup(_params.shaderGroups.raygen ),
156
+ m_missShaderGroups(core::make_refctd_dynamic_array<SGeneralShaderGroupContainer>(_params.shaderGroups.misses )),
157
+ m_hitShaderGroups(core::make_refctd_dynamic_array<SHitShaderGroupContainer>(_params.shaderGroups.hits )),
158
+ m_callableShaderGroups(core::make_refctd_dynamic_array<SGeneralShaderGroupContainer>(_params.shaderGroups.callables ))
160
159
{}
161
160
162
161
SCachedCreationParams m_params;
0 commit comments