MCPcopy Create free account
hub / github.com/Kitware/VTK / WriteTexture

Method WriteTexture

Rendering/WebGPU/vtkWebGPUConfiguration.cxx:948–972  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

946
947//------------------------------------------------------------------------------
948void vtkWebGPUConfiguration::WriteTexture(wgpu::Texture texture, uint32_t bytesPerRow,
949 uint32_t sizeBytes, const void* data, uint32_t srcOffset /*=0*/,
950 wgpu::Origin3D dstOffset /*={0, 0, 0}*/, uint32_t dstMipLevel /*= 0*/,
951 const char* description /*= nullptr*/)
952{
953 auto& internals = (*this->Internals);
954 if (!internals.DeviceReady)
955 {
956 vtkWarningMacro(<< "Cannot write data into texture because device is not ready.");
957 return;
958 }
959 const auto copyTexture =
960 vtkWebGPUTextureInternals::GetTexelCopyTextureInfo(texture, dstOffset, dstMipLevel);
961
962 const auto textureDataLayout =
963 vtkWebGPUTextureInternals::GetDataLayout(texture, bytesPerRow, srcOffset);
964
965 wgpu::Extent3D textureExtents = { texture.GetWidth(), texture.GetHeight(),
966 texture.GetDepthOrArrayLayers() };
967 vtkVLog(this->GetGPUMemoryLogVerbosity(),
968 "Write texture {description: \"" << (description ? description : "null")
969 << "\", size: " << sizeBytes << "}");
970 internals.Device.GetQueue().WriteTexture(
971 &copyTexture, data, sizeBytes, &textureDataLayout, &textureExtents);
972}
973
974//------------------------------------------------------------------------------
975void vtkWebGPUConfiguration::SetGPUMemoryLogVerbosity(vtkLogger::Verbosity verbosity)

Callers 2

SendToWebGPUDeviceMethod · 0.45
WriteTextureDataMethod · 0.45

Calls 3

GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected