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

Method Create

trinity/Tr2DepthStencil.cpp:49–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

47}
48
49long 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
76Tr2TextureAL* Tr2DepthStencil::GetTexture()
77{

Callers 1

OnPrepareResourcesMethod · 0.45

Calls 4

DestroyFunction · 0.85
Tr2MsaaDescClass · 0.50
GetResultMethod · 0.45
SetNameMethod · 0.45

Tested by

no test coverage detected