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

Method CopyToResourceSet

trinity/TriVariable.cpp:25–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25bool TriVariable::CopyToResourceSet(
26 Tr2ResourceSetDescriptionAL& resourceDesc,
27 Tr2RenderContextEnum::ShaderType stage,
28 uint32_t registerIndex,
29 ResourceFlags flags ) const
30{
31 switch( m_type )
32 {
33 case TRIVARIABLE_TEXTURE_RES: {
34 auto colorSpace = ( flags & RESOURCE_FLAG_SRGB ) != 0 ? Tr2RenderContextEnum::COLOR_SPACE_SRGB : Tr2RenderContextEnum::COLOR_SPACE_LINEAR;
35 Tr2TextureAL* tex = nullptr;
36 if( m_texture )
37 {
38 tex = m_texture->GetTexture();
39 }
40 if( tex )
41 {
42 return resourceDesc.SetSrv( stage, registerIndex, *tex, colorSpace );
43 }
44 else
45 {
46 return resourceDesc.SetSrv( stage, registerIndex, Tr2TextureAL(), colorSpace );
47 }
48 }
49 case TRIVARIABLE_GPUBUFFER: {
50 Tr2BufferAL* buffer = nullptr;
51 if( m_gpuBuffer )
52 {
53 buffer = m_gpuBuffer->GetGpuBuffer( 0 );
54 }
55 if( buffer )
56 {
57 return resourceDesc.SetSrv( stage, registerIndex, *buffer );
58 }
59 else
60 {
61 return resourceDesc.SetSrv( stage, registerIndex, Tr2BufferAL() );
62 }
63 }
64 default:
65 return false;
66 }
67}
68
69bool TriVariable::ApplyUav(
70 Tr2ResourceSetDescriptionAL& resourceDesc,

Callers

nothing calls this directly

Calls 5

SetSrvMethod · 0.80
Tr2TextureALClass · 0.70
Tr2BufferALClass · 0.50
GetTextureMethod · 0.45
GetGpuBufferMethod · 0.45

Tested by

no test coverage detected