------------------------------------------------------------------------------
| 814 | |
| 815 | //------------------------------------------------------------------------------ |
| 816 | wgpu::Buffer vtkWebGPUConfiguration::CreateBuffer(unsigned long sizeBytes, wgpu::BufferUsage usage, |
| 817 | bool mappedAtCreation /*=false*/, const char* label /*=nullptr*/) |
| 818 | { |
| 819 | auto& internals = (*this->Internals); |
| 820 | if (!internals.DeviceReady) |
| 821 | { |
| 822 | vtkWarningMacro(<< "Cannot create buffer because device is not ready."); |
| 823 | return nullptr; |
| 824 | } |
| 825 | wgpu::BufferDescriptor bufferDescriptor; |
| 826 | bufferDescriptor.label = label == nullptr ? "(nolabel)" : label; |
| 827 | bufferDescriptor.size = sizeBytes; |
| 828 | bufferDescriptor.usage = usage; |
| 829 | bufferDescriptor.mappedAtCreation = mappedAtCreation; |
| 830 | |
| 831 | return this->CreateBuffer(bufferDescriptor); |
| 832 | } |
| 833 | |
| 834 | //------------------------------------------------------------------------------ |
| 835 | wgpu::Buffer vtkWebGPUConfiguration::CreateBuffer(const wgpu::BufferDescriptor& bufferDescriptor) |