MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Init

Method Init

Source/Engine/Graphics/GPUDevice.cpp:108–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106#endif
107
108bool GPUPipelineState::Init(const Description& desc)
109{
110 // Cache description in development builds
111#if !BUILD_RELEASE
112 DebugDesc = desc;
113#endif
114
115 // Cache shader stages usage flags for pipeline state
116 Platform::MemoryClear(&_meta, sizeof(_meta));
117#define CHECK_STAGE(stage) \
118 if (desc.stage) { \
119 _meta.UsedCBsMask |= desc.stage->GetBindings().UsedCBsMask; \
120 _meta.UsedSRsMask |= desc.stage->GetBindings().UsedSRsMask; \
121 _meta.UsedUAsMask |= desc.stage->GetBindings().UsedUAsMask; \
122 _meta.UsedSamplersMask |= desc.stage->GetBindings().UsedSamplersMask; \
123 }
124 CHECK_STAGE(VS);
125 CHECK_STAGE(HS);
126 CHECK_STAGE(DS);
127 CHECK_STAGE(GS);
128 CHECK_STAGE(PS);
129#undef CHECK_STAGE
130
131#if USE_EDITOR
132 // Estimate somehow performance cost of this pipeline state for the content profiling
133 const int32 textureLookupCost = 20;
134 const int32 tessCost = 300;
135 Complexity = Utilities::CountBits(_meta.UsedSRsMask) * textureLookupCost;
136 if (desc.PS)
137 Complexity += desc.PS->GetBindings().InstructionsCount;
138 if (desc.HS || desc.DS)
139 Complexity += tessCost;
140 if (desc.DepthWriteEnable)
141 Complexity += 5;
142 if (desc.DepthEnable)
143 Complexity += 5;
144 if (desc.BlendMode.BlendEnable)
145 Complexity += 20;
146#endif
147
148 return false;
149}
150
151GPUResourceType GPUPipelineState::GetResourceType() const
152{

Callers 3

LoadContentMethod · 0.45
GetDecodeYUY2PSMethod · 0.45
GetDecodeNV12PSMethod · 0.45

Calls 6

MemoryClearFunction · 0.85
CountBitsFunction · 0.85
BytesToTextFunction · 0.85
GetBindingsMethod · 0.80
SetExecutorMethod · 0.80
MinFunction · 0.50

Tested by

no test coverage detected