--------------------------------------------------------------------------------------
| 184 | |
| 185 | // -------------------------------------------------------------------------------------- |
| 186 | bool Tr2DepthStencil::OnPrepareResources() |
| 187 | { |
| 188 | if( !m_depthStencil.IsValid() && m_width != 0 ) |
| 189 | { |
| 190 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 191 | |
| 192 | auto gpuUsage = Tr2GpuUsage::DEPTH_STENCIL | Tr2GpuUsage::SHADER_RESOURCE; |
| 193 | if( ( m_flags & Tr2RenderContextEnum::EX_CREATE_SHARED ) != 0 ) |
| 194 | { |
| 195 | gpuUsage |= Tr2GpuUsage::SHARED; |
| 196 | } |
| 197 | |
| 198 | m_depthStencil.Create( Tr2BitmapDimensions( m_width, m_height, 1, Tr2RenderContextEnum::ConvertDepthStencilFormat( m_format ) ), m_msaa, gpuUsage, renderContext ); |
| 199 | m_onTextureChange(); |
| 200 | } |
| 201 | return true; |
| 202 | } |