| 23 | } |
| 24 | |
| 25 | bool 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 | |
| 69 | bool TriVariable::ApplyUav( |
| 70 | Tr2ResourceSetDescriptionAL& resourceDesc, |
nothing calls this directly
no test coverage detected