| 186 | } |
| 187 | |
| 188 | int32_t Tr2RenderTarget::CreateManual( |
| 189 | unsigned width, |
| 190 | unsigned height, |
| 191 | unsigned mipLevelCount, |
| 192 | Tr2RenderContextEnum::PixelFormat format, |
| 193 | unsigned msaaType, |
| 194 | unsigned msaaQuality, |
| 195 | Tr2RenderContextEnum::ExFlag flags, |
| 196 | Tr2RenderContextEnum::TextureType type, |
| 197 | Tr2CpuUsage::Type cpuUsage, |
| 198 | Tr2GpuUsage::Type gpuUsage ) |
| 199 | { |
| 200 | CCP_STATS_ZONE( __FUNCTION__ ); |
| 201 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 202 | if( IsAttached() ) |
| 203 | { |
| 204 | return E_INVALIDARG; |
| 205 | } |
| 206 | |
| 207 | auto hr = m_renderTarget.Create( |
| 208 | Tr2BitmapDimensions( type, format, width, height, 1, mipLevelCount ), |
| 209 | Tr2MsaaDesc( msaaType, msaaQuality ), |
| 210 | gpuUsage, |
| 211 | cpuUsage, |
| 212 | nullptr, |
| 213 | renderContext ) |
| 214 | .GetResult(); |
| 215 | if( SUCCEEDED( hr ) ) |
| 216 | { |
| 217 | m_width = width; |
| 218 | m_height = height; |
| 219 | m_arraySize = 1; |
| 220 | m_mipCount = mipLevelCount; |
| 221 | m_format = format; |
| 222 | m_msaa = Tr2MsaaDesc( msaaType, msaaQuality ); |
| 223 | m_flags = ExFlag( flags ); |
| 224 | m_type = type; |
| 225 | m_cpuUsage = cpuUsage; |
| 226 | m_gpuUsage = gpuUsage; |
| 227 | m_renderTarget.SetName( m_name.c_str() ); |
| 228 | m_onTextureChange(); |
| 229 | } |
| 230 | else |
| 231 | { |
| 232 | Destroy(); |
| 233 | } |
| 234 | return hr; |
| 235 | } |
| 236 | |
| 237 | Tr2TextureAL* Tr2RenderTarget::GetTexture() |
| 238 | { |
no test coverage detected