-------------------------------------------------------------------------------------- Description: Re-creates AL buffer. Return Value: true If AL buffer is successfully created false Otherwise --------------------------------------------------------------------------------------
| 140 | // false Otherwise |
| 141 | // -------------------------------------------------------------------------------------- |
| 142 | ALResult Tr2GpuBuffer::CreateBuffer() |
| 143 | { |
| 144 | m_buffer = Tr2BufferAL(); |
| 145 | if( !m_count || m_format == PIXEL_FORMAT_UNKNOWN ) |
| 146 | { |
| 147 | return E_INVALIDARG; |
| 148 | } |
| 149 | auto gpuUsage = Tr2GpuUsage::SHADER_RESOURCE; |
| 150 | auto cpuUsage = Tr2CpuUsage::READ; |
| 151 | if( m_creationFlags & GPU_WRITABLE ) |
| 152 | { |
| 153 | gpuUsage = gpuUsage | Tr2GpuUsage::UNORDERED_ACCESS; |
| 154 | } |
| 155 | else if( m_creationFlags & CPU_WRITABLE ) |
| 156 | { |
| 157 | cpuUsage = cpuUsage | Tr2CpuUsage::WRITE; |
| 158 | } |
| 159 | if( m_creationFlags & DRAW_INDIRECT ) |
| 160 | { |
| 161 | gpuUsage = gpuUsage | Tr2GpuUsage::DRAW_INDIRECT_ARGS; |
| 162 | } |
| 163 | |
| 164 | USE_MAIN_THREAD_RENDER_CONTEXT(); |
| 165 | auto hr = m_buffer.Create( |
| 166 | static_cast<PixelFormat>( m_format ), |
| 167 | m_count, |
| 168 | gpuUsage, |
| 169 | cpuUsage, |
| 170 | nullptr, |
| 171 | renderContext ); |
| 172 | if( !m_name.empty() && SUCCEEDED( hr ) ) |
| 173 | { |
| 174 | m_buffer.SetName( m_name.c_str() ); |
| 175 | } |
| 176 | return hr; |
| 177 | } |
| 178 | |
| 179 | void Tr2GpuBuffer::ReleaseResources( TriStorage ) |
| 180 | { |
no test coverage detected