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

Method OnPrepareResources

trinity/Sprite2d/Tr2Sprite2dLayer.cpp:87–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87bool Tr2Sprite2dLayer::OnPrepareResources()
88{
89 if( m_renderTarget.IsValid() )
90 {
91 return true;
92 }
93
94 USE_MAIN_THREAD_RENDER_CONTEXT();
95 HRESULT hr = m_renderTarget.Create(
96 Tr2BitmapDimensions( (uint32_t)m_displayWidth, (uint32_t)m_displayHeight, 1, Tr2RenderContextEnum::PIXEL_FORMAT_B8G8R8A8_UNORM ),
97 Tr2GpuUsage::SHADER_RESOURCE | Tr2GpuUsage::RENDER_TARGET,
98 Tr2CpuUsage::READ,
99 renderContext );
100
101 if( FAILED( hr ) )
102 {
103 CCP_LOGERR( "Tr2Sprite2dLayer::AllocateRenderTarget failed to create a render target" );
104 return false;
105 }
106
107 CCP_STATS_ADD( spriteSceneLayerMemoryUse, m_renderTarget.GetWidth() * m_renderTarget.GetHeight() * 4 );
108
109 return true;
110}
111
112void Tr2Sprite2dLayer::ReleaseResources( TriStorage s )
113{

Callers

nothing calls this directly

Calls 4

IsValidMethod · 0.45
CreateMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected