| 47 | } |
| 48 | |
| 49 | long Tr2DepthStencil::Create( unsigned width, unsigned height, DepthStencilFormat dsFormat, unsigned msaaType, unsigned msaaQuality, Tr2RenderContextEnum::ExFlag flags ) |
| 50 | { |
| 51 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 52 | auto gpuUsage = Tr2GpuUsage::DEPTH_STENCIL | Tr2GpuUsage::SHADER_RESOURCE; |
| 53 | if( ( flags & Tr2RenderContextEnum::EX_CREATE_SHARED ) != 0 ) |
| 54 | { |
| 55 | gpuUsage |= Tr2GpuUsage::SHARED; |
| 56 | } |
| 57 | |
| 58 | auto hr = m_depthStencil.Create( Tr2BitmapDimensions( width, height, 1, Tr2RenderContextEnum::ConvertDepthStencilFormat( dsFormat ) ), Tr2MsaaDesc( msaaType, msaaQuality ), gpuUsage, renderContext ).GetResult(); |
| 59 | if( SUCCEEDED( hr ) ) |
| 60 | { |
| 61 | m_width = width; |
| 62 | m_height = height; |
| 63 | m_format = dsFormat; |
| 64 | m_msaa = Tr2MsaaDesc( msaaType, msaaQuality ); |
| 65 | m_flags = flags; |
| 66 | m_depthStencil.SetName( m_name.c_str() ); |
| 67 | m_onTextureChange(); |
| 68 | } |
| 69 | else |
| 70 | { |
| 71 | Destroy(); |
| 72 | } |
| 73 | return hr; |
| 74 | } |
| 75 | |
| 76 | Tr2TextureAL* Tr2DepthStencil::GetTexture() |
| 77 | { |
no test coverage detected