-------------------------------------------------------------------------------- Description: Allocate all device resources here --------------------------------------------------------------------------------
| 60 | // Allocate all device resources here |
| 61 | // -------------------------------------------------------------------------------- |
| 62 | bool Tr2DataTextureManager::OnPrepareResources() |
| 63 | { |
| 64 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 65 | |
| 66 | // create the data texture here, prefill it with zeros |
| 67 | std::vector<Vector4> t( m_textureWidth * m_textureHeight, Vector4( 0.f, 0.f, 0.f, 0.f ) ); |
| 68 | Tr2SubresourceData init = { &t[0], m_textureWidth * uint32_t( sizeof( Vector4 ) ), m_textureWidth * m_textureHeight * uint32_t( sizeof( Vector4 ) ) }; |
| 69 | if( FAILED( m_dataTexture->GetTexture()->Create( Tr2BitmapDimensions( m_textureWidth, m_textureHeight, 1, Tr2RenderContextEnum::PIXEL_FORMAT_R32G32B32A32_FLOAT ), Tr2GpuUsage::SHADER_RESOURCE, Tr2CpuUsage::READ | Tr2CpuUsage::WRITE, &init, renderContext ) ) ) |
| 70 | { |
| 71 | m_dataTexture->OnTextureChange().Broadcast(); |
| 72 | return false; |
| 73 | } |
| 74 | m_dataTexture->OnTextureChange().Broadcast(); |
| 75 | |
| 76 | return true; |
| 77 | } |
| 78 | |
| 79 | |
| 80 | // -------------------------------------------------------------------------------- |
nothing calls this directly
no test coverage detected