MCPcopy Create free account
hub / github.com/carbonengine/trinity / ProcessReflection

Function ProcessReflection

shadercompiler/DxReflection.h:222–638  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220
221template <typename Traits>
222static bool ProcessReflection( ParserState& parserState, typename Traits::Reflection* reflection, bool collectStaticSamplers, StageData& stage, std::map<StringReference, ParameterAnnotation>& annotations, ReflectionTarget reflectionTarget = ReflectionTarget::SHADER_INPUT, const std::vector<GlobalInputElement>& filter = {} )
223{
224 ZoneScoped;
225
226 typename Traits::ShaderDesc reflDesc;
227 if( FAILED( reflection->GetDesc( &reflDesc ) ) )
228 {
229 g_messages.AddMessage( "\\memory(0): error X0000: Could not get shader reflection description" );
230 return false;
231 }
232
233 for( unsigned cbIndex = 0; cbIndex < reflDesc.ConstantBuffers; ++cbIndex )
234 {
235 auto cb = reflection->GetConstantBufferByIndex( cbIndex );
236
237 typename Traits::BufferDesc cbDesc;
238 cb->GetDesc( &cbDesc );
239
240 if( strcmp( cbDesc.Name, "$Globals" ) )
241 {
242 typename Traits::InputBindDesc resDesc;
243 if( FAILED( reflection->GetResourceBindingDescByName( cbDesc.Name, &resDesc ) ) )
244 {
245 continue;
246 }
247 if( resDesc.BindPoint != 0 || resDesc.Type != D3D_SIT_CBUFFER )
248 {
249 continue;
250 }
251 }
252
253 if( reflectionTarget == ReflectionTarget::GLOBAL_INPUT )
254 {
255 continue;
256 }
257
258 for( unsigned i = 0; i < cbDesc.Variables; ++i )
259 {
260 auto variable = cb->GetVariableByIndex( i );
261
262 typename Traits::VariableDesc varDesc;
263 if( FAILED( variable->GetDesc( &varDesc ) ) )
264 {
265 if( g_printWarnings )
266 {
267 g_messages.AddMessage( "\\memory(0): warning X0000: Could not get shader constant #%i description", i );
268 }
269 continue;
270 }
271 if( ( varDesc.uFlags & D3D_SVF_USED ) == 0 )
272 {
273 continue;
274 }
275
276 auto type = variable->GetType();
277 typename Traits::TypeDesc typeDesc;
278 if( FAILED( type->GetDesc( &typeDesc ) ) )
279 {

Callers

nothing calls this directly

Calls 15

BindlessTextureTypeFunction · 0.85
GetSamplerStateFunction · 0.85
ConvertToStaticSamplerFunction · 0.85
GetSpaceFromDescFunction · 0.85
ParseStateAssignmentFunction · 0.85
GetStringForUsageCodeFunction · 0.85
AddMessageMethod · 0.80
AddStringMethod · 0.80
sizeMethod · 0.80
LookupGlobalMethod · 0.80
IsBindlessHandleMethod · 0.80
emptyMethod · 0.80

Tested by

no test coverage detected