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

Method OnPrepareResources

trinity/Particle/Tr2GpuParticleSystem.cpp:200–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198}
199
200bool Tr2GpuParticleSystem::OnPrepareResources()
201{
202 USE_MAIN_THREAD_RENDER_CONTEXT();
203
204 if( !m_drawParameters->IsValid() )
205 {
206 m_drawParameters->Create( 4, Tr2RenderContextEnum::PIXEL_FORMAT_R32_UINT, Tr2GpuBuffer::GPU_WRITABLE | Tr2GpuBuffer::DRAW_INDIRECT );
207 m_drawParameters->SetName( "GPU Particle Draw Params" );
208 m_clearRequested = true;
209 }
210 if( !m_sortParameters->IsValid() )
211 {
212 m_sortParameters->Create( 4, Tr2RenderContextEnum::PIXEL_FORMAT_R32_UINT, Tr2GpuBuffer::GPU_WRITABLE | Tr2GpuBuffer::DRAW_INDIRECT );
213 m_sortParameters->SetName( "GPU Particle Sort Params" );
214 m_clearRequested = true;
215 }
216 if( !m_particleData->IsValid() )
217 {
218 m_particleData->Create( m_maxParticles, sizeof( ParticleData ), Tr2GpuStructuredBuffer::GPU_WRITABLE );
219 m_particleData->SetName( "GPU Particles" );
220 m_clearRequested = true;
221 }
222 if( !m_deadList->IsValid() )
223 {
224 m_deadList->Create( m_maxParticles, sizeof( uint32_t ), Tr2GpuStructuredBuffer::GPU_WRITABLE );
225 m_deadList->SetName( "GPU Particle Dead List" );
226 m_clearRequested = true;
227 }
228 if( !m_visibleList->IsValid() )
229 {
230 m_visibleList->Create( m_maxParticles, sizeof( uint32_t ) * 2, Tr2GpuStructuredBuffer::GPU_WRITABLE );
231 m_visibleList->SetName( "GPU Particle Visible List" );
232 m_clearRequested = true;
233 }
234 if( !m_counters->IsValid() )
235 {
236 m_counters->Create( 2, Tr2RenderContextEnum::PIXEL_FORMAT_R32_SINT, Tr2GpuBuffer::GPU_WRITABLE );
237 m_counters->SetName( "GPU Particle Counters" );
238 m_clearRequested = true;
239 }
240 UpdateGpuEmitterParams( renderContext );
241 return true;
242}
243
244bool Tr2GpuParticleSystem::OnModified( Be::Var* value )
245{

Callers

nothing calls this directly

Calls 3

IsValidMethod · 0.45
CreateMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected