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

Method Create

trinity/Tr2RenderTarget.cpp:76–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74}
75
76int32_t Tr2RenderTarget::Create(
77 unsigned width,
78 unsigned height,
79 unsigned mipLevelCount,
80 Tr2RenderContextEnum::PixelFormat format,
81 unsigned msaaType,
82 unsigned msaaQuality,
83 Tr2RenderContextEnum::ExFlag flags,
84 Tr2RenderContextEnum::TextureType type )
85{
86 CCP_STATS_ZONE( __FUNCTION__ );
87 USE_MAIN_THREAD_RENDER_CONTEXT();
88 if( IsAttached() )
89 {
90 return E_INVALIDARG;
91 }
92
93 auto gpuUsage = Tr2GpuUsage::NONE;
94 auto cpuUsage = Tr2CpuUsage::NONE;
95 GetUsage( uint32_t( msaaType ), flags, gpuUsage, cpuUsage );
96 if( !type )
97 {
98 type = TEX_TYPE_2D;
99 }
100
101 auto hr = m_renderTarget.Create(
102 Tr2BitmapDimensions( type, format, width, height, 1, mipLevelCount ),
103 Tr2MsaaDesc( msaaType, msaaQuality ),
104 gpuUsage,
105 cpuUsage,
106 nullptr,
107 renderContext )
108 .GetResult();
109 if( SUCCEEDED( hr ) )
110 {
111 m_width = width;
112 m_height = height;
113 m_arraySize = 1;
114 m_mipCount = mipLevelCount;
115 m_format = format;
116 m_msaa = Tr2MsaaDesc( msaaType, msaaQuality );
117 m_flags = ExFlag( flags );
118 m_type = type;
119 m_cpuUsage = cpuUsage;
120 m_gpuUsage = gpuUsage;
121 m_renderTarget.SetName( m_name.c_str() );
122 }
123 else
124 {
125 Destroy();
126 }
127 return hr;
128}
129
130int32_t Tr2RenderTarget::CreateArray(
131 unsigned width,

Callers 3

CreateArrayMethod · 0.45
CreateManualMethod · 0.45
OnPrepareResourcesMethod · 0.45

Calls 6

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

Tested by

no test coverage detected